Skip to content

Commit 2b891f6

Browse files
authored
[swift6] Add checked Sendable conformance to Validation structs (#20150)
1 parent c06db15 commit 2b891f6

File tree

15 files changed

+60
-45
lines changed

15 files changed

+60
-45
lines changed

modules/openapi-generator/src/main/resources/swift6/Validation.mustache

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct StringRule: @unchecked Sendable {
9+
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct StringRule: Sendable {
1010
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var minLength: Int?
1111
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var maxLength: Int?
1212
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var pattern: String?
1313
}
1414

15-
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct NumericRule<T: Comparable & Numeric> {
1616
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var minimum: T?
1717
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var exclusiveMinimum = false
1818
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var maximum: T?
1919
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var exclusiveMaximum = false
2020
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct ArrayRule: @unchecked Sendable {
24+
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct ArrayRule: Sendable {
2425
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var minItems: Int?
2526
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var maxItems: Int?
2627
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var uniqueItems: Bool

samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
internal struct StringRule: @unchecked Sendable {
9+
internal struct StringRule: Sendable {
1010
internal var minLength: Int?
1111
internal var maxLength: Int?
1212
internal var pattern: String?
1313
}
1414

15-
internal struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
internal struct NumericRule<T: Comparable & Numeric> {
1616
internal var minimum: T?
1717
internal var exclusiveMinimum = false
1818
internal var maximum: T?
1919
internal var exclusiveMaximum = false
2020
internal var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
internal struct ArrayRule: @unchecked Sendable {
24+
internal struct ArrayRule: Sendable {
2425
internal var minItems: Int?
2526
internal var maxItems: Int?
2627
internal var uniqueItems: Bool

samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66

77
import Foundation
88

9-
public struct StringRule: @unchecked Sendable {
9+
public struct StringRule: Sendable {
1010
public var minLength: Int?
1111
public var maxLength: Int?
1212
public var pattern: String?
1313
}
1414

15-
public struct NumericRule<T: Comparable & Numeric>: @unchecked Sendable {
15+
public struct NumericRule<T: Comparable & Numeric> {
1616
public var minimum: T?
1717
public var exclusiveMinimum = false
1818
public var maximum: T?
1919
public var exclusiveMaximum = false
2020
public var multipleOf: T?
2121
}
22+
extension NumericRule: Sendable where T: Sendable {}
2223

23-
public struct ArrayRule: @unchecked Sendable {
24+
public struct ArrayRule: Sendable {
2425
public var minItems: Int?
2526
public var maxItems: Int?
2627
public var uniqueItems: Bool

0 commit comments

Comments
 (0)