forked from loafle/openapi-generator-original
[swift6] Add Sendable conformance to structs and enums (#20013)
This commit is contained in:
parent
67af02ccc8
commit
00dbe59994
@ -13,4 +13,5 @@ additionalProperties:
|
||||
useSPMFileStructure: true
|
||||
mapFileBinaryToData: true
|
||||
useClasses: true
|
||||
readonlyProperties: true
|
||||
swiftUseApiNamespace: true
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum JSONValue: Codable, Hashable {
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum JSONValue: Sendable, Codable, Hashable {
|
||||
case string(String)
|
||||
case int(Int)
|
||||
case double(Double)
|
||||
|
@ -44,6 +44,8 @@ extension CaseIterableDefaultsLast {
|
||||
case encodeValue(Wrapped)
|
||||
}
|
||||
|
||||
extension NullEncodable: Sendable where Wrapped: Sendable {}
|
||||
|
||||
extension NullEncodable: Codable where Wrapped: Codable {
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
|
@ -15,7 +15,7 @@ import Foundation
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct OpenAPIDateWithoutTime: Sendable, Codable, Hashable, Equatable {
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let wrappedDate: Date
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let timezone: TimeZone
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
internal struct SynchronizedDictionary<K: Hashable, V> {
|
||||
internal struct SynchronizedDictionary<K: Hashable, V> : @unchecked Sendable {
|
||||
|
||||
private var dictionary = [K: V]()
|
||||
private let lock = NSRecursiveLock()
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{dataType}}, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}, JSONEncodable{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{/enumUnknownDefaultCase}} {
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{dataType}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}, JSONEncodable{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{/enumUnknownDefaultCase}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
case {{{name}}} = {{{value}}}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isContainer}}{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}, JSONEncodable{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/isContainer}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{#isContainer}}, CaseIterableDefaultsLast{{/isContainer}}{{/enumUnknownDefaultCase}} {
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isContainer}}{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}, JSONEncodable{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/isContainer}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{#isContainer}}, CaseIterableDefaultsLast{{/isContainer}}{{/enumUnknownDefaultCase}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
case {{{name}}} = {{{value}}}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{{classname}}}: {{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{#useJsonEncodable}}, JSONEncodable{{/useJsonEncodable}}{{/useVapor}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} {
|
||||
{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{{classname}}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}@unchecked Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{#useJsonEncodable}}, JSONEncodable{{/useJsonEncodable}}{{/useVapor}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} {
|
||||
{{/objcCompatible}}{{#objcCompatible}}@objcMembers {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable{{#useJsonEncodable}}, JSONEncodable{{/useJsonEncodable}} {
|
||||
{{/objcCompatible}}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable, JSONEncodable{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}}{{/useVapor}} {
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable, JSONEncodable{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}}{{/useVapor}} {
|
||||
{{#oneOf}}
|
||||
case type{{.}}({{.}})
|
||||
{{/oneOf}}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum JSONValue: Codable, Hashable {
|
||||
public enum JSONValue: Sendable, Codable, Hashable {
|
||||
case string(String)
|
||||
case int(Int)
|
||||
case double(Double)
|
||||
|
@ -44,6 +44,8 @@ public enum NullEncodable<Wrapped: Hashable>: Hashable {
|
||||
case encodeValue(Wrapped)
|
||||
}
|
||||
|
||||
extension NullEncodable: Sendable where Wrapped: Sendable {}
|
||||
|
||||
extension NullEncodable: Codable where Wrapped: Codable {
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
|
@ -15,7 +15,7 @@ import Foundation
|
||||
/// an appropriate padding in order to transform to GMT+0 which is the assumed timezone in ISO 8601.
|
||||
/// When decoding, GMT+0 can be assumed (again: ISO8601) so there is no padding necessary and wrappedDate
|
||||
/// can be used safely.
|
||||
public struct OpenAPIDateWithoutTime: Codable, Hashable, Equatable {
|
||||
public struct OpenAPIDateWithoutTime: Sendable, Codable, Hashable, Equatable {
|
||||
public let wrappedDate: Date
|
||||
public let timezone: TimeZone
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
internal struct SynchronizedDictionary<K: Hashable, V> {
|
||||
internal struct SynchronizedDictionary<K: Hashable, V> : @unchecked Sendable {
|
||||
|
||||
private var dictionary = [K: V]()
|
||||
private let lock = NSRecursiveLock()
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct AdditionalPropertiesClass: Codable, JSONEncodable, Hashable {
|
||||
public struct AdditionalPropertiesClass: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var mapString: [String: String]?
|
||||
public var mapMapString: [String: [String: String]]?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Animal: Codable, JSONEncodable, Hashable {
|
||||
public struct Animal: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ApiResponse: Codable, JSONEncodable, Hashable {
|
||||
public struct ApiResponse: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var code: Int?
|
||||
public var type: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ArrayOfArrayOfNumberOnly: Codable, JSONEncodable, Hashable {
|
||||
public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var arrayArrayNumber: [[Double]]?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ArrayOfNumberOnly: Codable, JSONEncodable, Hashable {
|
||||
public struct ArrayOfNumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var arrayNumber: [Double]?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ArrayTest: Codable, JSONEncodable, Hashable {
|
||||
public struct ArrayTest: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var arrayOfString: [String]?
|
||||
public var arrayArrayOfInteger: [[Int64]]?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Capitalization: Codable, JSONEncodable, Hashable {
|
||||
public struct Capitalization: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var smallCamel: String?
|
||||
public var capitalCamel: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Cat: Codable, JSONEncodable, Hashable {
|
||||
public struct Cat: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Category: Codable, JSONEncodable, Hashable {
|
||||
public struct Category: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var id: Int64?
|
||||
public var name: String? = "default-name"
|
||||
|
@ -8,7 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model with \"_class\" property */
|
||||
public struct ClassModel: Codable, JSONEncodable, Hashable {
|
||||
public struct ClassModel: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var _class: String?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Client: Codable, JSONEncodable, Hashable {
|
||||
public struct Client: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var client: String?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Dog: Codable, JSONEncodable, Hashable {
|
||||
public struct Dog: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
@ -7,13 +7,13 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct EnumArrays: Codable, JSONEncodable, Hashable {
|
||||
public struct EnumArrays: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public enum JustSymbol: String, Codable, CaseIterable {
|
||||
public enum JustSymbol: String, Sendable, Codable, CaseIterable {
|
||||
case greaterThanOrEqualTo = ">="
|
||||
case dollar = "$"
|
||||
}
|
||||
public enum ArrayEnum: String, Codable, CaseIterable {
|
||||
public enum ArrayEnum: String, Sendable, Codable, CaseIterable {
|
||||
case fish = "fish"
|
||||
case crab = "crab"
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum EnumClass: String, Codable, CaseIterable {
|
||||
public enum EnumClass: String, Sendable, Codable, CaseIterable {
|
||||
case abc = "_abc"
|
||||
case efg = "-efg"
|
||||
case xyz = "(xyz)"
|
||||
|
@ -7,23 +7,23 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct EnumTest: Codable, JSONEncodable, Hashable {
|
||||
public struct EnumTest: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public enum EnumString: String, Codable, CaseIterable {
|
||||
public enum EnumString: String, Sendable, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
case lower = "lower"
|
||||
case empty = ""
|
||||
}
|
||||
public enum EnumStringRequired: String, Codable, CaseIterable {
|
||||
public enum EnumStringRequired: String, Sendable, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
case lower = "lower"
|
||||
case empty = ""
|
||||
}
|
||||
public enum EnumInteger: Int, Codable, CaseIterable {
|
||||
public enum EnumInteger: Int, Sendable, Codable, CaseIterable {
|
||||
case _1 = 1
|
||||
case number1 = -1
|
||||
}
|
||||
public enum EnumNumber: Double, Codable, CaseIterable {
|
||||
public enum EnumNumber: Double, Sendable, Codable, CaseIterable {
|
||||
case _11 = 1.1
|
||||
case number12 = -1.2
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Must be named `File` for test. */
|
||||
public struct File: Codable, JSONEncodable, Hashable {
|
||||
public struct File: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
/** Test capitalization */
|
||||
public var sourceURI: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct FileSchemaTestClass: Codable, JSONEncodable, Hashable {
|
||||
public struct FileSchemaTestClass: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var file: File?
|
||||
public var files: [File]?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct FormatTest: Codable, JSONEncodable, Hashable {
|
||||
public struct FormatTest: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
static let integerRule = NumericRule<Int>(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil)
|
||||
static let int32Rule = NumericRule<Int>(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil)
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct HasOnlyReadOnly: Codable, JSONEncodable, Hashable {
|
||||
public struct HasOnlyReadOnly: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var bar: String?
|
||||
public var foo: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct List: Codable, JSONEncodable, Hashable {
|
||||
public struct List: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var _123list: String?
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct MapTest: Codable, JSONEncodable, Hashable {
|
||||
public struct MapTest: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public enum MapOfEnumString: String, Codable, CaseIterable {
|
||||
public enum MapOfEnumString: String, Sendable, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
case lower = "lower"
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, JSONEncodable, Hashable {
|
||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var uuid: UUID?
|
||||
public var dateTime: Date?
|
||||
|
@ -8,7 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model name starting with number */
|
||||
public struct Model200Response: Codable, JSONEncodable, Hashable {
|
||||
public struct Model200Response: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var name: Int?
|
||||
public var _class: String?
|
||||
|
@ -8,7 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model name same as property name */
|
||||
public struct Name: Codable, JSONEncodable, Hashable {
|
||||
public struct Name: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var name: Int
|
||||
public var snakeCase: NullEncodable<Int> = .encodeValue(11033)
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct NumberOnly: Codable, JSONEncodable, Hashable {
|
||||
public struct NumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var justNumber: Double?
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Order: Codable, JSONEncodable, Hashable {
|
||||
public struct Order: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
public enum Status: String, Sendable, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
case approved = "approved"
|
||||
case delivered = "delivered"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct OuterComposite: Codable, JSONEncodable, Hashable {
|
||||
public struct OuterComposite: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var myNumber: Double?
|
||||
public var myString: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum OuterEnum: String, Codable, CaseIterable {
|
||||
public enum OuterEnum: String, Sendable, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
case approved = "approved"
|
||||
case delivered = "delivered"
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Pet: Codable, JSONEncodable, Hashable {
|
||||
public struct Pet: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
public enum Status: String, Sendable, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
case pending = "pending"
|
||||
case sold = "sold"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ReadOnlyFirst: Codable, JSONEncodable, Hashable {
|
||||
public struct ReadOnlyFirst: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var bar: String?
|
||||
public var baz: String?
|
||||
|
@ -8,7 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing reserved words */
|
||||
public struct Return: Codable, JSONEncodable, Hashable {
|
||||
public struct Return: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var _return: Int?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct SpecialModelName: Codable, JSONEncodable, Hashable {
|
||||
public struct SpecialModelName: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var specialPropertyName: Int64?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct StringBooleanMap: Codable, JSONEncodable, Hashable {
|
||||
public struct StringBooleanMap: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Tag: Codable, JSONEncodable, Hashable {
|
||||
public struct Tag: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var id: Int64?
|
||||
public var name: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct TypeHolderDefault: Codable, JSONEncodable, Hashable {
|
||||
public struct TypeHolderDefault: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var stringItem: String = "what"
|
||||
public var numberItem: Double
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct TypeHolderExample: Codable, JSONEncodable, Hashable {
|
||||
public struct TypeHolderExample: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var stringItem: String
|
||||
public var numberItem: Double
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct User: Codable, JSONEncodable, Hashable {
|
||||
public struct User: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var id: Int64?
|
||||
public var username: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum JSONValue: Codable, Hashable {
|
||||
public enum JSONValue: Sendable, Codable, Hashable {
|
||||
case string(String)
|
||||
case int(Int)
|
||||
case double(Double)
|
||||
|
@ -44,6 +44,8 @@ public enum NullEncodable<Wrapped: Hashable>: Hashable {
|
||||
case encodeValue(Wrapped)
|
||||
}
|
||||
|
||||
extension NullEncodable: Sendable where Wrapped: Sendable {}
|
||||
|
||||
extension NullEncodable: Codable where Wrapped: Codable {
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
internal struct SynchronizedDictionary<K: Hashable, V> {
|
||||
internal struct SynchronizedDictionary<K: Hashable, V> : @unchecked Sendable {
|
||||
|
||||
private var dictionary = [K: V]()
|
||||
private let lock = NSRecursiveLock()
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct AdditionalPropertiesClass: Codable, JSONEncodable, Hashable {
|
||||
public struct AdditionalPropertiesClass: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var mapString: [String: String]?
|
||||
public var mapMapString: [String: [String: String]]?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Animal: Codable, JSONEncodable, Hashable {
|
||||
public struct Animal: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ApiResponse: Codable, JSONEncodable, Hashable {
|
||||
public struct ApiResponse: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var code: Int?
|
||||
public var type: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ArrayOfArrayOfNumberOnly: Codable, JSONEncodable, Hashable {
|
||||
public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var arrayArrayNumber: [[Double]]?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ArrayOfNumberOnly: Codable, JSONEncodable, Hashable {
|
||||
public struct ArrayOfNumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var arrayNumber: [Double]?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ArrayTest: Codable, JSONEncodable, Hashable {
|
||||
public struct ArrayTest: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var arrayOfString: [String]?
|
||||
public var arrayArrayOfInteger: [[Int64]]?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Capitalization: Codable, JSONEncodable, Hashable {
|
||||
public struct Capitalization: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var smallCamel: String?
|
||||
public var capitalCamel: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Cat: Codable, JSONEncodable, Hashable {
|
||||
public struct Cat: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Category: Codable, JSONEncodable, Hashable {
|
||||
public struct Category: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var id: Int64?
|
||||
public var name: String? = "default-name"
|
||||
|
@ -8,7 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model with \"_class\" property */
|
||||
public struct ClassModel: Codable, JSONEncodable, Hashable {
|
||||
public struct ClassModel: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var _class: String?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Client: Codable, JSONEncodable, Hashable {
|
||||
public struct Client: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var client: String?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Dog: Codable, JSONEncodable, Hashable {
|
||||
public struct Dog: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
@ -7,13 +7,13 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct EnumArrays: Codable, JSONEncodable, Hashable {
|
||||
public struct EnumArrays: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public enum JustSymbol: String, Codable, CaseIterable {
|
||||
public enum JustSymbol: String, Sendable, Codable, CaseIterable {
|
||||
case greaterThanOrEqualTo = ">="
|
||||
case dollar = "$"
|
||||
}
|
||||
public enum ArrayEnum: String, Codable, CaseIterable {
|
||||
public enum ArrayEnum: String, Sendable, Codable, CaseIterable {
|
||||
case fish = "fish"
|
||||
case crab = "crab"
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum EnumClass: String, Codable, CaseIterable {
|
||||
public enum EnumClass: String, Sendable, Codable, CaseIterable {
|
||||
case abc = "_abc"
|
||||
case efg = "-efg"
|
||||
case xyz = "(xyz)"
|
||||
|
@ -7,23 +7,23 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct EnumTest: Codable, JSONEncodable, Hashable {
|
||||
public struct EnumTest: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public enum EnumString: String, Codable, CaseIterable {
|
||||
public enum EnumString: String, Sendable, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
case lower = "lower"
|
||||
case empty = ""
|
||||
}
|
||||
public enum EnumStringRequired: String, Codable, CaseIterable {
|
||||
public enum EnumStringRequired: String, Sendable, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
case lower = "lower"
|
||||
case empty = ""
|
||||
}
|
||||
public enum EnumInteger: Int, Codable, CaseIterable {
|
||||
public enum EnumInteger: Int, Sendable, Codable, CaseIterable {
|
||||
case _1 = 1
|
||||
case number1 = -1
|
||||
}
|
||||
public enum EnumNumber: Double, Codable, CaseIterable {
|
||||
public enum EnumNumber: Double, Sendable, Codable, CaseIterable {
|
||||
case _11 = 1.1
|
||||
case number12 = -1.2
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Must be named `File` for test. */
|
||||
public struct File: Codable, JSONEncodable, Hashable {
|
||||
public struct File: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
/** Test capitalization */
|
||||
public var sourceURI: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct FileSchemaTestClass: Codable, JSONEncodable, Hashable {
|
||||
public struct FileSchemaTestClass: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var file: File?
|
||||
public var files: [File]?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct FormatTest: Codable, JSONEncodable, Hashable {
|
||||
public struct FormatTest: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
static let integerRule = NumericRule<Int>(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil)
|
||||
static let int32Rule = NumericRule<Int>(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil)
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct HasOnlyReadOnly: Codable, JSONEncodable, Hashable {
|
||||
public struct HasOnlyReadOnly: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var bar: String?
|
||||
public var foo: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct List: Codable, JSONEncodable, Hashable {
|
||||
public struct List: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var _123list: String?
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct MapTest: Codable, JSONEncodable, Hashable {
|
||||
public struct MapTest: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public enum MapOfEnumString: String, Codable, CaseIterable {
|
||||
public enum MapOfEnumString: String, Sendable, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
case lower = "lower"
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, JSONEncodable, Hashable {
|
||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var uuid: UUID?
|
||||
public var dateTime: Date?
|
||||
|
@ -8,7 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model name starting with number */
|
||||
public struct Model200Response: Codable, JSONEncodable, Hashable {
|
||||
public struct Model200Response: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var name: Int?
|
||||
public var _class: String?
|
||||
|
@ -8,7 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model name same as property name */
|
||||
public struct Name: Codable, JSONEncodable, Hashable {
|
||||
public struct Name: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var name: Int
|
||||
public var snakeCase: NullEncodable<Int> = .encodeValue(11033)
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct NumberOnly: Codable, JSONEncodable, Hashable {
|
||||
public struct NumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var justNumber: Double?
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Order: Codable, JSONEncodable, Hashable {
|
||||
public struct Order: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
public enum Status: String, Sendable, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
case approved = "approved"
|
||||
case delivered = "delivered"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct OuterComposite: Codable, JSONEncodable, Hashable {
|
||||
public struct OuterComposite: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var myNumber: Double?
|
||||
public var myString: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum OuterEnum: String, Codable, CaseIterable {
|
||||
public enum OuterEnum: String, Sendable, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
case approved = "approved"
|
||||
case delivered = "delivered"
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Pet: Codable, JSONEncodable, Hashable {
|
||||
public struct Pet: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
public enum Status: String, Sendable, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
case pending = "pending"
|
||||
case sold = "sold"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ReadOnlyFirst: Codable, JSONEncodable, Hashable {
|
||||
public struct ReadOnlyFirst: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var bar: String?
|
||||
public var baz: String?
|
||||
|
@ -8,7 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing reserved words */
|
||||
public struct Return: Codable, JSONEncodable, Hashable {
|
||||
public struct Return: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var _return: Int?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct SpecialModelName: Codable, JSONEncodable, Hashable {
|
||||
public struct SpecialModelName: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var specialPropertyName: Int64?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Tag: Codable, JSONEncodable, Hashable {
|
||||
public struct Tag: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var id: Int64?
|
||||
public var name: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct TypeHolderDefault: Codable, JSONEncodable, Hashable {
|
||||
public struct TypeHolderDefault: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var stringItem: String = "what"
|
||||
public var numberItem: Double
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct TypeHolderExample: Codable, JSONEncodable, Hashable {
|
||||
public struct TypeHolderExample: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var stringItem: String
|
||||
public var numberItem: Double
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct User: Codable, JSONEncodable, Hashable {
|
||||
public struct User: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var id: Int64?
|
||||
public var username: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum JSONValue: Codable, Hashable {
|
||||
public enum JSONValue: Sendable, Codable, Hashable {
|
||||
case string(String)
|
||||
case int(Int)
|
||||
case double(Double)
|
||||
|
@ -43,6 +43,8 @@ public enum NullEncodable<Wrapped: Hashable>: Hashable {
|
||||
case encodeValue(Wrapped)
|
||||
}
|
||||
|
||||
extension NullEncodable: Sendable where Wrapped: Sendable {}
|
||||
|
||||
extension NullEncodable: Codable where Wrapped: Codable {
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
internal struct SynchronizedDictionary<K: Hashable, V> {
|
||||
internal struct SynchronizedDictionary<K: Hashable, V> : @unchecked Sendable {
|
||||
|
||||
private var dictionary = [K: V]()
|
||||
private let lock = NSRecursiveLock()
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct AdditionalPropertiesClass: Codable, JSONEncodable, Hashable {
|
||||
public struct AdditionalPropertiesClass: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var mapString: [String: String]?
|
||||
public var mapMapString: [String: [String: String]]?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Animal: Codable, JSONEncodable, Hashable {
|
||||
public struct Animal: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ApiResponse: Codable, JSONEncodable, Hashable {
|
||||
public struct ApiResponse: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var code: Int?
|
||||
public var type: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ArrayOfArrayOfNumberOnly: Codable, JSONEncodable, Hashable {
|
||||
public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var arrayArrayNumber: [[Double]]?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ArrayOfNumberOnly: Codable, JSONEncodable, Hashable {
|
||||
public struct ArrayOfNumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var arrayNumber: [Double]?
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ArrayTest: Codable, JSONEncodable, Hashable {
|
||||
public struct ArrayTest: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var arrayOfString: [String]?
|
||||
public var arrayArrayOfInteger: [[Int64]]?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Capitalization: Codable, JSONEncodable, Hashable {
|
||||
public struct Capitalization: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var smallCamel: String?
|
||||
public var capitalCamel: String?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Cat: Codable, JSONEncodable, Hashable {
|
||||
public struct Cat: Sendable, Codable, JSONEncodable, Hashable {
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user