diff --git a/bin/configs/swift5-urlsessionLibrary.yaml b/bin/configs/swift5-urlsessionLibrary.yaml
index 00bc36a585..b260611e60 100644
--- a/bin/configs/swift5-urlsessionLibrary.yaml
+++ b/bin/configs/swift5-urlsessionLibrary.yaml
@@ -10,3 +10,4 @@ additionalProperties:
projectName: PetstoreClient
podHomepage: https://github.com/openapitools/openapi-generator
useSPMFileStructure: true
+ useClasses: true
diff --git a/docs/generators/swift5.md b/docs/generators/swift5.md
index dc3e27cdec..9774b434f1 100644
--- a/docs/generators/swift5.md
+++ b/docs/generators/swift5.md
@@ -14,7 +14,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
- **true**
- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
- **false**
- The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
|lenientTypeCast|Accept and cast values for simple types (string->bool, string->int, int->string)| |false|
-|library|Library template (sub-template) to use|- **urlsession**
- [DEFAULT] HTTP client: URLSession
- **alamofire**
- HTTP client: Alamofire
- **vapor**
- HTTP client: Vapor
|urlsession|
+|library|Library template (sub-template) to use|- **urlsession**
- [DEFAULT] HTTP client: URLSession
- **alamofire**
- HTTP client: Alamofire
|urlsession|
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null|
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|podAuthors|Authors used for Podspec| |null|
diff --git a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache
index 715fa3dcd0..c119f723a2 100644
--- a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache
+++ b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache
@@ -1,4 +1,4 @@
-{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct {{classname}}: Codable, Hashable {
+{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{classname}}: Codable, Hashable {
{{/objcCompatible}}{{#objcCompatible}}@objc {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable {
{{/objcCompatible}}
@@ -36,6 +36,11 @@
{{/allVars}}
}
{{/hasVars}}
+ {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum CodingKeys: {{#hasVars}}String, {{/hasVars}}CodingKey, CaseIterable {
+ {{#allVars}}
+ case {{{name}}}{{#vendorExtensions.x-codegen-escaped-property-name}} = "{{{baseName}}}"{{/vendorExtensions.x-codegen-escaped-property-name}}
+ {{/allVars}}
+ }
{{#additionalPropertiesType}}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#readonlyProperties}}private(set) {{/readonlyProperties}}var additionalProperties: [String: {{{additionalPropertiesType}}}] = [:]
@@ -51,19 +56,22 @@
additionalProperties[key] = newValue
}
}
+{{/additionalPropertiesType}}
// Encodable protocol methods
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
+ var container = encoder.container(keyedBy: CodingKeys.self)
{{#allVars}}
- try container.encode{{#required}}{{#isNullable}}IfPresent{{/isNullable}}{{/required}}{{^required}}IfPresent{{/required}}({{{name}}}, forKey: "{{{baseName}}}")
+ try container.encode{{^required}}IfPresent{{/required}}({{{name}}}, forKey: .{{{name}}})
{{/allVars}}
- try container.encodeMap(additionalProperties)
+ {{#additionalPropertiesType}}
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
+ {{/additionalPropertiesType}}
}
+{{#additionalPropertiesType}}
// Decodable protocol methods
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}}{{#objcCompatible}} required{{/objcCompatible}} init(from decoder: Decoder) throws {
@@ -79,11 +87,20 @@
additionalProperties = try container.decodeMap({{{additionalPropertiesType}}}.self, excludedKeys: nonAdditionalPropertyKeys)
}
{{/additionalPropertiesType}}
-{{^additionalPropertiesType}}{{#vendorExtensions.x-codegen-has-escaped-property-names}}
- {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum CodingKeys: String, CodingKey, CaseIterable {
+
+{{^objcCompatible}}{{#useClasses}}
+ {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func == (lhs: {{classname}}, rhs: {{classname}}) -> Bool {
{{#allVars}}
- case {{{name}}}{{#vendorExtensions.x-codegen-escaped-property-name}} = "{{{baseName}}}"{{/vendorExtensions.x-codegen-escaped-property-name}}
+ lhs.{{{name}}} == rhs.{{{name}}}{{^-last}} &&{{/-last}}
{{/allVars}}
+ {{#additionalPropertiesType}}{{#hasVars}}&& {{/hasVars}}lhs.additionalProperties == rhs.additionalProperties{{/additionalPropertiesType}}
}
-{{/vendorExtensions.x-codegen-has-escaped-property-names}}{{/additionalPropertiesType}}
+
+ {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func hash(into hasher: inout Hasher) {
+ {{#allVars}}
+ hasher.combine({{{name}}}{{^required}}?{{/required}}.hashValue)
+ {{/allVars}}
+ {{#additionalPropertiesType}}hasher.combine(additionalProperties.hashValue){{/additionalPropertiesType}}
+ }
+{{/useClasses}}{{/objcCompatible}}
}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
index 1cb539452d..38797a5bf1 100644
--- a/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
+++ b/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
@@ -1096,6 +1096,7 @@ definitions:
name:
type: string
default: default-name
+ x-nullable: true
xml:
name: Category
User:
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
index 733b7bc515..84c1dad9ec 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
@@ -16,10 +16,19 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
self.mapString = mapString
self.mapMapString = mapMapString
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapMapString = "map_map_string"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapString, forKey: .mapString)
+ try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
index e57c8b4717..8111125240 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
@@ -16,5 +16,19 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
index 630992f623..beec80ae58 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
@@ -18,5 +18,21 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
index 4710793fc9..5ed956b922 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
index a41968d9b1..86f71f1534 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
index f442ea7254..e692ebd280 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
@@ -18,11 +18,21 @@ public struct ArrayTest: Codable, Hashable {
self.arrayArrayOfInteger = arrayArrayOfInteger
self.arrayArrayOfModel = arrayArrayOfModel
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayOfString = "array_of_string"
case arrayArrayOfInteger = "array_array_of_integer"
case arrayArrayOfModel = "array_array_of_model"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayOfString, forKey: .arrayOfString)
+ try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
+ try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
index 44b50bbe00..692a3b212f 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
@@ -25,7 +25,6 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@@ -35,4 +34,18 @@ public struct Capitalization: Codable, Hashable {
case ATT_NAME
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(smallCamel, forKey: .smallCamel)
+ try container.encodeIfPresent(capitalCamel, forKey: .capitalCamel)
+ try container.encodeIfPresent(smallSnake, forKey: .smallSnake)
+ try container.encodeIfPresent(capitalSnake, forKey: .capitalSnake)
+ try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
+ try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
index c6bf4460da..73335b4d39 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
@@ -18,5 +18,21 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
index f9484f9bc8..c17cf0d206 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
@@ -14,5 +14,17 @@ public struct CatAllOf: Codable, Hashable {
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
index 6a19bb02d0..dfd5504a65 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
@@ -10,11 +10,25 @@ import Foundation
public struct Category: Codable, Hashable {
public var id: Int64?
- public var name: String = "default-name"
+ public var name: String? = "default-name"
- public init(id: Int64? = nil, name: String = "default-name") {
+ public init(id: Int64? = nil, name: String? = "default-name") {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encode(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
index 5c8e888283..9b5340899a 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
@@ -15,5 +15,17 @@ public struct ClassModel: Codable, Hashable {
public init(_class: String? = nil) {
self._class = _class
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case _class
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
index 1464b047c0..f0e62d05b1 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
@@ -14,5 +14,17 @@ public struct Client: Codable, Hashable {
public init(client: String? = nil) {
self.client = client
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case client
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(client, forKey: .client)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
index 5aed7834d5..137b9a5254 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
@@ -18,5 +18,21 @@ public struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
index 716776261d..4f7070a4f6 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
@@ -14,5 +14,17 @@ public struct DogAllOf: Codable, Hashable {
public init(breed: String? = nil) {
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
index aa13aa59f8..eb761dca90 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
@@ -24,10 +24,19 @@ public struct EnumArrays: Codable, Hashable {
self.justSymbol = justSymbol
self.arrayEnum = arrayEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justSymbol = "just_symbol"
case arrayEnum = "array_enum"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
+ try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
index 8b62febdc9..45236c7926 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
@@ -40,7 +40,6 @@ public struct EnumTest: Codable, Hashable {
self.enumNumber = enumNumber
self.outerEnum = outerEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case enumString = "enum_string"
case enumStringRequired = "enum_string_required"
@@ -49,4 +48,17 @@ public struct EnumTest: Codable, Hashable {
case outerEnum
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(enumString, forKey: .enumString)
+ try container.encode(enumStringRequired, forKey: .enumStringRequired)
+ try container.encodeIfPresent(enumInteger, forKey: .enumInteger)
+ try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
+ try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
index aa14d76239..15dbd0c03f 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
@@ -16,5 +16,17 @@ public struct File: Codable, Hashable {
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case sourceURI
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
index 8598770977..52b3f620cd 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
@@ -16,5 +16,19 @@ public struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case file
+ case files
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(file, forKey: .file)
+ try container.encodeIfPresent(files, forKey: .files)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
index f09cb471b3..232b8c4929 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
@@ -38,5 +38,41 @@ public struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case integer
+ case int32
+ case int64
+ case number
+ case float
+ case double
+ case string
+ case byte
+ case binary
+ case date
+ case dateTime
+ case uuid
+ case password
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(integer, forKey: .integer)
+ try container.encodeIfPresent(int32, forKey: .int32)
+ try container.encodeIfPresent(int64, forKey: .int64)
+ try container.encode(number, forKey: .number)
+ try container.encodeIfPresent(float, forKey: .float)
+ try container.encodeIfPresent(double, forKey: .double)
+ try container.encodeIfPresent(string, forKey: .string)
+ try container.encode(byte, forKey: .byte)
+ try container.encodeIfPresent(binary, forKey: .binary)
+ try container.encode(date, forKey: .date)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encode(password, forKey: .password)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
index 03d35274a4..0097907e9b 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
@@ -16,5 +16,19 @@ public struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case foo
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(foo, forKey: .foo)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
index f8f08e4c6c..48704fd138 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
@@ -14,9 +14,17 @@ public struct List: Codable, Hashable {
public init(_123list: String? = nil) {
self._123list = _123list
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_123list, forKey: ._123list)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
index bd4e7b97e8..96af40355d 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
@@ -24,7 +24,6 @@ public struct MapTest: Codable, Hashable {
self.directMap = directMap
self.indirectMap = indirectMap
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapMapOfString = "map_map_of_string"
case mapOfEnumString = "map_of_enum_string"
@@ -32,4 +31,16 @@ public struct MapTest: Codable, Hashable {
case indirectMap = "indirect_map"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapMapOfString, forKey: .mapMapOfString)
+ try container.encodeIfPresent(mapOfEnumString, forKey: .mapOfEnumString)
+ try container.encodeIfPresent(directMap, forKey: .directMap)
+ try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
index 80c1781a2b..1f3a7ca820 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
@@ -18,5 +18,21 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case uuid
+ case dateTime
+ case map
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(map, forKey: .map)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
index d36d4e2735..f6a5836117 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
@@ -17,10 +17,19 @@ public struct Model200Response: Codable, Hashable {
self.name = name
self._class = _class
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case _class = "class"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(name, forKey: .name)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
index 49cc575441..57336422c8 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
@@ -21,7 +21,6 @@ public struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@@ -29,4 +28,16 @@ public struct Name: Codable, Hashable {
case _123number = "123Number"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(name, forKey: .name)
+ try container.encodeIfPresent(snakeCase, forKey: .snakeCase)
+ try container.encodeIfPresent(property, forKey: .property)
+ try container.encodeIfPresent(_123number, forKey: ._123number)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
index 6b024294e2..861a307e19 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
@@ -14,9 +14,17 @@ public struct NumberOnly: Codable, Hashable {
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justNumber, forKey: .justNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
index 8ef7cb79e2..1d2c313581 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
@@ -30,5 +30,27 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case petId
+ case quantity
+ case shipDate
+ case status
+ case complete
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
index 9865764ff9..6935641c36 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
@@ -18,11 +18,21 @@ public struct OuterComposite: Codable, Hashable {
self.myString = myString
self.myBoolean = myBoolean
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case myNumber = "my_number"
case myString = "my_string"
case myBoolean = "my_boolean"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(myNumber, forKey: .myNumber)
+ try container.encodeIfPresent(myString, forKey: .myString)
+ try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
index 1bc823d3e9..fa5b125ff1 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
@@ -30,5 +30,27 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case category
+ case name
+ case photoUrls
+ case tags
+ case status
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
index 03b5b0dbf0..2ff56cc156 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
@@ -16,5 +16,19 @@ public struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case baz
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(baz, forKey: .baz)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
index 5f539f4618..219b49420a 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
@@ -15,9 +15,17 @@ public struct Return: Codable, Hashable {
public init(_return: Int? = nil) {
self._return = _return
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _return = "return"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_return, forKey: ._return)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
index cb82d2ae3a..562ba86f60 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
@@ -14,9 +14,17 @@ public struct SpecialModelName: Codable, Hashable {
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
index 77ab81f5f3..a6903b84ce 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
@@ -9,6 +9,8 @@ import Foundation
public struct StringBooleanMap: Codable, Hashable {
+ public enum CodingKeys: CodingKey, CaseIterable {
+ }
public var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@@ -27,10 +29,9 @@ public struct StringBooleanMap: Codable, Hashable {
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
- try container.encodeMap(additionalProperties)
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
}
// Decodable protocol methods
@@ -42,4 +43,5 @@ public struct StringBooleanMap: Codable, Hashable {
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
index 8b8e24fc39..bda5be3493 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
@@ -16,5 +16,19 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
index f1920ef377..e789620391 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
@@ -22,7 +22,6 @@ public struct TypeHolderDefault: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderDefault: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
index 1a23c1b486..2952b67016 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
@@ -22,7 +22,6 @@ public struct TypeHolderExample: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderExample: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
index f3b4f6bb95..a1aa36bcfb 100644
--- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
+++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
@@ -29,5 +29,31 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case username
+ case firstName
+ case lastName
+ case email
+ case password
+ case phone
+ case userStatus
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
index 733b7bc515..84c1dad9ec 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
@@ -16,10 +16,19 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
self.mapString = mapString
self.mapMapString = mapMapString
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapMapString = "map_map_string"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapString, forKey: .mapString)
+ try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
index e57c8b4717..8111125240 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
@@ -16,5 +16,19 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
index 630992f623..beec80ae58 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
@@ -18,5 +18,21 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
index 4710793fc9..5ed956b922 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
index a41968d9b1..86f71f1534 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
index f442ea7254..e692ebd280 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
@@ -18,11 +18,21 @@ public struct ArrayTest: Codable, Hashable {
self.arrayArrayOfInteger = arrayArrayOfInteger
self.arrayArrayOfModel = arrayArrayOfModel
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayOfString = "array_of_string"
case arrayArrayOfInteger = "array_array_of_integer"
case arrayArrayOfModel = "array_array_of_model"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayOfString, forKey: .arrayOfString)
+ try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
+ try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
index 44b50bbe00..692a3b212f 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
@@ -25,7 +25,6 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@@ -35,4 +34,18 @@ public struct Capitalization: Codable, Hashable {
case ATT_NAME
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(smallCamel, forKey: .smallCamel)
+ try container.encodeIfPresent(capitalCamel, forKey: .capitalCamel)
+ try container.encodeIfPresent(smallSnake, forKey: .smallSnake)
+ try container.encodeIfPresent(capitalSnake, forKey: .capitalSnake)
+ try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
+ try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
index c6bf4460da..73335b4d39 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
@@ -18,5 +18,21 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
index f9484f9bc8..c17cf0d206 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
@@ -14,5 +14,17 @@ public struct CatAllOf: Codable, Hashable {
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
index 6a19bb02d0..dfd5504a65 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
@@ -10,11 +10,25 @@ import Foundation
public struct Category: Codable, Hashable {
public var id: Int64?
- public var name: String = "default-name"
+ public var name: String? = "default-name"
- public init(id: Int64? = nil, name: String = "default-name") {
+ public init(id: Int64? = nil, name: String? = "default-name") {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encode(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
index 5c8e888283..9b5340899a 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
@@ -15,5 +15,17 @@ public struct ClassModel: Codable, Hashable {
public init(_class: String? = nil) {
self._class = _class
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case _class
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
index 1464b047c0..f0e62d05b1 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
@@ -14,5 +14,17 @@ public struct Client: Codable, Hashable {
public init(client: String? = nil) {
self.client = client
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case client
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(client, forKey: .client)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
index 5aed7834d5..137b9a5254 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
@@ -18,5 +18,21 @@ public struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
index 716776261d..4f7070a4f6 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
@@ -14,5 +14,17 @@ public struct DogAllOf: Codable, Hashable {
public init(breed: String? = nil) {
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
index aa13aa59f8..eb761dca90 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
@@ -24,10 +24,19 @@ public struct EnumArrays: Codable, Hashable {
self.justSymbol = justSymbol
self.arrayEnum = arrayEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justSymbol = "just_symbol"
case arrayEnum = "array_enum"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
+ try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
index 8b62febdc9..45236c7926 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
@@ -40,7 +40,6 @@ public struct EnumTest: Codable, Hashable {
self.enumNumber = enumNumber
self.outerEnum = outerEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case enumString = "enum_string"
case enumStringRequired = "enum_string_required"
@@ -49,4 +48,17 @@ public struct EnumTest: Codable, Hashable {
case outerEnum
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(enumString, forKey: .enumString)
+ try container.encode(enumStringRequired, forKey: .enumStringRequired)
+ try container.encodeIfPresent(enumInteger, forKey: .enumInteger)
+ try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
+ try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
index aa14d76239..15dbd0c03f 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
@@ -16,5 +16,17 @@ public struct File: Codable, Hashable {
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case sourceURI
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
index 8598770977..52b3f620cd 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
@@ -16,5 +16,19 @@ public struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case file
+ case files
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(file, forKey: .file)
+ try container.encodeIfPresent(files, forKey: .files)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
index f09cb471b3..232b8c4929 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
@@ -38,5 +38,41 @@ public struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case integer
+ case int32
+ case int64
+ case number
+ case float
+ case double
+ case string
+ case byte
+ case binary
+ case date
+ case dateTime
+ case uuid
+ case password
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(integer, forKey: .integer)
+ try container.encodeIfPresent(int32, forKey: .int32)
+ try container.encodeIfPresent(int64, forKey: .int64)
+ try container.encode(number, forKey: .number)
+ try container.encodeIfPresent(float, forKey: .float)
+ try container.encodeIfPresent(double, forKey: .double)
+ try container.encodeIfPresent(string, forKey: .string)
+ try container.encode(byte, forKey: .byte)
+ try container.encodeIfPresent(binary, forKey: .binary)
+ try container.encode(date, forKey: .date)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encode(password, forKey: .password)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
index 03d35274a4..0097907e9b 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
@@ -16,5 +16,19 @@ public struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case foo
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(foo, forKey: .foo)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
index f8f08e4c6c..48704fd138 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
@@ -14,9 +14,17 @@ public struct List: Codable, Hashable {
public init(_123list: String? = nil) {
self._123list = _123list
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_123list, forKey: ._123list)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
index bd4e7b97e8..96af40355d 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
@@ -24,7 +24,6 @@ public struct MapTest: Codable, Hashable {
self.directMap = directMap
self.indirectMap = indirectMap
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapMapOfString = "map_map_of_string"
case mapOfEnumString = "map_of_enum_string"
@@ -32,4 +31,16 @@ public struct MapTest: Codable, Hashable {
case indirectMap = "indirect_map"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapMapOfString, forKey: .mapMapOfString)
+ try container.encodeIfPresent(mapOfEnumString, forKey: .mapOfEnumString)
+ try container.encodeIfPresent(directMap, forKey: .directMap)
+ try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
index 80c1781a2b..1f3a7ca820 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
@@ -18,5 +18,21 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case uuid
+ case dateTime
+ case map
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(map, forKey: .map)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
index d36d4e2735..f6a5836117 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
@@ -17,10 +17,19 @@ public struct Model200Response: Codable, Hashable {
self.name = name
self._class = _class
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case _class = "class"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(name, forKey: .name)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
index 49cc575441..57336422c8 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
@@ -21,7 +21,6 @@ public struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@@ -29,4 +28,16 @@ public struct Name: Codable, Hashable {
case _123number = "123Number"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(name, forKey: .name)
+ try container.encodeIfPresent(snakeCase, forKey: .snakeCase)
+ try container.encodeIfPresent(property, forKey: .property)
+ try container.encodeIfPresent(_123number, forKey: ._123number)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
index 6b024294e2..861a307e19 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
@@ -14,9 +14,17 @@ public struct NumberOnly: Codable, Hashable {
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justNumber, forKey: .justNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
index 8ef7cb79e2..1d2c313581 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
@@ -30,5 +30,27 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case petId
+ case quantity
+ case shipDate
+ case status
+ case complete
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
index 9865764ff9..6935641c36 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
@@ -18,11 +18,21 @@ public struct OuterComposite: Codable, Hashable {
self.myString = myString
self.myBoolean = myBoolean
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case myNumber = "my_number"
case myString = "my_string"
case myBoolean = "my_boolean"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(myNumber, forKey: .myNumber)
+ try container.encodeIfPresent(myString, forKey: .myString)
+ try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
index 1bc823d3e9..fa5b125ff1 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
@@ -30,5 +30,27 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case category
+ case name
+ case photoUrls
+ case tags
+ case status
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
index 03b5b0dbf0..2ff56cc156 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
@@ -16,5 +16,19 @@ public struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case baz
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(baz, forKey: .baz)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
index 5f539f4618..219b49420a 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
@@ -15,9 +15,17 @@ public struct Return: Codable, Hashable {
public init(_return: Int? = nil) {
self._return = _return
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _return = "return"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_return, forKey: ._return)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
index cb82d2ae3a..562ba86f60 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
@@ -14,9 +14,17 @@ public struct SpecialModelName: Codable, Hashable {
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
index 77ab81f5f3..a6903b84ce 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
@@ -9,6 +9,8 @@ import Foundation
public struct StringBooleanMap: Codable, Hashable {
+ public enum CodingKeys: CodingKey, CaseIterable {
+ }
public var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@@ -27,10 +29,9 @@ public struct StringBooleanMap: Codable, Hashable {
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
- try container.encodeMap(additionalProperties)
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
}
// Decodable protocol methods
@@ -42,4 +43,5 @@ public struct StringBooleanMap: Codable, Hashable {
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
index 8b8e24fc39..bda5be3493 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
@@ -16,5 +16,19 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
index f1920ef377..e789620391 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
@@ -22,7 +22,6 @@ public struct TypeHolderDefault: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderDefault: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
index 1a23c1b486..2952b67016 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
@@ -22,7 +22,6 @@ public struct TypeHolderExample: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderExample: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
index f3b4f6bb95..a1aa36bcfb 100644
--- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
+++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
@@ -29,5 +29,31 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case username
+ case firstName
+ case lastName
+ case email
+ case password
+ case phone
+ case userStatus
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
index 733b7bc515..84c1dad9ec 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
@@ -16,10 +16,19 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
self.mapString = mapString
self.mapMapString = mapMapString
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapMapString = "map_map_string"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapString, forKey: .mapString)
+ try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
index e57c8b4717..8111125240 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
@@ -16,5 +16,19 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
index 630992f623..beec80ae58 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
@@ -18,5 +18,21 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
index 4710793fc9..5ed956b922 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
index a41968d9b1..86f71f1534 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
index f442ea7254..e692ebd280 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
@@ -18,11 +18,21 @@ public struct ArrayTest: Codable, Hashable {
self.arrayArrayOfInteger = arrayArrayOfInteger
self.arrayArrayOfModel = arrayArrayOfModel
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayOfString = "array_of_string"
case arrayArrayOfInteger = "array_array_of_integer"
case arrayArrayOfModel = "array_array_of_model"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayOfString, forKey: .arrayOfString)
+ try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
+ try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
index 44b50bbe00..692a3b212f 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
@@ -25,7 +25,6 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@@ -35,4 +34,18 @@ public struct Capitalization: Codable, Hashable {
case ATT_NAME
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(smallCamel, forKey: .smallCamel)
+ try container.encodeIfPresent(capitalCamel, forKey: .capitalCamel)
+ try container.encodeIfPresent(smallSnake, forKey: .smallSnake)
+ try container.encodeIfPresent(capitalSnake, forKey: .capitalSnake)
+ try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
+ try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
index c6bf4460da..73335b4d39 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
@@ -18,5 +18,21 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
index f9484f9bc8..c17cf0d206 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
@@ -14,5 +14,17 @@ public struct CatAllOf: Codable, Hashable {
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
index 6a19bb02d0..dfd5504a65 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
@@ -10,11 +10,25 @@ import Foundation
public struct Category: Codable, Hashable {
public var id: Int64?
- public var name: String = "default-name"
+ public var name: String? = "default-name"
- public init(id: Int64? = nil, name: String = "default-name") {
+ public init(id: Int64? = nil, name: String? = "default-name") {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encode(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
index 5c8e888283..9b5340899a 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
@@ -15,5 +15,17 @@ public struct ClassModel: Codable, Hashable {
public init(_class: String? = nil) {
self._class = _class
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case _class
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
index 1464b047c0..f0e62d05b1 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
@@ -14,5 +14,17 @@ public struct Client: Codable, Hashable {
public init(client: String? = nil) {
self.client = client
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case client
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(client, forKey: .client)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
index 5aed7834d5..137b9a5254 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
@@ -18,5 +18,21 @@ public struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
index 716776261d..4f7070a4f6 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
@@ -14,5 +14,17 @@ public struct DogAllOf: Codable, Hashable {
public init(breed: String? = nil) {
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
index aa13aa59f8..eb761dca90 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
@@ -24,10 +24,19 @@ public struct EnumArrays: Codable, Hashable {
self.justSymbol = justSymbol
self.arrayEnum = arrayEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justSymbol = "just_symbol"
case arrayEnum = "array_enum"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
+ try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
index 8b62febdc9..45236c7926 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
@@ -40,7 +40,6 @@ public struct EnumTest: Codable, Hashable {
self.enumNumber = enumNumber
self.outerEnum = outerEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case enumString = "enum_string"
case enumStringRequired = "enum_string_required"
@@ -49,4 +48,17 @@ public struct EnumTest: Codable, Hashable {
case outerEnum
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(enumString, forKey: .enumString)
+ try container.encode(enumStringRequired, forKey: .enumStringRequired)
+ try container.encodeIfPresent(enumInteger, forKey: .enumInteger)
+ try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
+ try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift
index aa14d76239..15dbd0c03f 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift
@@ -16,5 +16,17 @@ public struct File: Codable, Hashable {
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case sourceURI
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
index 8598770977..52b3f620cd 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
@@ -16,5 +16,19 @@ public struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case file
+ case files
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(file, forKey: .file)
+ try container.encodeIfPresent(files, forKey: .files)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
index f09cb471b3..232b8c4929 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
@@ -38,5 +38,41 @@ public struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case integer
+ case int32
+ case int64
+ case number
+ case float
+ case double
+ case string
+ case byte
+ case binary
+ case date
+ case dateTime
+ case uuid
+ case password
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(integer, forKey: .integer)
+ try container.encodeIfPresent(int32, forKey: .int32)
+ try container.encodeIfPresent(int64, forKey: .int64)
+ try container.encode(number, forKey: .number)
+ try container.encodeIfPresent(float, forKey: .float)
+ try container.encodeIfPresent(double, forKey: .double)
+ try container.encodeIfPresent(string, forKey: .string)
+ try container.encode(byte, forKey: .byte)
+ try container.encodeIfPresent(binary, forKey: .binary)
+ try container.encode(date, forKey: .date)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encode(password, forKey: .password)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
index 03d35274a4..0097907e9b 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
@@ -16,5 +16,19 @@ public struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case foo
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(foo, forKey: .foo)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift
index f8f08e4c6c..48704fd138 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift
@@ -14,9 +14,17 @@ public struct List: Codable, Hashable {
public init(_123list: String? = nil) {
self._123list = _123list
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_123list, forKey: ._123list)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
index bd4e7b97e8..96af40355d 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
@@ -24,7 +24,6 @@ public struct MapTest: Codable, Hashable {
self.directMap = directMap
self.indirectMap = indirectMap
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapMapOfString = "map_map_of_string"
case mapOfEnumString = "map_of_enum_string"
@@ -32,4 +31,16 @@ public struct MapTest: Codable, Hashable {
case indirectMap = "indirect_map"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapMapOfString, forKey: .mapMapOfString)
+ try container.encodeIfPresent(mapOfEnumString, forKey: .mapOfEnumString)
+ try container.encodeIfPresent(directMap, forKey: .directMap)
+ try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
index 80c1781a2b..1f3a7ca820 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
@@ -18,5 +18,21 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case uuid
+ case dateTime
+ case map
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(map, forKey: .map)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
index d36d4e2735..f6a5836117 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
@@ -17,10 +17,19 @@ public struct Model200Response: Codable, Hashable {
self.name = name
self._class = _class
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case _class = "class"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(name, forKey: .name)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
index 49cc575441..57336422c8 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
@@ -21,7 +21,6 @@ public struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@@ -29,4 +28,16 @@ public struct Name: Codable, Hashable {
case _123number = "123Number"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(name, forKey: .name)
+ try container.encodeIfPresent(snakeCase, forKey: .snakeCase)
+ try container.encodeIfPresent(property, forKey: .property)
+ try container.encodeIfPresent(_123number, forKey: ._123number)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
index 6b024294e2..861a307e19 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
@@ -14,9 +14,17 @@ public struct NumberOnly: Codable, Hashable {
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justNumber, forKey: .justNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
index 8ef7cb79e2..1d2c313581 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
@@ -30,5 +30,27 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case petId
+ case quantity
+ case shipDate
+ case status
+ case complete
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
index 9865764ff9..6935641c36 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
@@ -18,11 +18,21 @@ public struct OuterComposite: Codable, Hashable {
self.myString = myString
self.myBoolean = myBoolean
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case myNumber = "my_number"
case myString = "my_string"
case myBoolean = "my_boolean"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(myNumber, forKey: .myNumber)
+ try container.encodeIfPresent(myString, forKey: .myString)
+ try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
index 1bc823d3e9..fa5b125ff1 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
@@ -30,5 +30,27 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case category
+ case name
+ case photoUrls
+ case tags
+ case status
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
index 03b5b0dbf0..2ff56cc156 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
@@ -16,5 +16,19 @@ public struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case baz
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(baz, forKey: .baz)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
index 5f539f4618..219b49420a 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
@@ -15,9 +15,17 @@ public struct Return: Codable, Hashable {
public init(_return: Int? = nil) {
self._return = _return
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _return = "return"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_return, forKey: ._return)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
index cb82d2ae3a..562ba86f60 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
@@ -14,9 +14,17 @@ public struct SpecialModelName: Codable, Hashable {
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
index 77ab81f5f3..a6903b84ce 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
@@ -9,6 +9,8 @@ import Foundation
public struct StringBooleanMap: Codable, Hashable {
+ public enum CodingKeys: CodingKey, CaseIterable {
+ }
public var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@@ -27,10 +29,9 @@ public struct StringBooleanMap: Codable, Hashable {
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
- try container.encodeMap(additionalProperties)
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
}
// Decodable protocol methods
@@ -42,4 +43,5 @@ public struct StringBooleanMap: Codable, Hashable {
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
index 8b8e24fc39..bda5be3493 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
@@ -16,5 +16,19 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
index f1920ef377..e789620391 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
@@ -22,7 +22,6 @@ public struct TypeHolderDefault: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderDefault: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
index 1a23c1b486..2952b67016 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
@@ -22,7 +22,6 @@ public struct TypeHolderExample: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderExample: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift
index f3b4f6bb95..a1aa36bcfb 100644
--- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift
+++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift
@@ -29,5 +29,31 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case username
+ case firstName
+ case lastName
+ case email
+ case password
+ case phone
+ case userStatus
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
index c8058e8db2..77798101de 100644
--- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
@@ -19,5 +19,21 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
index bbf2ef73f2..7f03d621a4 100644
--- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
+++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
@@ -17,5 +17,19 @@ public struct Category: Codable, Hashable {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
index 4401234cb3..5a6dadc0ef 100644
--- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
+++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
@@ -32,5 +32,27 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case petId
+ case quantity
+ case shipDate
+ case status
+ case complete
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
index ab283fe488..0d6973e816 100644
--- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
+++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
@@ -32,5 +32,27 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case category
+ case name
+ case photoUrls
+ case tags
+ case status
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
index a3a488b13f..5cb4749125 100644
--- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
+++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
@@ -17,5 +17,19 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/User.swift
index 566bb545db..c6a5806130 100644
--- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/User.swift
+++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/User.swift
@@ -30,5 +30,31 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case username
+ case firstName
+ case lastName
+ case email
+ case password
+ case phone
+ case userStatus
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
index 34e7b0fd4e..b425caa615 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
@@ -16,10 +16,19 @@ internal struct AdditionalPropertiesClass: Codable, Hashable {
self.mapString = mapString
self.mapMapString = mapMapString
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapMapString = "map_map_string"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapString, forKey: .mapString)
+ try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
index 80422aa94a..d3e38b1359 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
@@ -16,5 +16,19 @@ internal struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
index b117aad713..7147581833 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
@@ -18,5 +18,21 @@ internal struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
index d5ce23fb27..39b6314c5f 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ internal struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
internal init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
index fa96400f7a..f7714be336 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ internal struct ArrayOfNumberOnly: Codable, Hashable {
internal init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
index c731155e26..1e6af9eebf 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
@@ -18,11 +18,21 @@ internal struct ArrayTest: Codable, Hashable {
self.arrayArrayOfInteger = arrayArrayOfInteger
self.arrayArrayOfModel = arrayArrayOfModel
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case arrayOfString = "array_of_string"
case arrayArrayOfInteger = "array_array_of_integer"
case arrayArrayOfModel = "array_array_of_model"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayOfString, forKey: .arrayOfString)
+ try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
+ try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
index a55eef8975..ffa880de23 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
@@ -25,7 +25,6 @@ internal struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@@ -35,4 +34,18 @@ internal struct Capitalization: Codable, Hashable {
case ATT_NAME
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(smallCamel, forKey: .smallCamel)
+ try container.encodeIfPresent(capitalCamel, forKey: .capitalCamel)
+ try container.encodeIfPresent(smallSnake, forKey: .smallSnake)
+ try container.encodeIfPresent(capitalSnake, forKey: .capitalSnake)
+ try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
+ try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
index 081244637a..287f42d078 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
@@ -18,5 +18,21 @@ internal struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
index a7fc1f2482..7ee6ec8684 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
@@ -14,5 +14,17 @@ internal struct CatAllOf: Codable, Hashable {
internal init(declawed: Bool? = nil) {
self.declawed = declawed
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
index 3b4f6c149f..9ed7d49d38 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
@@ -10,11 +10,25 @@ import Foundation
internal struct Category: Codable, Hashable {
internal var id: Int64?
- internal var name: String = "default-name"
+ internal var name: String? = "default-name"
- internal init(id: Int64? = nil, name: String = "default-name") {
+ internal init(id: Int64? = nil, name: String? = "default-name") {
self.id = id
self.name = name
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encode(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
index 33b54fdd4e..30f6f8fb4d 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
@@ -15,5 +15,17 @@ internal struct ClassModel: Codable, Hashable {
internal init(_class: String? = nil) {
self._class = _class
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case _class
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
index de09406d53..fbb17db6d0 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
@@ -14,5 +14,17 @@ internal struct Client: Codable, Hashable {
internal init(client: String? = nil) {
self.client = client
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case client
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(client, forKey: .client)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
index 161bead822..e43a80c44d 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
@@ -18,5 +18,21 @@ internal struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
index 5957070689..ae19d9bbd6 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
@@ -14,5 +14,17 @@ internal struct DogAllOf: Codable, Hashable {
internal init(breed: String? = nil) {
self.breed = breed
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
index 8a8f61af58..ed96308667 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
@@ -24,10 +24,19 @@ internal struct EnumArrays: Codable, Hashable {
self.justSymbol = justSymbol
self.arrayEnum = arrayEnum
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case justSymbol = "just_symbol"
case arrayEnum = "array_enum"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
+ try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
index 27ed6bce55..7b76f6acb3 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
@@ -40,7 +40,6 @@ internal struct EnumTest: Codable, Hashable {
self.enumNumber = enumNumber
self.outerEnum = outerEnum
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case enumString = "enum_string"
case enumStringRequired = "enum_string_required"
@@ -49,4 +48,17 @@ internal struct EnumTest: Codable, Hashable {
case outerEnum
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(enumString, forKey: .enumString)
+ try container.encode(enumStringRequired, forKey: .enumStringRequired)
+ try container.encodeIfPresent(enumInteger, forKey: .enumInteger)
+ try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
+ try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/File.swift
index f0d615b591..d0cd292f32 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/File.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/File.swift
@@ -16,5 +16,17 @@ internal struct File: Codable, Hashable {
internal init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case sourceURI
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
index bfa1e9e6c0..0a3428c9e7 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
@@ -16,5 +16,19 @@ internal struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case file
+ case files
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(file, forKey: .file)
+ try container.encodeIfPresent(files, forKey: .files)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
index 1f5b70fc6c..2e54ec687f 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
@@ -38,5 +38,41 @@ internal struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case integer
+ case int32
+ case int64
+ case number
+ case float
+ case double
+ case string
+ case byte
+ case binary
+ case date
+ case dateTime
+ case uuid
+ case password
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(integer, forKey: .integer)
+ try container.encodeIfPresent(int32, forKey: .int32)
+ try container.encodeIfPresent(int64, forKey: .int64)
+ try container.encode(number, forKey: .number)
+ try container.encodeIfPresent(float, forKey: .float)
+ try container.encodeIfPresent(double, forKey: .double)
+ try container.encodeIfPresent(string, forKey: .string)
+ try container.encode(byte, forKey: .byte)
+ try container.encodeIfPresent(binary, forKey: .binary)
+ try container.encode(date, forKey: .date)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encode(password, forKey: .password)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
index 7346dd89f4..567aa61a6f 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
@@ -16,5 +16,19 @@ internal struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case foo
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(foo, forKey: .foo)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/List.swift
index 37298aa93a..f111d9e2b1 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/List.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/List.swift
@@ -14,9 +14,17 @@ internal struct List: Codable, Hashable {
internal init(_123list: String? = nil) {
self._123list = _123list
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_123list, forKey: ._123list)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
index 959c1b6132..2a1d385b7f 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
@@ -24,7 +24,6 @@ internal struct MapTest: Codable, Hashable {
self.directMap = directMap
self.indirectMap = indirectMap
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case mapMapOfString = "map_map_of_string"
case mapOfEnumString = "map_of_enum_string"
@@ -32,4 +31,16 @@ internal struct MapTest: Codable, Hashable {
case indirectMap = "indirect_map"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapMapOfString, forKey: .mapMapOfString)
+ try container.encodeIfPresent(mapOfEnumString, forKey: .mapOfEnumString)
+ try container.encodeIfPresent(directMap, forKey: .directMap)
+ try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
index 725d0ff947..3f6ba87c48 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
@@ -18,5 +18,21 @@ internal struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case uuid
+ case dateTime
+ case map
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(map, forKey: .map)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
index e0353da8f2..09c3210f9b 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
@@ -17,10 +17,19 @@ internal struct Model200Response: Codable, Hashable {
self.name = name
self._class = _class
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case name
case _class = "class"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(name, forKey: .name)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
index af6cb19d7d..f9b2cc51be 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
@@ -21,7 +21,6 @@ internal struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@@ -29,4 +28,16 @@ internal struct Name: Codable, Hashable {
case _123number = "123Number"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(name, forKey: .name)
+ try container.encodeIfPresent(snakeCase, forKey: .snakeCase)
+ try container.encodeIfPresent(property, forKey: .property)
+ try container.encodeIfPresent(_123number, forKey: ._123number)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
index 37c1139603..1b95c7a570 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
@@ -14,9 +14,17 @@ internal struct NumberOnly: Codable, Hashable {
internal init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justNumber, forKey: .justNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
index 0c886ae0fc..3daabf5885 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
@@ -30,5 +30,27 @@ internal struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case petId
+ case quantity
+ case shipDate
+ case status
+ case complete
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
index b11cacc9d9..8c9e97c320 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
@@ -18,11 +18,21 @@ internal struct OuterComposite: Codable, Hashable {
self.myString = myString
self.myBoolean = myBoolean
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case myNumber = "my_number"
case myString = "my_string"
case myBoolean = "my_boolean"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(myNumber, forKey: .myNumber)
+ try container.encodeIfPresent(myString, forKey: .myString)
+ try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
index c388433da7..379a695e57 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
@@ -30,5 +30,27 @@ internal struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case category
+ case name
+ case photoUrls
+ case tags
+ case status
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
index cc134ec6af..606a083e18 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
@@ -16,5 +16,19 @@ internal struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case baz
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(baz, forKey: .baz)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
index 998123e37e..53ab287d60 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
@@ -15,9 +15,17 @@ internal struct Return: Codable, Hashable {
internal init(_return: Int? = nil) {
self._return = _return
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case _return = "return"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_return, forKey: ._return)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
index c29097c092..7d773a5440 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
@@ -14,9 +14,17 @@ internal struct SpecialModelName: Codable, Hashable {
internal init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
index 6d5719e439..e11b2681cb 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
@@ -9,6 +9,8 @@ import Foundation
internal struct StringBooleanMap: Codable, Hashable {
+ internal enum CodingKeys: CodingKey, CaseIterable {
+ }
internal var additionalProperties: [String: Bool] = [:]
internal subscript(key: String) -> Bool? {
@@ -27,10 +29,9 @@ internal struct StringBooleanMap: Codable, Hashable {
// Encodable protocol methods
internal func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
- try container.encodeMap(additionalProperties)
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
}
// Decodable protocol methods
@@ -42,4 +43,5 @@ internal struct StringBooleanMap: Codable, Hashable {
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
index 8b4501e67a..ac2d648e04 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
@@ -16,5 +16,19 @@ internal struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
index 52500e04b4..66c98a5fcd 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
@@ -22,7 +22,6 @@ internal struct TypeHolderDefault: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ internal struct TypeHolderDefault: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
index a1408b0bd1..2f91bbc634 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
@@ -22,7 +22,6 @@ internal struct TypeHolderExample: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
internal enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ internal struct TypeHolderExample: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/User.swift
index afbd9f1234..b39c749f92 100644
--- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/User.swift
+++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/User.swift
@@ -29,5 +29,31 @@ internal struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
+ internal enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case username
+ case firstName
+ case lastName
+ case email
+ case password
+ case phone
+ case userStatus
+ }
+
+ // Encodable protocol methods
+
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
index 620f778bcc..328276bc7a 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
@@ -16,10 +16,19 @@ import Foundation
self.mapString = mapString
self.mapMapString = mapMapString
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapMapString = "map_map_string"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapString, forKey: .mapString)
+ try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
index 528d7f886c..6d64cbfd15 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
@@ -16,10 +16,19 @@ import Foundation
self._className = _className
self.color = color
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _className = "className"
case color
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(_className, forKey: ._className)
+ try container.encodeIfPresent(color, forKey: .color)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
index 38334c3901..b0b5971f6e 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
@@ -23,5 +23,21 @@ import Foundation
self.type = type
self.message = message
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
index 8ef73e96f0..89c695cd14 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ import Foundation
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
index dd95bb5be0..819e1bd2eb 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ import Foundation
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
index 7b93023aa3..a4ce9ef38a 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
@@ -18,11 +18,21 @@ import Foundation
self.arrayArrayOfInteger = arrayArrayOfInteger
self.arrayArrayOfModel = arrayArrayOfModel
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayOfString = "array_of_string"
case arrayArrayOfInteger = "array_array_of_integer"
case arrayArrayOfModel = "array_array_of_model"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayOfString, forKey: .arrayOfString)
+ try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
+ try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
index 2b42d0b458..0c0e2cb803 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
@@ -25,7 +25,6 @@ import Foundation
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@@ -35,4 +34,18 @@ import Foundation
case ATT_NAME
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(smallCamel, forKey: .smallCamel)
+ try container.encodeIfPresent(capitalCamel, forKey: .capitalCamel)
+ try container.encodeIfPresent(smallSnake, forKey: .smallSnake)
+ try container.encodeIfPresent(capitalSnake, forKey: .capitalSnake)
+ try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
+ try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
index 5542ffa7de..c49009bc89 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
@@ -23,11 +23,21 @@ import Foundation
self.color = color
self.declawed = declawed
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _className = "className"
case color
case declawed
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(_className, forKey: ._className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
index 6a4b10e996..5ec8b58e54 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
@@ -19,5 +19,17 @@ import Foundation
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
index 0e034abbf7..886ce95e2d 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
@@ -15,16 +15,25 @@ import Foundation
return _id as NSNumber?
}
}
- public var name: String = "default-name"
+ public var name: String? = "default-name"
- public init(_id: Int64? = nil, name: String = "default-name") {
+ public init(_id: Int64? = nil, name: String? = "default-name") {
self._id = _id
self.name = name
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _id = "id"
case name
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_id, forKey: ._id)
+ try container.encode(name, forKey: .name)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
index 648f3a6bfb..9adbcf24ad 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
@@ -15,5 +15,17 @@ import Foundation
public init(_class: String? = nil) {
self._class = _class
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case _class
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
index 4c1efdd414..7956f737fb 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
@@ -14,5 +14,17 @@ import Foundation
public init(client: String? = nil) {
self.client = client
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case client
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(client, forKey: .client)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
index be6118ef42..773ea8ad28 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
@@ -18,11 +18,21 @@ import Foundation
self.color = color
self.breed = breed
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _className = "className"
case color
case breed
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(_className, forKey: ._className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
index 41c6300708..7097a89097 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
@@ -14,5 +14,17 @@ import Foundation
public init(breed: String? = nil) {
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
index 6e8c9d0f9a..8a93813f84 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
@@ -24,10 +24,19 @@ import Foundation
self.justSymbol = justSymbol
self.arrayEnum = arrayEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justSymbol = "just_symbol"
case arrayEnum = "array_enum"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
+ try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
index dd3e83306c..262ff77d50 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
@@ -40,7 +40,6 @@ import Foundation
self.enumNumber = enumNumber
self.outerEnum = outerEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case enumString = "enum_string"
case enumStringRequired = "enum_string_required"
@@ -49,4 +48,17 @@ import Foundation
case outerEnum
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(enumString, forKey: .enumString)
+ try container.encode(enumStringRequired, forKey: .enumStringRequired)
+ try container.encodeIfPresent(enumInteger, forKey: .enumInteger)
+ try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
+ try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/File.swift
index 5124dd3b08..b2e54a8e9f 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/File.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/File.swift
@@ -16,5 +16,17 @@ import Foundation
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case sourceURI
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
index be5963357f..a98bdb63d5 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
@@ -16,5 +16,19 @@ import Foundation
self.file = file
self.files = files
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case file
+ case files
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(file, forKey: .file)
+ try container.encodeIfPresent(files, forKey: .files)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
index 84f419103a..f94b67e555 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
@@ -63,5 +63,41 @@ import Foundation
self.uuid = uuid
self.password = password
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case integer
+ case int32
+ case int64
+ case number
+ case float
+ case double
+ case string
+ case byte
+ case binary
+ case date
+ case dateTime
+ case uuid
+ case password
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(integer, forKey: .integer)
+ try container.encodeIfPresent(int32, forKey: .int32)
+ try container.encodeIfPresent(int64, forKey: .int64)
+ try container.encode(number, forKey: .number)
+ try container.encodeIfPresent(float, forKey: .float)
+ try container.encodeIfPresent(double, forKey: .double)
+ try container.encodeIfPresent(string, forKey: .string)
+ try container.encode(byte, forKey: .byte)
+ try container.encodeIfPresent(binary, forKey: .binary)
+ try container.encode(date, forKey: .date)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encode(password, forKey: .password)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
index 7ca91927af..58809b2b65 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
@@ -16,5 +16,19 @@ import Foundation
self.bar = bar
self.foo = foo
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case foo
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(foo, forKey: .foo)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/List.swift
index 7a977c19c7..15809e01ef 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/List.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/List.swift
@@ -14,9 +14,17 @@ import Foundation
public init(_123list: String? = nil) {
self._123list = _123list
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_123list, forKey: ._123list)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
index ba407e3ea2..60b999005e 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
@@ -24,7 +24,6 @@ import Foundation
self.directMap = directMap
self.indirectMap = indirectMap
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapMapOfString = "map_map_of_string"
case mapOfEnumString = "map_of_enum_string"
@@ -32,4 +31,16 @@ import Foundation
case indirectMap = "indirect_map"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapMapOfString, forKey: .mapMapOfString)
+ try container.encodeIfPresent(mapOfEnumString, forKey: .mapOfEnumString)
+ try container.encodeIfPresent(directMap, forKey: .directMap)
+ try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
index bd503cb36f..22f4d5b195 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
@@ -18,5 +18,21 @@ import Foundation
self.dateTime = dateTime
self.map = map
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case uuid
+ case dateTime
+ case map
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(map, forKey: .map)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
index 89c612262d..9e3a6ed648 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
@@ -22,10 +22,19 @@ import Foundation
self.name = name
self._class = _class
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case _class = "class"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(name, forKey: .name)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
index 15b0507a47..4a8e8afc85 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
@@ -31,7 +31,6 @@ import Foundation
self.property = property
self._123number = _123number
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@@ -39,4 +38,16 @@ import Foundation
case _123number = "123Number"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(name, forKey: .name)
+ try container.encodeIfPresent(snakeCase, forKey: .snakeCase)
+ try container.encodeIfPresent(property, forKey: .property)
+ try container.encodeIfPresent(_123number, forKey: ._123number)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
index 40fa7365d0..efb6d07c54 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
@@ -14,9 +14,17 @@ import Foundation
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justNumber, forKey: .justNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
index 728a81434a..e681ffaf68 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
@@ -50,7 +50,6 @@ import Foundation
self.status = status
self.complete = complete
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _id = "id"
case petId
@@ -60,4 +59,18 @@ import Foundation
case complete
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_id, forKey: ._id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
index 9238070c2c..e899975923 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
@@ -23,11 +23,21 @@ import Foundation
self.myString = myString
self.myBoolean = myBoolean
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case myNumber = "my_number"
case myString = "my_string"
case myBoolean = "my_boolean"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(myNumber, forKey: .myNumber)
+ try container.encodeIfPresent(myString, forKey: .myString)
+ try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
index e17ada14c4..d8b058e41a 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
@@ -35,7 +35,6 @@ import Foundation
self.tags = tags
self.status = status
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _id = "id"
case category
@@ -45,4 +44,18 @@ import Foundation
case status
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_id, forKey: ._id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
index c16846f4ac..996cfa7125 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
@@ -16,5 +16,19 @@ import Foundation
self.bar = bar
self.baz = baz
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case baz
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(baz, forKey: .baz)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
index e589a9c200..15aecfe6ad 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
@@ -20,9 +20,17 @@ import Foundation
public init(_return: Int? = nil) {
self._return = _return
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _return = "return"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_return, forKey: ._return)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
index 41b2bf459e..38aa865c49 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
@@ -19,9 +19,17 @@ import Foundation
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
index ffe9730a6f..c430e0a7d2 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
@@ -9,6 +9,8 @@ import Foundation
@objc public class StringBooleanMap: NSObject, Codable {
+ public enum CodingKeys: CodingKey, CaseIterable {
+ }
public var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@@ -27,10 +29,9 @@ import Foundation
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
- try container.encodeMap(additionalProperties)
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
}
// Decodable protocol methods
@@ -42,4 +43,5 @@ import Foundation
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
index fc02765d30..097c4ec889 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
@@ -21,10 +21,19 @@ import Foundation
self._id = _id
self.name = name
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _id = "id"
case name
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_id, forKey: ._id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
index 5900ded6aa..3bc091cc04 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
@@ -22,7 +22,6 @@ import Foundation
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ import Foundation
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
index 40e3a41c34..4a95e73837 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
@@ -22,7 +22,6 @@ import Foundation
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ import Foundation
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/User.swift
index 5b98315079..b20a716f73 100644
--- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/User.swift
+++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/User.swift
@@ -39,7 +39,6 @@ import Foundation
self.phone = phone
self.userStatus = userStatus
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _id = "id"
case username
@@ -51,4 +50,20 @@ import Foundation
case userStatus
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_id, forKey: ._id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
index 733b7bc515..84c1dad9ec 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
@@ -16,10 +16,19 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
self.mapString = mapString
self.mapMapString = mapMapString
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapMapString = "map_map_string"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapString, forKey: .mapString)
+ try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
index e57c8b4717..8111125240 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
@@ -16,5 +16,19 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
index 630992f623..beec80ae58 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
@@ -18,5 +18,21 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
index 4710793fc9..5ed956b922 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
index a41968d9b1..86f71f1534 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
index f442ea7254..e692ebd280 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
@@ -18,11 +18,21 @@ public struct ArrayTest: Codable, Hashable {
self.arrayArrayOfInteger = arrayArrayOfInteger
self.arrayArrayOfModel = arrayArrayOfModel
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayOfString = "array_of_string"
case arrayArrayOfInteger = "array_array_of_integer"
case arrayArrayOfModel = "array_array_of_model"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayOfString, forKey: .arrayOfString)
+ try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
+ try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
index 44b50bbe00..692a3b212f 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
@@ -25,7 +25,6 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@@ -35,4 +34,18 @@ public struct Capitalization: Codable, Hashable {
case ATT_NAME
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(smallCamel, forKey: .smallCamel)
+ try container.encodeIfPresent(capitalCamel, forKey: .capitalCamel)
+ try container.encodeIfPresent(smallSnake, forKey: .smallSnake)
+ try container.encodeIfPresent(capitalSnake, forKey: .capitalSnake)
+ try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
+ try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
index c6bf4460da..73335b4d39 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
@@ -18,5 +18,21 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
index f9484f9bc8..c17cf0d206 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
@@ -14,5 +14,17 @@ public struct CatAllOf: Codable, Hashable {
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
index 6a19bb02d0..dfd5504a65 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
@@ -10,11 +10,25 @@ import Foundation
public struct Category: Codable, Hashable {
public var id: Int64?
- public var name: String = "default-name"
+ public var name: String? = "default-name"
- public init(id: Int64? = nil, name: String = "default-name") {
+ public init(id: Int64? = nil, name: String? = "default-name") {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encode(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
index 5c8e888283..9b5340899a 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
@@ -15,5 +15,17 @@ public struct ClassModel: Codable, Hashable {
public init(_class: String? = nil) {
self._class = _class
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case _class
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
index 1464b047c0..f0e62d05b1 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
@@ -14,5 +14,17 @@ public struct Client: Codable, Hashable {
public init(client: String? = nil) {
self.client = client
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case client
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(client, forKey: .client)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
index 5aed7834d5..137b9a5254 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
@@ -18,5 +18,21 @@ public struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
index 716776261d..4f7070a4f6 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
@@ -14,5 +14,17 @@ public struct DogAllOf: Codable, Hashable {
public init(breed: String? = nil) {
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
index aa13aa59f8..eb761dca90 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
@@ -24,10 +24,19 @@ public struct EnumArrays: Codable, Hashable {
self.justSymbol = justSymbol
self.arrayEnum = arrayEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justSymbol = "just_symbol"
case arrayEnum = "array_enum"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
+ try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
index 8b62febdc9..45236c7926 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
@@ -40,7 +40,6 @@ public struct EnumTest: Codable, Hashable {
self.enumNumber = enumNumber
self.outerEnum = outerEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case enumString = "enum_string"
case enumStringRequired = "enum_string_required"
@@ -49,4 +48,17 @@ public struct EnumTest: Codable, Hashable {
case outerEnum
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(enumString, forKey: .enumString)
+ try container.encode(enumStringRequired, forKey: .enumStringRequired)
+ try container.encodeIfPresent(enumInteger, forKey: .enumInteger)
+ try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
+ try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
index aa14d76239..15dbd0c03f 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
@@ -16,5 +16,17 @@ public struct File: Codable, Hashable {
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case sourceURI
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
index 8598770977..52b3f620cd 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
@@ -16,5 +16,19 @@ public struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case file
+ case files
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(file, forKey: .file)
+ try container.encodeIfPresent(files, forKey: .files)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
index f09cb471b3..232b8c4929 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
@@ -38,5 +38,41 @@ public struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case integer
+ case int32
+ case int64
+ case number
+ case float
+ case double
+ case string
+ case byte
+ case binary
+ case date
+ case dateTime
+ case uuid
+ case password
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(integer, forKey: .integer)
+ try container.encodeIfPresent(int32, forKey: .int32)
+ try container.encodeIfPresent(int64, forKey: .int64)
+ try container.encode(number, forKey: .number)
+ try container.encodeIfPresent(float, forKey: .float)
+ try container.encodeIfPresent(double, forKey: .double)
+ try container.encodeIfPresent(string, forKey: .string)
+ try container.encode(byte, forKey: .byte)
+ try container.encodeIfPresent(binary, forKey: .binary)
+ try container.encode(date, forKey: .date)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encode(password, forKey: .password)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
index 03d35274a4..0097907e9b 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
@@ -16,5 +16,19 @@ public struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case foo
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(foo, forKey: .foo)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
index f8f08e4c6c..48704fd138 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
@@ -14,9 +14,17 @@ public struct List: Codable, Hashable {
public init(_123list: String? = nil) {
self._123list = _123list
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_123list, forKey: ._123list)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
index bd4e7b97e8..96af40355d 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
@@ -24,7 +24,6 @@ public struct MapTest: Codable, Hashable {
self.directMap = directMap
self.indirectMap = indirectMap
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapMapOfString = "map_map_of_string"
case mapOfEnumString = "map_of_enum_string"
@@ -32,4 +31,16 @@ public struct MapTest: Codable, Hashable {
case indirectMap = "indirect_map"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapMapOfString, forKey: .mapMapOfString)
+ try container.encodeIfPresent(mapOfEnumString, forKey: .mapOfEnumString)
+ try container.encodeIfPresent(directMap, forKey: .directMap)
+ try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
index 80c1781a2b..1f3a7ca820 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
@@ -18,5 +18,21 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case uuid
+ case dateTime
+ case map
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(map, forKey: .map)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
index d36d4e2735..f6a5836117 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
@@ -17,10 +17,19 @@ public struct Model200Response: Codable, Hashable {
self.name = name
self._class = _class
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case _class = "class"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(name, forKey: .name)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
index 49cc575441..57336422c8 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
@@ -21,7 +21,6 @@ public struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@@ -29,4 +28,16 @@ public struct Name: Codable, Hashable {
case _123number = "123Number"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(name, forKey: .name)
+ try container.encodeIfPresent(snakeCase, forKey: .snakeCase)
+ try container.encodeIfPresent(property, forKey: .property)
+ try container.encodeIfPresent(_123number, forKey: ._123number)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
index 6b024294e2..861a307e19 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
@@ -14,9 +14,17 @@ public struct NumberOnly: Codable, Hashable {
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justNumber, forKey: .justNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
index 8ef7cb79e2..1d2c313581 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
@@ -30,5 +30,27 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case petId
+ case quantity
+ case shipDate
+ case status
+ case complete
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
index 9865764ff9..6935641c36 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
@@ -18,11 +18,21 @@ public struct OuterComposite: Codable, Hashable {
self.myString = myString
self.myBoolean = myBoolean
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case myNumber = "my_number"
case myString = "my_string"
case myBoolean = "my_boolean"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(myNumber, forKey: .myNumber)
+ try container.encodeIfPresent(myString, forKey: .myString)
+ try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
index 1bc823d3e9..fa5b125ff1 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
@@ -30,5 +30,27 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case category
+ case name
+ case photoUrls
+ case tags
+ case status
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
index 03b5b0dbf0..2ff56cc156 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
@@ -16,5 +16,19 @@ public struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case baz
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(baz, forKey: .baz)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
index 5f539f4618..219b49420a 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
@@ -15,9 +15,17 @@ public struct Return: Codable, Hashable {
public init(_return: Int? = nil) {
self._return = _return
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _return = "return"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_return, forKey: ._return)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
index cb82d2ae3a..562ba86f60 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
@@ -14,9 +14,17 @@ public struct SpecialModelName: Codable, Hashable {
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
index 77ab81f5f3..a6903b84ce 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
@@ -9,6 +9,8 @@ import Foundation
public struct StringBooleanMap: Codable, Hashable {
+ public enum CodingKeys: CodingKey, CaseIterable {
+ }
public var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@@ -27,10 +29,9 @@ public struct StringBooleanMap: Codable, Hashable {
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
- try container.encodeMap(additionalProperties)
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
}
// Decodable protocol methods
@@ -42,4 +43,5 @@ public struct StringBooleanMap: Codable, Hashable {
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
index 8b8e24fc39..bda5be3493 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
@@ -16,5 +16,19 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
index f1920ef377..e789620391 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
@@ -22,7 +22,6 @@ public struct TypeHolderDefault: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderDefault: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
index 1a23c1b486..2952b67016 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
@@ -22,7 +22,6 @@ public struct TypeHolderExample: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderExample: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
index f3b4f6bb95..a1aa36bcfb 100644
--- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
+++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
@@ -29,5 +29,31 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case username
+ case firstName
+ case lastName
+ case email
+ case password
+ case phone
+ case userStatus
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
index 4c5e1a53bd..8367f675bf 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
@@ -16,10 +16,19 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
self.mapString = mapString
self.mapMapString = mapMapString
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapMapString = "map_map_string"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapString, forKey: .mapString)
+ try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
index 48229f750c..60f6bf71e5 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
@@ -16,5 +16,19 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
index 93b598e8d6..5e675ecb92 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
@@ -18,5 +18,21 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
index 6225dd84be..ec4e5c4c54 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
index 698c3adf98..1f93674c1f 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
index 578d061785..4bb7cb9e4f 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
@@ -18,11 +18,21 @@ public struct ArrayTest: Codable, Hashable {
self.arrayArrayOfInteger = arrayArrayOfInteger
self.arrayArrayOfModel = arrayArrayOfModel
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayOfString = "array_of_string"
case arrayArrayOfInteger = "array_array_of_integer"
case arrayArrayOfModel = "array_array_of_model"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayOfString, forKey: .arrayOfString)
+ try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
+ try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
index 6b4d8425c4..be6f54eea7 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
@@ -25,7 +25,6 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@@ -35,4 +34,18 @@ public struct Capitalization: Codable, Hashable {
case ATT_NAME
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(smallCamel, forKey: .smallCamel)
+ try container.encodeIfPresent(capitalCamel, forKey: .capitalCamel)
+ try container.encodeIfPresent(smallSnake, forKey: .smallSnake)
+ try container.encodeIfPresent(capitalSnake, forKey: .capitalSnake)
+ try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
+ try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
index 731f11bf6f..7e7da73d10 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
@@ -18,5 +18,21 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
index 34cf645193..f55fcf0da7 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
@@ -14,5 +14,17 @@ public struct CatAllOf: Codable, Hashable {
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
index 4089925077..45cacce8d4 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
@@ -10,11 +10,25 @@ import Foundation
public struct Category: Codable, Hashable {
public private(set) var id: Int64?
- public private(set) var name: String = "default-name"
+ public private(set) var name: String? = "default-name"
- public init(id: Int64? = nil, name: String = "default-name") {
+ public init(id: Int64? = nil, name: String? = "default-name") {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encode(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
index a76f014c03..fa76c380e3 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
@@ -15,5 +15,17 @@ public struct ClassModel: Codable, Hashable {
public init(_class: String? = nil) {
self._class = _class
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case _class
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
index f1dd2364bf..35b4e19f17 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
@@ -14,5 +14,17 @@ public struct Client: Codable, Hashable {
public init(client: String? = nil) {
self.client = client
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case client
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(client, forKey: .client)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
index ef91e2a47a..d9c600c8e6 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
@@ -18,5 +18,21 @@ public struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
index 0eab838904..b1263d421a 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
@@ -14,5 +14,17 @@ public struct DogAllOf: Codable, Hashable {
public init(breed: String? = nil) {
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
index e3befc6dfe..cb05936809 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
@@ -24,10 +24,19 @@ public struct EnumArrays: Codable, Hashable {
self.justSymbol = justSymbol
self.arrayEnum = arrayEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justSymbol = "just_symbol"
case arrayEnum = "array_enum"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
+ try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
index d9dd6a64b0..f55d8b5d16 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
@@ -40,7 +40,6 @@ public struct EnumTest: Codable, Hashable {
self.enumNumber = enumNumber
self.outerEnum = outerEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case enumString = "enum_string"
case enumStringRequired = "enum_string_required"
@@ -49,4 +48,17 @@ public struct EnumTest: Codable, Hashable {
case outerEnum
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(enumString, forKey: .enumString)
+ try container.encode(enumStringRequired, forKey: .enumStringRequired)
+ try container.encodeIfPresent(enumInteger, forKey: .enumInteger)
+ try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
+ try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift
index 1fbc65d2db..d359954b3e 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift
@@ -16,5 +16,17 @@ public struct File: Codable, Hashable {
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case sourceURI
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
index aa4cf089d0..de3a5d1453 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
@@ -16,5 +16,19 @@ public struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case file
+ case files
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(file, forKey: .file)
+ try container.encodeIfPresent(files, forKey: .files)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
index fce99baa8f..75ad7d9f6f 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
@@ -38,5 +38,41 @@ public struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case integer
+ case int32
+ case int64
+ case number
+ case float
+ case double
+ case string
+ case byte
+ case binary
+ case date
+ case dateTime
+ case uuid
+ case password
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(integer, forKey: .integer)
+ try container.encodeIfPresent(int32, forKey: .int32)
+ try container.encodeIfPresent(int64, forKey: .int64)
+ try container.encode(number, forKey: .number)
+ try container.encodeIfPresent(float, forKey: .float)
+ try container.encodeIfPresent(double, forKey: .double)
+ try container.encodeIfPresent(string, forKey: .string)
+ try container.encode(byte, forKey: .byte)
+ try container.encodeIfPresent(binary, forKey: .binary)
+ try container.encode(date, forKey: .date)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encode(password, forKey: .password)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
index 0b2b2f5887..2f8f0d5dc7 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
@@ -16,5 +16,19 @@ public struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case foo
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(foo, forKey: .foo)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift
index 0247967c50..45862d74d1 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift
@@ -14,9 +14,17 @@ public struct List: Codable, Hashable {
public init(_123list: String? = nil) {
self._123list = _123list
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_123list, forKey: ._123list)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
index 15bdb8c852..864373dd97 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
@@ -24,7 +24,6 @@ public struct MapTest: Codable, Hashable {
self.directMap = directMap
self.indirectMap = indirectMap
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapMapOfString = "map_map_of_string"
case mapOfEnumString = "map_of_enum_string"
@@ -32,4 +31,16 @@ public struct MapTest: Codable, Hashable {
case indirectMap = "indirect_map"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapMapOfString, forKey: .mapMapOfString)
+ try container.encodeIfPresent(mapOfEnumString, forKey: .mapOfEnumString)
+ try container.encodeIfPresent(directMap, forKey: .directMap)
+ try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
index 1253cecf1b..02e9ce327c 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
@@ -18,5 +18,21 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case uuid
+ case dateTime
+ case map
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(map, forKey: .map)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
index 1c8c0b4b11..3b394c3131 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
@@ -17,10 +17,19 @@ public struct Model200Response: Codable, Hashable {
self.name = name
self._class = _class
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case _class = "class"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(name, forKey: .name)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
index 59fc35b499..d3b7e502a7 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
@@ -21,7 +21,6 @@ public struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@@ -29,4 +28,16 @@ public struct Name: Codable, Hashable {
case _123number = "123Number"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(name, forKey: .name)
+ try container.encodeIfPresent(snakeCase, forKey: .snakeCase)
+ try container.encodeIfPresent(property, forKey: .property)
+ try container.encodeIfPresent(_123number, forKey: ._123number)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
index 71634b2482..9f9b5ec652 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
@@ -14,9 +14,17 @@ public struct NumberOnly: Codable, Hashable {
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justNumber, forKey: .justNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
index 25ac0c3fab..a8101288f7 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
@@ -30,5 +30,27 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case petId
+ case quantity
+ case shipDate
+ case status
+ case complete
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
index 36a489ac41..b5e93fcc9b 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
@@ -18,11 +18,21 @@ public struct OuterComposite: Codable, Hashable {
self.myString = myString
self.myBoolean = myBoolean
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case myNumber = "my_number"
case myString = "my_string"
case myBoolean = "my_boolean"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(myNumber, forKey: .myNumber)
+ try container.encodeIfPresent(myString, forKey: .myString)
+ try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
index 561d185269..3b3d0ce7bc 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
@@ -30,5 +30,27 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case category
+ case name
+ case photoUrls
+ case tags
+ case status
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
index ae8af88b8a..e9d58c1ef0 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
@@ -16,5 +16,19 @@ public struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case baz
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(baz, forKey: .baz)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
index 1bb551dcae..80390f5296 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
@@ -15,9 +15,17 @@ public struct Return: Codable, Hashable {
public init(_return: Int? = nil) {
self._return = _return
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _return = "return"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_return, forKey: ._return)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
index 78dc5a7db1..bff078ca59 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
@@ -14,9 +14,17 @@ public struct SpecialModelName: Codable, Hashable {
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
index 0a6fc2976e..37dfe65f87 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
@@ -9,6 +9,8 @@ import Foundation
public struct StringBooleanMap: Codable, Hashable {
+ public enum CodingKeys: CodingKey, CaseIterable {
+ }
public private(set) var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@@ -27,10 +29,9 @@ public struct StringBooleanMap: Codable, Hashable {
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
- try container.encodeMap(additionalProperties)
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
}
// Decodable protocol methods
@@ -42,4 +43,5 @@ public struct StringBooleanMap: Codable, Hashable {
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
index c35e07111a..bf501c049b 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
@@ -16,5 +16,19 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
index 0ad0e39ab4..7557899f5a 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
@@ -22,7 +22,6 @@ public struct TypeHolderDefault: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderDefault: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
index a26b555da7..8a4b7b1404 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
@@ -22,7 +22,6 @@ public struct TypeHolderExample: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderExample: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift
index 4c33cf58d3..f6bea2aee0 100644
--- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift
+++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift
@@ -29,5 +29,31 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case username
+ case firstName
+ case lastName
+ case email
+ case password
+ case phone
+ case userStatus
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
index 733b7bc515..84c1dad9ec 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
@@ -16,10 +16,19 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
self.mapString = mapString
self.mapMapString = mapMapString
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapMapString = "map_map_string"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapString, forKey: .mapString)
+ try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
index e57c8b4717..8111125240 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
@@ -16,5 +16,19 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
index 630992f623..beec80ae58 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
@@ -18,5 +18,21 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
index 4710793fc9..5ed956b922 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
index a41968d9b1..86f71f1534 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
index f442ea7254..e692ebd280 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
@@ -18,11 +18,21 @@ public struct ArrayTest: Codable, Hashable {
self.arrayArrayOfInteger = arrayArrayOfInteger
self.arrayArrayOfModel = arrayArrayOfModel
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayOfString = "array_of_string"
case arrayArrayOfInteger = "array_array_of_integer"
case arrayArrayOfModel = "array_array_of_model"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayOfString, forKey: .arrayOfString)
+ try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
+ try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
index 44b50bbe00..692a3b212f 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
@@ -25,7 +25,6 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@@ -35,4 +34,18 @@ public struct Capitalization: Codable, Hashable {
case ATT_NAME
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(smallCamel, forKey: .smallCamel)
+ try container.encodeIfPresent(capitalCamel, forKey: .capitalCamel)
+ try container.encodeIfPresent(smallSnake, forKey: .smallSnake)
+ try container.encodeIfPresent(capitalSnake, forKey: .capitalSnake)
+ try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
+ try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
index c6bf4460da..73335b4d39 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
@@ -18,5 +18,21 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
index f9484f9bc8..c17cf0d206 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
@@ -14,5 +14,17 @@ public struct CatAllOf: Codable, Hashable {
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
index 6a19bb02d0..dfd5504a65 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
@@ -10,11 +10,25 @@ import Foundation
public struct Category: Codable, Hashable {
public var id: Int64?
- public var name: String = "default-name"
+ public var name: String? = "default-name"
- public init(id: Int64? = nil, name: String = "default-name") {
+ public init(id: Int64? = nil, name: String? = "default-name") {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encode(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
index 5c8e888283..9b5340899a 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
@@ -15,5 +15,17 @@ public struct ClassModel: Codable, Hashable {
public init(_class: String? = nil) {
self._class = _class
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case _class
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
index 1464b047c0..f0e62d05b1 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
@@ -14,5 +14,17 @@ public struct Client: Codable, Hashable {
public init(client: String? = nil) {
self.client = client
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case client
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(client, forKey: .client)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
index 5aed7834d5..137b9a5254 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
@@ -18,5 +18,21 @@ public struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
index 716776261d..4f7070a4f6 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
@@ -14,5 +14,17 @@ public struct DogAllOf: Codable, Hashable {
public init(breed: String? = nil) {
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
index aa13aa59f8..eb761dca90 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
@@ -24,10 +24,19 @@ public struct EnumArrays: Codable, Hashable {
self.justSymbol = justSymbol
self.arrayEnum = arrayEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justSymbol = "just_symbol"
case arrayEnum = "array_enum"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
+ try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
index 8b62febdc9..45236c7926 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
@@ -40,7 +40,6 @@ public struct EnumTest: Codable, Hashable {
self.enumNumber = enumNumber
self.outerEnum = outerEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case enumString = "enum_string"
case enumStringRequired = "enum_string_required"
@@ -49,4 +48,17 @@ public struct EnumTest: Codable, Hashable {
case outerEnum
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(enumString, forKey: .enumString)
+ try container.encode(enumStringRequired, forKey: .enumStringRequired)
+ try container.encodeIfPresent(enumInteger, forKey: .enumInteger)
+ try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
+ try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
index aa14d76239..15dbd0c03f 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
@@ -16,5 +16,17 @@ public struct File: Codable, Hashable {
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case sourceURI
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
index 8598770977..52b3f620cd 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
@@ -16,5 +16,19 @@ public struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case file
+ case files
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(file, forKey: .file)
+ try container.encodeIfPresent(files, forKey: .files)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
index f09cb471b3..232b8c4929 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
@@ -38,5 +38,41 @@ public struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case integer
+ case int32
+ case int64
+ case number
+ case float
+ case double
+ case string
+ case byte
+ case binary
+ case date
+ case dateTime
+ case uuid
+ case password
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(integer, forKey: .integer)
+ try container.encodeIfPresent(int32, forKey: .int32)
+ try container.encodeIfPresent(int64, forKey: .int64)
+ try container.encode(number, forKey: .number)
+ try container.encodeIfPresent(float, forKey: .float)
+ try container.encodeIfPresent(double, forKey: .double)
+ try container.encodeIfPresent(string, forKey: .string)
+ try container.encode(byte, forKey: .byte)
+ try container.encodeIfPresent(binary, forKey: .binary)
+ try container.encode(date, forKey: .date)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encode(password, forKey: .password)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
index 03d35274a4..0097907e9b 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
@@ -16,5 +16,19 @@ public struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case foo
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(foo, forKey: .foo)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
index f8f08e4c6c..48704fd138 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
@@ -14,9 +14,17 @@ public struct List: Codable, Hashable {
public init(_123list: String? = nil) {
self._123list = _123list
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_123list, forKey: ._123list)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
index bd4e7b97e8..96af40355d 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
@@ -24,7 +24,6 @@ public struct MapTest: Codable, Hashable {
self.directMap = directMap
self.indirectMap = indirectMap
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapMapOfString = "map_map_of_string"
case mapOfEnumString = "map_of_enum_string"
@@ -32,4 +31,16 @@ public struct MapTest: Codable, Hashable {
case indirectMap = "indirect_map"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapMapOfString, forKey: .mapMapOfString)
+ try container.encodeIfPresent(mapOfEnumString, forKey: .mapOfEnumString)
+ try container.encodeIfPresent(directMap, forKey: .directMap)
+ try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
index 80c1781a2b..1f3a7ca820 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
@@ -18,5 +18,21 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case uuid
+ case dateTime
+ case map
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(map, forKey: .map)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
index d36d4e2735..f6a5836117 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
@@ -17,10 +17,19 @@ public struct Model200Response: Codable, Hashable {
self.name = name
self._class = _class
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case _class = "class"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(name, forKey: .name)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
index 49cc575441..57336422c8 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
@@ -21,7 +21,6 @@ public struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@@ -29,4 +28,16 @@ public struct Name: Codable, Hashable {
case _123number = "123Number"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(name, forKey: .name)
+ try container.encodeIfPresent(snakeCase, forKey: .snakeCase)
+ try container.encodeIfPresent(property, forKey: .property)
+ try container.encodeIfPresent(_123number, forKey: ._123number)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
index 6b024294e2..861a307e19 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
@@ -14,9 +14,17 @@ public struct NumberOnly: Codable, Hashable {
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justNumber, forKey: .justNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
index 8ef7cb79e2..1d2c313581 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
@@ -30,5 +30,27 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case petId
+ case quantity
+ case shipDate
+ case status
+ case complete
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
index 9865764ff9..6935641c36 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
@@ -18,11 +18,21 @@ public struct OuterComposite: Codable, Hashable {
self.myString = myString
self.myBoolean = myBoolean
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case myNumber = "my_number"
case myString = "my_string"
case myBoolean = "my_boolean"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(myNumber, forKey: .myNumber)
+ try container.encodeIfPresent(myString, forKey: .myString)
+ try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
index 1bc823d3e9..fa5b125ff1 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
@@ -30,5 +30,27 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case category
+ case name
+ case photoUrls
+ case tags
+ case status
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
index 03b5b0dbf0..2ff56cc156 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
@@ -16,5 +16,19 @@ public struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case baz
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(baz, forKey: .baz)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
index 5f539f4618..219b49420a 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
@@ -15,9 +15,17 @@ public struct Return: Codable, Hashable {
public init(_return: Int? = nil) {
self._return = _return
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _return = "return"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_return, forKey: ._return)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
index cb82d2ae3a..562ba86f60 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
@@ -14,9 +14,17 @@ public struct SpecialModelName: Codable, Hashable {
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
index 77ab81f5f3..a6903b84ce 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
@@ -9,6 +9,8 @@ import Foundation
public struct StringBooleanMap: Codable, Hashable {
+ public enum CodingKeys: CodingKey, CaseIterable {
+ }
public var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@@ -27,10 +29,9 @@ public struct StringBooleanMap: Codable, Hashable {
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
- try container.encodeMap(additionalProperties)
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
}
// Decodable protocol methods
@@ -42,4 +43,5 @@ public struct StringBooleanMap: Codable, Hashable {
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
index 8b8e24fc39..bda5be3493 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
@@ -16,5 +16,19 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
index f1920ef377..e789620391 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
@@ -22,7 +22,6 @@ public struct TypeHolderDefault: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderDefault: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
index 1a23c1b486..2952b67016 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
@@ -22,7 +22,6 @@ public struct TypeHolderExample: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderExample: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
index f3b4f6bb95..a1aa36bcfb 100644
--- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
+++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
@@ -29,5 +29,31 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case username
+ case firstName
+ case lastName
+ case email
+ case password
+ case phone
+ case userStatus
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
index 733b7bc515..84c1dad9ec 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift
@@ -16,10 +16,19 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
self.mapString = mapString
self.mapMapString = mapMapString
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapMapString = "map_map_string"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapString, forKey: .mapString)
+ try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
index e57c8b4717..8111125240 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift
@@ -16,5 +16,19 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
index 630992f623..beec80ae58 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift
@@ -18,5 +18,21 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
index 4710793fc9..5ed956b922 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
index a41968d9b1..86f71f1534 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift
@@ -14,9 +14,17 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
index f442ea7254..e692ebd280 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift
@@ -18,11 +18,21 @@ public struct ArrayTest: Codable, Hashable {
self.arrayArrayOfInteger = arrayArrayOfInteger
self.arrayArrayOfModel = arrayArrayOfModel
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayOfString = "array_of_string"
case arrayArrayOfInteger = "array_array_of_integer"
case arrayArrayOfModel = "array_array_of_model"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayOfString, forKey: .arrayOfString)
+ try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
+ try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
index 44b50bbe00..692a3b212f 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift
@@ -25,7 +25,6 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@@ -35,4 +34,18 @@ public struct Capitalization: Codable, Hashable {
case ATT_NAME
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(smallCamel, forKey: .smallCamel)
+ try container.encodeIfPresent(capitalCamel, forKey: .capitalCamel)
+ try container.encodeIfPresent(smallSnake, forKey: .smallSnake)
+ try container.encodeIfPresent(capitalSnake, forKey: .capitalSnake)
+ try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
+ try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
index c6bf4460da..73335b4d39 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift
@@ -18,5 +18,21 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
index f9484f9bc8..c17cf0d206 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift
@@ -14,5 +14,17 @@ public struct CatAllOf: Codable, Hashable {
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
index 6a19bb02d0..dfd5504a65 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift
@@ -10,11 +10,25 @@ import Foundation
public struct Category: Codable, Hashable {
public var id: Int64?
- public var name: String = "default-name"
+ public var name: String? = "default-name"
- public init(id: Int64? = nil, name: String = "default-name") {
+ public init(id: Int64? = nil, name: String? = "default-name") {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encode(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
index ea377bceb2..e8dbe76c46 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift
@@ -15,9 +15,17 @@ public struct ClassModel: Codable, Hashable {
public init(`class`: String? = nil) {
self.`class` = `class`
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case `class` = "_class"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(`class`, forKey: .`class`)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
index 1464b047c0..f0e62d05b1 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift
@@ -14,5 +14,17 @@ public struct Client: Codable, Hashable {
public init(client: String? = nil) {
self.client = client
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case client
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(client, forKey: .client)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
index 5aed7834d5..137b9a5254 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift
@@ -18,5 +18,21 @@ public struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
index 716776261d..4f7070a4f6 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift
@@ -14,5 +14,17 @@ public struct DogAllOf: Codable, Hashable {
public init(breed: String? = nil) {
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
index aa13aa59f8..eb761dca90 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift
@@ -24,10 +24,19 @@ public struct EnumArrays: Codable, Hashable {
self.justSymbol = justSymbol
self.arrayEnum = arrayEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justSymbol = "just_symbol"
case arrayEnum = "array_enum"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
+ try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
index 8b62febdc9..45236c7926 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift
@@ -40,7 +40,6 @@ public struct EnumTest: Codable, Hashable {
self.enumNumber = enumNumber
self.outerEnum = outerEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case enumString = "enum_string"
case enumStringRequired = "enum_string_required"
@@ -49,4 +48,17 @@ public struct EnumTest: Codable, Hashable {
case outerEnum
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(enumString, forKey: .enumString)
+ try container.encode(enumStringRequired, forKey: .enumStringRequired)
+ try container.encodeIfPresent(enumInteger, forKey: .enumInteger)
+ try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
+ try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
index aa14d76239..15dbd0c03f 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift
@@ -16,5 +16,17 @@ public struct File: Codable, Hashable {
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case sourceURI
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
index 8598770977..52b3f620cd 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift
@@ -16,5 +16,19 @@ public struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case file
+ case files
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(file, forKey: .file)
+ try container.encodeIfPresent(files, forKey: .files)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
index f09cb471b3..232b8c4929 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift
@@ -38,5 +38,41 @@ public struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case integer
+ case int32
+ case int64
+ case number
+ case float
+ case double
+ case string
+ case byte
+ case binary
+ case date
+ case dateTime
+ case uuid
+ case password
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(integer, forKey: .integer)
+ try container.encodeIfPresent(int32, forKey: .int32)
+ try container.encodeIfPresent(int64, forKey: .int64)
+ try container.encode(number, forKey: .number)
+ try container.encodeIfPresent(float, forKey: .float)
+ try container.encodeIfPresent(double, forKey: .double)
+ try container.encodeIfPresent(string, forKey: .string)
+ try container.encode(byte, forKey: .byte)
+ try container.encodeIfPresent(binary, forKey: .binary)
+ try container.encode(date, forKey: .date)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encode(password, forKey: .password)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
index 03d35274a4..0097907e9b 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift
@@ -16,5 +16,19 @@ public struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case foo
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(foo, forKey: .foo)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
index f8f08e4c6c..48704fd138 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift
@@ -14,9 +14,17 @@ public struct List: Codable, Hashable {
public init(_123list: String? = nil) {
self._123list = _123list
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_123list, forKey: ._123list)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
index bd4e7b97e8..96af40355d 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift
@@ -24,7 +24,6 @@ public struct MapTest: Codable, Hashable {
self.directMap = directMap
self.indirectMap = indirectMap
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapMapOfString = "map_map_of_string"
case mapOfEnumString = "map_of_enum_string"
@@ -32,4 +31,16 @@ public struct MapTest: Codable, Hashable {
case indirectMap = "indirect_map"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapMapOfString, forKey: .mapMapOfString)
+ try container.encodeIfPresent(mapOfEnumString, forKey: .mapOfEnumString)
+ try container.encodeIfPresent(directMap, forKey: .directMap)
+ try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
index 80c1781a2b..1f3a7ca820 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
@@ -18,5 +18,21 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case uuid
+ case dateTime
+ case map
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(map, forKey: .map)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
index 31c1c142e5..0c9bc3d03f 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift
@@ -17,10 +17,19 @@ public struct Model200Response: Codable, Hashable {
self.name = name
self.`class` = `class`
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case `class` = "class"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(name, forKey: .name)
+ try container.encodeIfPresent(`class`, forKey: .`class`)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
index 49cc575441..57336422c8 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift
@@ -21,7 +21,6 @@ public struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@@ -29,4 +28,16 @@ public struct Name: Codable, Hashable {
case _123number = "123Number"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(name, forKey: .name)
+ try container.encodeIfPresent(snakeCase, forKey: .snakeCase)
+ try container.encodeIfPresent(property, forKey: .property)
+ try container.encodeIfPresent(_123number, forKey: ._123number)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
index 6b024294e2..861a307e19 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift
@@ -14,9 +14,17 @@ public struct NumberOnly: Codable, Hashable {
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justNumber, forKey: .justNumber)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
index 8ef7cb79e2..1d2c313581 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift
@@ -30,5 +30,27 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case petId
+ case quantity
+ case shipDate
+ case status
+ case complete
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
index 9865764ff9..6935641c36 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift
@@ -18,11 +18,21 @@ public struct OuterComposite: Codable, Hashable {
self.myString = myString
self.myBoolean = myBoolean
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case myNumber = "my_number"
case myString = "my_string"
case myBoolean = "my_boolean"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(myNumber, forKey: .myNumber)
+ try container.encodeIfPresent(myString, forKey: .myString)
+ try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
index 1bc823d3e9..fa5b125ff1 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift
@@ -30,5 +30,27 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case category
+ case name
+ case photoUrls
+ case tags
+ case status
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
index 03b5b0dbf0..2ff56cc156 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift
@@ -16,5 +16,19 @@ public struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case baz
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(baz, forKey: .baz)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
index 40591ab2fb..37e34d010d 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift
@@ -15,9 +15,17 @@ public struct Return: Codable, Hashable {
public init(`return`: Int? = nil) {
self.`return` = `return`
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case `return` = "return"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(`return`, forKey: .`return`)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
index cb82d2ae3a..562ba86f60 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift
@@ -14,9 +14,17 @@ public struct SpecialModelName: Codable, Hashable {
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
index 77ab81f5f3..a6903b84ce 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift
@@ -9,6 +9,8 @@ import Foundation
public struct StringBooleanMap: Codable, Hashable {
+ public enum CodingKeys: CodingKey, CaseIterable {
+ }
public var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@@ -27,10 +29,9 @@ public struct StringBooleanMap: Codable, Hashable {
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
- try container.encodeMap(additionalProperties)
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
}
// Decodable protocol methods
@@ -42,4 +43,5 @@ public struct StringBooleanMap: Codable, Hashable {
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
index 8b8e24fc39..bda5be3493 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift
@@ -16,5 +16,19 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
index f1920ef377..e789620391 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift
@@ -22,7 +22,6 @@ public struct TypeHolderDefault: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderDefault: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
index 1a23c1b486..2952b67016 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift
@@ -22,7 +22,6 @@ public struct TypeHolderExample: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,17 @@ public struct TypeHolderExample: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
}
diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
index f3b4f6bb95..a1aa36bcfb 100644
--- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
+++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift
@@ -29,5 +29,31 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case username
+ case firstName
+ case lastName
+ case email
+ case password
+ case phone
+ case userStatus
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/AdditionalPropertiesClass.swift
index 733b7bc515..0b63e40afe 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/AdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/AdditionalPropertiesClass.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct AdditionalPropertiesClass: Codable, Hashable {
+public final class AdditionalPropertiesClass: Codable, Hashable {
public var mapString: [String: String]?
public var mapMapString: [String: [String: String]]?
@@ -16,10 +16,31 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
self.mapString = mapString
self.mapMapString = mapMapString
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapMapString = "map_map_string"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapString, forKey: .mapString)
+ try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
+ }
+
+
+
+ public static func == (lhs: AdditionalPropertiesClass, rhs: AdditionalPropertiesClass) -> Bool {
+ lhs.mapString == rhs.mapString &&
+ lhs.mapMapString == rhs.mapMapString
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(mapString?.hashValue)
+ hasher.combine(mapMapString?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Animal.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Animal.swift
index e57c8b4717..827350f5f1 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Animal.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Animal.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Animal: Codable, Hashable {
+public final class Animal: Codable, Hashable {
public var className: String
public var color: String? = "red"
@@ -16,5 +16,31 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ }
+
+
+
+ public static func == (lhs: Animal, rhs: Animal) -> Bool {
+ lhs.className == rhs.className &&
+ lhs.color == rhs.color
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(className.hashValue)
+ hasher.combine(color?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ApiResponse.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ApiResponse.swift
index 630992f623..a7560b2b05 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ApiResponse.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct ApiResponse: Codable, Hashable {
+public final class ApiResponse: Codable, Hashable {
public var code: Int?
public var type: String?
@@ -18,5 +18,35 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
+
+ public static func == (lhs: ApiResponse, rhs: ApiResponse) -> Bool {
+ lhs.code == rhs.code &&
+ lhs.type == rhs.type &&
+ lhs.message == rhs.message
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(code?.hashValue)
+ hasher.combine(type?.hashValue)
+ hasher.combine(message?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayOfArrayOfNumberOnly.swift
index 4710793fc9..6b56791485 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayOfArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayOfArrayOfNumberOnly.swift
@@ -7,16 +7,34 @@
import Foundation
-public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
+public final class ArrayOfArrayOfNumberOnly: Codable, Hashable {
public var arrayArrayNumber: [[Double]]?
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
+ }
+
+
+
+ public static func == (lhs: ArrayOfArrayOfNumberOnly, rhs: ArrayOfArrayOfNumberOnly) -> Bool {
+ lhs.arrayArrayNumber == rhs.arrayArrayNumber
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(arrayArrayNumber?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayOfNumberOnly.swift
index a41968d9b1..5558ef1345 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayOfNumberOnly.swift
@@ -7,16 +7,34 @@
import Foundation
-public struct ArrayOfNumberOnly: Codable, Hashable {
+public final class ArrayOfNumberOnly: Codable, Hashable {
public var arrayNumber: [Double]?
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
+ }
+
+
+
+ public static func == (lhs: ArrayOfNumberOnly, rhs: ArrayOfNumberOnly) -> Bool {
+ lhs.arrayNumber == rhs.arrayNumber
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(arrayNumber?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayTest.swift
index f442ea7254..0d5750eec8 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayTest.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ArrayTest.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct ArrayTest: Codable, Hashable {
+public final class ArrayTest: Codable, Hashable {
public var arrayOfString: [String]?
public var arrayArrayOfInteger: [[Int64]]?
@@ -18,11 +18,35 @@ public struct ArrayTest: Codable, Hashable {
self.arrayArrayOfInteger = arrayArrayOfInteger
self.arrayArrayOfModel = arrayArrayOfModel
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayOfString = "array_of_string"
case arrayArrayOfInteger = "array_array_of_integer"
case arrayArrayOfModel = "array_array_of_model"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayOfString, forKey: .arrayOfString)
+ try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
+ try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
+ }
+
+
+
+ public static func == (lhs: ArrayTest, rhs: ArrayTest) -> Bool {
+ lhs.arrayOfString == rhs.arrayOfString &&
+ lhs.arrayArrayOfInteger == rhs.arrayArrayOfInteger &&
+ lhs.arrayArrayOfModel == rhs.arrayArrayOfModel
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(arrayOfString?.hashValue)
+ hasher.combine(arrayArrayOfInteger?.hashValue)
+ hasher.combine(arrayArrayOfModel?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Capitalization.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Capitalization.swift
index 44b50bbe00..03573fea5e 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Capitalization.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Capitalization.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Capitalization: Codable, Hashable {
+public final class Capitalization: Codable, Hashable {
public var smallCamel: String?
public var capitalCamel: String?
@@ -25,7 +25,6 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@@ -35,4 +34,38 @@ public struct Capitalization: Codable, Hashable {
case ATT_NAME
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(smallCamel, forKey: .smallCamel)
+ try container.encodeIfPresent(capitalCamel, forKey: .capitalCamel)
+ try container.encodeIfPresent(smallSnake, forKey: .smallSnake)
+ try container.encodeIfPresent(capitalSnake, forKey: .capitalSnake)
+ try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
+ try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
+ }
+
+
+
+ public static func == (lhs: Capitalization, rhs: Capitalization) -> Bool {
+ lhs.smallCamel == rhs.smallCamel &&
+ lhs.capitalCamel == rhs.capitalCamel &&
+ lhs.smallSnake == rhs.smallSnake &&
+ lhs.capitalSnake == rhs.capitalSnake &&
+ lhs.sCAETHFlowPoints == rhs.sCAETHFlowPoints &&
+ lhs.ATT_NAME == rhs.ATT_NAME
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(smallCamel?.hashValue)
+ hasher.combine(capitalCamel?.hashValue)
+ hasher.combine(smallSnake?.hashValue)
+ hasher.combine(capitalSnake?.hashValue)
+ hasher.combine(sCAETHFlowPoints?.hashValue)
+ hasher.combine(ATT_NAME?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Cat.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Cat.swift
index c6bf4460da..3c79d5f3f4 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Cat.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Cat.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Cat: Codable, Hashable {
+public final class Cat: Codable, Hashable {
public var className: String
public var color: String? = "red"
@@ -18,5 +18,35 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
+
+ public static func == (lhs: Cat, rhs: Cat) -> Bool {
+ lhs.className == rhs.className &&
+ lhs.color == rhs.color &&
+ lhs.declawed == rhs.declawed
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(className.hashValue)
+ hasher.combine(color?.hashValue)
+ hasher.combine(declawed?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/CatAllOf.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/CatAllOf.swift
index f9484f9bc8..28204818be 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/CatAllOf.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/CatAllOf.swift
@@ -7,12 +7,34 @@
import Foundation
-public struct CatAllOf: Codable, Hashable {
+public final class CatAllOf: Codable, Hashable {
public var declawed: Bool?
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
+
+ public static func == (lhs: CatAllOf, rhs: CatAllOf) -> Bool {
+ lhs.declawed == rhs.declawed
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(declawed?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Category.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Category.swift
index 6a19bb02d0..1465d8ec5d 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Category.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Category.swift
@@ -7,14 +7,40 @@
import Foundation
-public struct Category: Codable, Hashable {
+public final class Category: Codable, Hashable {
public var id: Int64?
- public var name: String = "default-name"
+ public var name: String? = "default-name"
- public init(id: Int64? = nil, name: String = "default-name") {
+ public init(id: Int64? = nil, name: String? = "default-name") {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encode(name, forKey: .name)
+ }
+
+
+
+ public static func == (lhs: Category, rhs: Category) -> Bool {
+ lhs.id == rhs.id &&
+ lhs.name == rhs.name
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(id?.hashValue)
+ hasher.combine(name.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Client.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Client.swift
index 1464b047c0..77db41343a 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Client.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Client.swift
@@ -7,12 +7,34 @@
import Foundation
-public struct Client: Codable, Hashable {
+public final class Client: Codable, Hashable {
public var client: String?
public init(client: String? = nil) {
self.client = client
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case client
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(client, forKey: .client)
+ }
+
+
+
+ public static func == (lhs: Client, rhs: Client) -> Bool {
+ lhs.client == rhs.client
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(client?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Dog.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Dog.swift
index 5aed7834d5..5d91d3877a 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Dog.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Dog.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Dog: Codable, Hashable {
+public final class Dog: Codable, Hashable {
public var className: String
public var color: String? = "red"
@@ -18,5 +18,35 @@ public struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
+
+ public static func == (lhs: Dog, rhs: Dog) -> Bool {
+ lhs.className == rhs.className &&
+ lhs.color == rhs.color &&
+ lhs.breed == rhs.breed
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(className.hashValue)
+ hasher.combine(color?.hashValue)
+ hasher.combine(breed?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/DogAllOf.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/DogAllOf.swift
index 716776261d..ab765467b9 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/DogAllOf.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/DogAllOf.swift
@@ -7,12 +7,34 @@
import Foundation
-public struct DogAllOf: Codable, Hashable {
+public final class DogAllOf: Codable, Hashable {
public var breed: String?
public init(breed: String? = nil) {
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
+
+ public static func == (lhs: DogAllOf, rhs: DogAllOf) -> Bool {
+ lhs.breed == rhs.breed
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(breed?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/EnumArrays.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/EnumArrays.swift
index aa13aa59f8..0b16bfde75 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/EnumArrays.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/EnumArrays.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct EnumArrays: Codable, Hashable {
+public final class EnumArrays: Codable, Hashable {
public enum JustSymbol: String, Codable, CaseIterable {
case greaterThanOrEqualTo = ">="
@@ -24,10 +24,31 @@ public struct EnumArrays: Codable, Hashable {
self.justSymbol = justSymbol
self.arrayEnum = arrayEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justSymbol = "just_symbol"
case arrayEnum = "array_enum"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
+ try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
+ }
+
+
+
+ public static func == (lhs: EnumArrays, rhs: EnumArrays) -> Bool {
+ lhs.justSymbol == rhs.justSymbol &&
+ lhs.arrayEnum == rhs.arrayEnum
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(justSymbol?.hashValue)
+ hasher.combine(arrayEnum?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/EnumTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/EnumTest.swift
index 8b62febdc9..08ced90f75 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/EnumTest.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/EnumTest.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct EnumTest: Codable, Hashable {
+public final class EnumTest: Codable, Hashable {
public enum EnumString: String, Codable, CaseIterable {
case upper = "UPPER"
@@ -40,7 +40,6 @@ public struct EnumTest: Codable, Hashable {
self.enumNumber = enumNumber
self.outerEnum = outerEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case enumString = "enum_string"
case enumStringRequired = "enum_string_required"
@@ -49,4 +48,35 @@ public struct EnumTest: Codable, Hashable {
case outerEnum
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(enumString, forKey: .enumString)
+ try container.encode(enumStringRequired, forKey: .enumStringRequired)
+ try container.encodeIfPresent(enumInteger, forKey: .enumInteger)
+ try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
+ try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
+ }
+
+
+
+ public static func == (lhs: EnumTest, rhs: EnumTest) -> Bool {
+ lhs.enumString == rhs.enumString &&
+ lhs.enumStringRequired == rhs.enumStringRequired &&
+ lhs.enumInteger == rhs.enumInteger &&
+ lhs.enumNumber == rhs.enumNumber &&
+ lhs.outerEnum == rhs.outerEnum
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(enumString?.hashValue)
+ hasher.combine(enumStringRequired.hashValue)
+ hasher.combine(enumInteger?.hashValue)
+ hasher.combine(enumNumber?.hashValue)
+ hasher.combine(outerEnum?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/File.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/File.swift
index aa14d76239..ed7fe6a2ca 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/File.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/File.swift
@@ -8,7 +8,7 @@
import Foundation
/** Must be named `File` for test. */
-public struct File: Codable, Hashable {
+public final class File: Codable, Hashable {
/** Test capitalization */
public var sourceURI: String?
@@ -16,5 +16,27 @@ public struct File: Codable, Hashable {
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case sourceURI
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
+ }
+
+
+
+ public static func == (lhs: File, rhs: File) -> Bool {
+ lhs.sourceURI == rhs.sourceURI
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(sourceURI?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/FileSchemaTestClass.swift
index 8598770977..4e78f79df4 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/FileSchemaTestClass.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/FileSchemaTestClass.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct FileSchemaTestClass: Codable, Hashable {
+public final class FileSchemaTestClass: Codable, Hashable {
public var file: File?
public var files: [File]?
@@ -16,5 +16,31 @@ public struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case file
+ case files
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(file, forKey: .file)
+ try container.encodeIfPresent(files, forKey: .files)
+ }
+
+
+
+ public static func == (lhs: FileSchemaTestClass, rhs: FileSchemaTestClass) -> Bool {
+ lhs.file == rhs.file &&
+ lhs.files == rhs.files
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(file?.hashValue)
+ hasher.combine(files?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/FormatTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/FormatTest.swift
index f09cb471b3..7b2ac4c533 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/FormatTest.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/FormatTest.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct FormatTest: Codable, Hashable {
+public final class FormatTest: Codable, Hashable {
public var integer: Int?
public var int32: Int?
@@ -38,5 +38,75 @@ public struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case integer
+ case int32
+ case int64
+ case number
+ case float
+ case double
+ case string
+ case byte
+ case binary
+ case date
+ case dateTime
+ case uuid
+ case password
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(integer, forKey: .integer)
+ try container.encodeIfPresent(int32, forKey: .int32)
+ try container.encodeIfPresent(int64, forKey: .int64)
+ try container.encode(number, forKey: .number)
+ try container.encodeIfPresent(float, forKey: .float)
+ try container.encodeIfPresent(double, forKey: .double)
+ try container.encodeIfPresent(string, forKey: .string)
+ try container.encode(byte, forKey: .byte)
+ try container.encodeIfPresent(binary, forKey: .binary)
+ try container.encode(date, forKey: .date)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encode(password, forKey: .password)
+ }
+
+
+
+ public static func == (lhs: FormatTest, rhs: FormatTest) -> Bool {
+ lhs.integer == rhs.integer &&
+ lhs.int32 == rhs.int32 &&
+ lhs.int64 == rhs.int64 &&
+ lhs.number == rhs.number &&
+ lhs.float == rhs.float &&
+ lhs.double == rhs.double &&
+ lhs.string == rhs.string &&
+ lhs.byte == rhs.byte &&
+ lhs.binary == rhs.binary &&
+ lhs.date == rhs.date &&
+ lhs.dateTime == rhs.dateTime &&
+ lhs.uuid == rhs.uuid &&
+ lhs.password == rhs.password
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(integer?.hashValue)
+ hasher.combine(int32?.hashValue)
+ hasher.combine(int64?.hashValue)
+ hasher.combine(number.hashValue)
+ hasher.combine(float?.hashValue)
+ hasher.combine(double?.hashValue)
+ hasher.combine(string?.hashValue)
+ hasher.combine(byte.hashValue)
+ hasher.combine(binary?.hashValue)
+ hasher.combine(date.hashValue)
+ hasher.combine(dateTime?.hashValue)
+ hasher.combine(uuid?.hashValue)
+ hasher.combine(password.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/HasOnlyReadOnly.swift
index 03d35274a4..61f9d19e68 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/HasOnlyReadOnly.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/HasOnlyReadOnly.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct HasOnlyReadOnly: Codable, Hashable {
+public final class HasOnlyReadOnly: Codable, Hashable {
public var bar: String?
public var foo: String?
@@ -16,5 +16,31 @@ public struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case foo
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(foo, forKey: .foo)
+ }
+
+
+
+ public static func == (lhs: HasOnlyReadOnly, rhs: HasOnlyReadOnly) -> Bool {
+ lhs.bar == rhs.bar &&
+ lhs.foo == rhs.foo
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(bar?.hashValue)
+ hasher.combine(foo?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/List.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/List.swift
index f8f08e4c6c..1fb3cdaa0d 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/List.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/List.swift
@@ -7,16 +7,34 @@
import Foundation
-public struct List: Codable, Hashable {
+public final class List: Codable, Hashable {
public var _123list: String?
public init(_123list: String? = nil) {
self._123list = _123list
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_123list, forKey: ._123list)
+ }
+
+
+
+ public static func == (lhs: List, rhs: List) -> Bool {
+ lhs._123list == rhs._123list
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(_123list?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/MapTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/MapTest.swift
index bd4e7b97e8..8c0b82b8e7 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/MapTest.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/MapTest.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct MapTest: Codable, Hashable {
+public final class MapTest: Codable, Hashable {
public enum MapOfEnumString: String, Codable, CaseIterable {
case upper = "UPPER"
@@ -24,7 +24,6 @@ public struct MapTest: Codable, Hashable {
self.directMap = directMap
self.indirectMap = indirectMap
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapMapOfString = "map_map_of_string"
case mapOfEnumString = "map_of_enum_string"
@@ -32,4 +31,32 @@ public struct MapTest: Codable, Hashable {
case indirectMap = "indirect_map"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapMapOfString, forKey: .mapMapOfString)
+ try container.encodeIfPresent(mapOfEnumString, forKey: .mapOfEnumString)
+ try container.encodeIfPresent(directMap, forKey: .directMap)
+ try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
+ }
+
+
+
+ public static func == (lhs: MapTest, rhs: MapTest) -> Bool {
+ lhs.mapMapOfString == rhs.mapMapOfString &&
+ lhs.mapOfEnumString == rhs.mapOfEnumString &&
+ lhs.directMap == rhs.directMap &&
+ lhs.indirectMap == rhs.indirectMap
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(mapMapOfString?.hashValue)
+ hasher.combine(mapOfEnumString?.hashValue)
+ hasher.combine(directMap?.hashValue)
+ hasher.combine(indirectMap?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
index 80c1781a2b..bfd55c9b14 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
+public final class MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
public var uuid: UUID?
public var dateTime: Date?
@@ -18,5 +18,35 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case uuid
+ case dateTime
+ case map
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(map, forKey: .map)
+ }
+
+
+
+ public static func == (lhs: MixedPropertiesAndAdditionalPropertiesClass, rhs: MixedPropertiesAndAdditionalPropertiesClass) -> Bool {
+ lhs.uuid == rhs.uuid &&
+ lhs.dateTime == rhs.dateTime &&
+ lhs.map == rhs.map
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(uuid?.hashValue)
+ hasher.combine(dateTime?.hashValue)
+ hasher.combine(map?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Name.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Name.swift
index 49cc575441..564c2d3ba3 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Name.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Name.swift
@@ -8,7 +8,7 @@
import Foundation
/** Model for testing model name same as property name */
-public struct Name: Codable, Hashable {
+public final class Name: Codable, Hashable {
public var name: Int
public var snakeCase: Int?
@@ -21,7 +21,6 @@ public struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@@ -29,4 +28,32 @@ public struct Name: Codable, Hashable {
case _123number = "123Number"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(name, forKey: .name)
+ try container.encodeIfPresent(snakeCase, forKey: .snakeCase)
+ try container.encodeIfPresent(property, forKey: .property)
+ try container.encodeIfPresent(_123number, forKey: ._123number)
+ }
+
+
+
+ public static func == (lhs: Name, rhs: Name) -> Bool {
+ lhs.name == rhs.name &&
+ lhs.snakeCase == rhs.snakeCase &&
+ lhs.property == rhs.property &&
+ lhs._123number == rhs._123number
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(name.hashValue)
+ hasher.combine(snakeCase?.hashValue)
+ hasher.combine(property?.hashValue)
+ hasher.combine(_123number?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/NumberOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/NumberOnly.swift
index 6b024294e2..0281c93875 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/NumberOnly.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/NumberOnly.swift
@@ -7,16 +7,34 @@
import Foundation
-public struct NumberOnly: Codable, Hashable {
+public final class NumberOnly: Codable, Hashable {
public var justNumber: Double?
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justNumber, forKey: .justNumber)
+ }
+
+
+
+ public static func == (lhs: NumberOnly, rhs: NumberOnly) -> Bool {
+ lhs.justNumber == rhs.justNumber
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(justNumber?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Order.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Order.swift
index 8ef7cb79e2..e92045617a 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Order.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Order.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Order: Codable, Hashable {
+public final class Order: Codable, Hashable {
public enum Status: String, Codable, CaseIterable {
case placed = "placed"
@@ -30,5 +30,47 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case petId
+ case quantity
+ case shipDate
+ case status
+ case complete
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
+
+ public static func == (lhs: Order, rhs: Order) -> Bool {
+ lhs.id == rhs.id &&
+ lhs.petId == rhs.petId &&
+ lhs.quantity == rhs.quantity &&
+ lhs.shipDate == rhs.shipDate &&
+ lhs.status == rhs.status &&
+ lhs.complete == rhs.complete
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(id?.hashValue)
+ hasher.combine(petId?.hashValue)
+ hasher.combine(quantity?.hashValue)
+ hasher.combine(shipDate?.hashValue)
+ hasher.combine(status?.hashValue)
+ hasher.combine(complete?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/OuterComposite.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/OuterComposite.swift
index 9865764ff9..7ce51441ed 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/OuterComposite.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/OuterComposite.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct OuterComposite: Codable, Hashable {
+public final class OuterComposite: Codable, Hashable {
public var myNumber: Double?
public var myString: String?
@@ -18,11 +18,35 @@ public struct OuterComposite: Codable, Hashable {
self.myString = myString
self.myBoolean = myBoolean
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case myNumber = "my_number"
case myString = "my_string"
case myBoolean = "my_boolean"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(myNumber, forKey: .myNumber)
+ try container.encodeIfPresent(myString, forKey: .myString)
+ try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
+ }
+
+
+
+ public static func == (lhs: OuterComposite, rhs: OuterComposite) -> Bool {
+ lhs.myNumber == rhs.myNumber &&
+ lhs.myString == rhs.myString &&
+ lhs.myBoolean == rhs.myBoolean
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(myNumber?.hashValue)
+ hasher.combine(myString?.hashValue)
+ hasher.combine(myBoolean?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Pet.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Pet.swift
index 1bc823d3e9..109d226d62 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Pet.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Pet.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Pet: Codable, Hashable {
+public final class Pet: Codable, Hashable {
public enum Status: String, Codable, CaseIterable {
case available = "available"
@@ -30,5 +30,47 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case category
+ case name
+ case photoUrls
+ case tags
+ case status
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
+
+ public static func == (lhs: Pet, rhs: Pet) -> Bool {
+ lhs.id == rhs.id &&
+ lhs.category == rhs.category &&
+ lhs.name == rhs.name &&
+ lhs.photoUrls == rhs.photoUrls &&
+ lhs.tags == rhs.tags &&
+ lhs.status == rhs.status
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(id?.hashValue)
+ hasher.combine(category?.hashValue)
+ hasher.combine(name.hashValue)
+ hasher.combine(photoUrls.hashValue)
+ hasher.combine(tags?.hashValue)
+ hasher.combine(status?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ReadOnlyFirst.swift
index 03b5b0dbf0..6fff2152c0 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ReadOnlyFirst.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/ReadOnlyFirst.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct ReadOnlyFirst: Codable, Hashable {
+public final class ReadOnlyFirst: Codable, Hashable {
public var bar: String?
public var baz: String?
@@ -16,5 +16,31 @@ public struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case baz
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(baz, forKey: .baz)
+ }
+
+
+
+ public static func == (lhs: ReadOnlyFirst, rhs: ReadOnlyFirst) -> Bool {
+ lhs.bar == rhs.bar &&
+ lhs.baz == rhs.baz
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(bar?.hashValue)
+ hasher.combine(baz?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/SpecialModelName.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/SpecialModelName.swift
index cb82d2ae3a..d9ce42fc5c 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/SpecialModelName.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/SpecialModelName.swift
@@ -7,16 +7,34 @@
import Foundation
-public struct SpecialModelName: Codable, Hashable {
+public final class SpecialModelName: Codable, Hashable {
public var specialPropertyName: Int64?
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
+ }
+
+
+
+ public static func == (lhs: SpecialModelName, rhs: SpecialModelName) -> Bool {
+ lhs.specialPropertyName == rhs.specialPropertyName
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(specialPropertyName?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/StringBooleanMap.swift
index 77ab81f5f3..74605e1f6b 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/StringBooleanMap.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/StringBooleanMap.swift
@@ -7,8 +7,10 @@
import Foundation
-public struct StringBooleanMap: Codable, Hashable {
+public final class StringBooleanMap: Codable, Hashable {
+ public enum CodingKeys: CodingKey, CaseIterable {
+ }
public var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@@ -27,10 +29,9 @@ public struct StringBooleanMap: Codable, Hashable {
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
- try container.encodeMap(additionalProperties)
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
}
// Decodable protocol methods
@@ -42,4 +43,13 @@ public struct StringBooleanMap: Codable, Hashable {
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
+
+ public static func == (lhs: StringBooleanMap, rhs: StringBooleanMap) -> Bool {
+ lhs.additionalProperties == rhs.additionalProperties
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(additionalProperties.hashValue)
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Tag.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Tag.swift
index 8b8e24fc39..46f76ea301 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Tag.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/Tag.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Tag: Codable, Hashable {
+public final class Tag: Codable, Hashable {
public var id: Int64?
public var name: String?
@@ -16,5 +16,31 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
+
+ public static func == (lhs: Tag, rhs: Tag) -> Bool {
+ lhs.id == rhs.id &&
+ lhs.name == rhs.name
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(id?.hashValue)
+ hasher.combine(name?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/TypeHolderDefault.swift
index f1920ef377..83aa5e5641 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/TypeHolderDefault.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/TypeHolderDefault.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct TypeHolderDefault: Codable, Hashable {
+public final class TypeHolderDefault: Codable, Hashable {
public var stringItem: String = "what"
public var numberItem: Double
@@ -22,7 +22,6 @@ public struct TypeHolderDefault: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,35 @@ public struct TypeHolderDefault: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
+ public static func == (lhs: TypeHolderDefault, rhs: TypeHolderDefault) -> Bool {
+ lhs.stringItem == rhs.stringItem &&
+ lhs.numberItem == rhs.numberItem &&
+ lhs.integerItem == rhs.integerItem &&
+ lhs.boolItem == rhs.boolItem &&
+ lhs.arrayItem == rhs.arrayItem
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(stringItem.hashValue)
+ hasher.combine(numberItem.hashValue)
+ hasher.combine(integerItem.hashValue)
+ hasher.combine(boolItem.hashValue)
+ hasher.combine(arrayItem.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/TypeHolderExample.swift
index 1a23c1b486..8403f60354 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/TypeHolderExample.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/TypeHolderExample.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct TypeHolderExample: Codable, Hashable {
+public final class TypeHolderExample: Codable, Hashable {
public var stringItem: String
public var numberItem: Double
@@ -22,7 +22,6 @@ public struct TypeHolderExample: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,35 @@ public struct TypeHolderExample: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
+ public static func == (lhs: TypeHolderExample, rhs: TypeHolderExample) -> Bool {
+ lhs.stringItem == rhs.stringItem &&
+ lhs.numberItem == rhs.numberItem &&
+ lhs.integerItem == rhs.integerItem &&
+ lhs.boolItem == rhs.boolItem &&
+ lhs.arrayItem == rhs.arrayItem
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(stringItem.hashValue)
+ hasher.combine(numberItem.hashValue)
+ hasher.combine(integerItem.hashValue)
+ hasher.combine(boolItem.hashValue)
+ hasher.combine(arrayItem.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/User.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/User.swift
index f3b4f6bb95..94e4cb058a 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/User.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/Models/User.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct User: Codable, Hashable {
+public final class User: Codable, Hashable {
public var id: Int64?
public var username: String?
@@ -29,5 +29,55 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case username
+ case firstName
+ case lastName
+ case email
+ case password
+ case phone
+ case userStatus
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
+
+ public static func == (lhs: User, rhs: User) -> Bool {
+ lhs.id == rhs.id &&
+ lhs.username == rhs.username &&
+ lhs.firstName == rhs.firstName &&
+ lhs.lastName == rhs.lastName &&
+ lhs.email == rhs.email &&
+ lhs.password == rhs.password &&
+ lhs.phone == rhs.phone &&
+ lhs.userStatus == rhs.userStatus
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(id?.hashValue)
+ hasher.combine(username?.hashValue)
+ hasher.combine(firstName?.hashValue)
+ hasher.combine(lastName?.hashValue)
+ hasher.combine(email?.hashValue)
+ hasher.combine(password?.hashValue)
+ hasher.combine(phone?.hashValue)
+ hasher.combine(userStatus?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift
index 733b7bc515..0b63e40afe 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct AdditionalPropertiesClass: Codable, Hashable {
+public final class AdditionalPropertiesClass: Codable, Hashable {
public var mapString: [String: String]?
public var mapMapString: [String: [String: String]]?
@@ -16,10 +16,31 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
self.mapString = mapString
self.mapMapString = mapMapString
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapMapString = "map_map_string"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapString, forKey: .mapString)
+ try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
+ }
+
+
+
+ public static func == (lhs: AdditionalPropertiesClass, rhs: AdditionalPropertiesClass) -> Bool {
+ lhs.mapString == rhs.mapString &&
+ lhs.mapMapString == rhs.mapMapString
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(mapString?.hashValue)
+ hasher.combine(mapMapString?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Animal.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Animal.swift
index e57c8b4717..827350f5f1 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Animal.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Animal.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Animal: Codable, Hashable {
+public final class Animal: Codable, Hashable {
public var className: String
public var color: String? = "red"
@@ -16,5 +16,31 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ }
+
+
+
+ public static func == (lhs: Animal, rhs: Animal) -> Bool {
+ lhs.className == rhs.className &&
+ lhs.color == rhs.color
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(className.hashValue)
+ hasher.combine(color?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ApiResponse.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ApiResponse.swift
index 630992f623..a7560b2b05 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ApiResponse.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ApiResponse.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct ApiResponse: Codable, Hashable {
+public final class ApiResponse: Codable, Hashable {
public var code: Int?
public var type: String?
@@ -18,5 +18,35 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case code
+ case type
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(code, forKey: .code)
+ try container.encodeIfPresent(type, forKey: .type)
+ try container.encodeIfPresent(message, forKey: .message)
+ }
+
+
+
+ public static func == (lhs: ApiResponse, rhs: ApiResponse) -> Bool {
+ lhs.code == rhs.code &&
+ lhs.type == rhs.type &&
+ lhs.message == rhs.message
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(code?.hashValue)
+ hasher.combine(type?.hashValue)
+ hasher.combine(message?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift
index 4710793fc9..6b56791485 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift
@@ -7,16 +7,34 @@
import Foundation
-public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
+public final class ArrayOfArrayOfNumberOnly: Codable, Hashable {
public var arrayArrayNumber: [[Double]]?
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
+ }
+
+
+
+ public static func == (lhs: ArrayOfArrayOfNumberOnly, rhs: ArrayOfArrayOfNumberOnly) -> Bool {
+ lhs.arrayArrayNumber == rhs.arrayArrayNumber
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(arrayArrayNumber?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift
index a41968d9b1..5558ef1345 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift
@@ -7,16 +7,34 @@
import Foundation
-public struct ArrayOfNumberOnly: Codable, Hashable {
+public final class ArrayOfNumberOnly: Codable, Hashable {
public var arrayNumber: [Double]?
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
+ }
+
+
+
+ public static func == (lhs: ArrayOfNumberOnly, rhs: ArrayOfNumberOnly) -> Bool {
+ lhs.arrayNumber == rhs.arrayNumber
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(arrayNumber?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayTest.swift
index f442ea7254..0d5750eec8 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayTest.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayTest.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct ArrayTest: Codable, Hashable {
+public final class ArrayTest: Codable, Hashable {
public var arrayOfString: [String]?
public var arrayArrayOfInteger: [[Int64]]?
@@ -18,11 +18,35 @@ public struct ArrayTest: Codable, Hashable {
self.arrayArrayOfInteger = arrayArrayOfInteger
self.arrayArrayOfModel = arrayArrayOfModel
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayOfString = "array_of_string"
case arrayArrayOfInteger = "array_array_of_integer"
case arrayArrayOfModel = "array_array_of_model"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(arrayOfString, forKey: .arrayOfString)
+ try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
+ try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
+ }
+
+
+
+ public static func == (lhs: ArrayTest, rhs: ArrayTest) -> Bool {
+ lhs.arrayOfString == rhs.arrayOfString &&
+ lhs.arrayArrayOfInteger == rhs.arrayArrayOfInteger &&
+ lhs.arrayArrayOfModel == rhs.arrayArrayOfModel
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(arrayOfString?.hashValue)
+ hasher.combine(arrayArrayOfInteger?.hashValue)
+ hasher.combine(arrayArrayOfModel?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Capitalization.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Capitalization.swift
index 44b50bbe00..03573fea5e 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Capitalization.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Capitalization.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Capitalization: Codable, Hashable {
+public final class Capitalization: Codable, Hashable {
public var smallCamel: String?
public var capitalCamel: String?
@@ -25,7 +25,6 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@@ -35,4 +34,38 @@ public struct Capitalization: Codable, Hashable {
case ATT_NAME
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(smallCamel, forKey: .smallCamel)
+ try container.encodeIfPresent(capitalCamel, forKey: .capitalCamel)
+ try container.encodeIfPresent(smallSnake, forKey: .smallSnake)
+ try container.encodeIfPresent(capitalSnake, forKey: .capitalSnake)
+ try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
+ try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
+ }
+
+
+
+ public static func == (lhs: Capitalization, rhs: Capitalization) -> Bool {
+ lhs.smallCamel == rhs.smallCamel &&
+ lhs.capitalCamel == rhs.capitalCamel &&
+ lhs.smallSnake == rhs.smallSnake &&
+ lhs.capitalSnake == rhs.capitalSnake &&
+ lhs.sCAETHFlowPoints == rhs.sCAETHFlowPoints &&
+ lhs.ATT_NAME == rhs.ATT_NAME
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(smallCamel?.hashValue)
+ hasher.combine(capitalCamel?.hashValue)
+ hasher.combine(smallSnake?.hashValue)
+ hasher.combine(capitalSnake?.hashValue)
+ hasher.combine(sCAETHFlowPoints?.hashValue)
+ hasher.combine(ATT_NAME?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Cat.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Cat.swift
index c6bf4460da..3c79d5f3f4 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Cat.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Cat.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Cat: Codable, Hashable {
+public final class Cat: Codable, Hashable {
public var className: String
public var color: String? = "red"
@@ -18,5 +18,35 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
+
+ public static func == (lhs: Cat, rhs: Cat) -> Bool {
+ lhs.className == rhs.className &&
+ lhs.color == rhs.color &&
+ lhs.declawed == rhs.declawed
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(className.hashValue)
+ hasher.combine(color?.hashValue)
+ hasher.combine(declawed?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/CatAllOf.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/CatAllOf.swift
index f9484f9bc8..28204818be 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/CatAllOf.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/CatAllOf.swift
@@ -7,12 +7,34 @@
import Foundation
-public struct CatAllOf: Codable, Hashable {
+public final class CatAllOf: Codable, Hashable {
public var declawed: Bool?
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case declawed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(declawed, forKey: .declawed)
+ }
+
+
+
+ public static func == (lhs: CatAllOf, rhs: CatAllOf) -> Bool {
+ lhs.declawed == rhs.declawed
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(declawed?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift
index 6a19bb02d0..1465d8ec5d 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift
@@ -7,14 +7,40 @@
import Foundation
-public struct Category: Codable, Hashable {
+public final class Category: Codable, Hashable {
public var id: Int64?
- public var name: String = "default-name"
+ public var name: String? = "default-name"
- public init(id: Int64? = nil, name: String = "default-name") {
+ public init(id: Int64? = nil, name: String? = "default-name") {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encode(name, forKey: .name)
+ }
+
+
+
+ public static func == (lhs: Category, rhs: Category) -> Bool {
+ lhs.id == rhs.id &&
+ lhs.name == rhs.name
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(id?.hashValue)
+ hasher.combine(name.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ClassModel.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ClassModel.swift
index 5c8e888283..92620d368f 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ClassModel.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ClassModel.swift
@@ -8,12 +8,34 @@
import Foundation
/** Model for testing model with \"_class\" property */
-public struct ClassModel: Codable, Hashable {
+public final class ClassModel: Codable, Hashable {
public var _class: String?
public init(_class: String? = nil) {
self._class = _class
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case _class
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
+
+ public static func == (lhs: ClassModel, rhs: ClassModel) -> Bool {
+ lhs._class == rhs._class
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(_class?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Client.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Client.swift
index 1464b047c0..77db41343a 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Client.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Client.swift
@@ -7,12 +7,34 @@
import Foundation
-public struct Client: Codable, Hashable {
+public final class Client: Codable, Hashable {
public var client: String?
public init(client: String? = nil) {
self.client = client
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case client
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(client, forKey: .client)
+ }
+
+
+
+ public static func == (lhs: Client, rhs: Client) -> Bool {
+ lhs.client == rhs.client
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(client?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Dog.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Dog.swift
index 5aed7834d5..5d91d3877a 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Dog.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Dog.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Dog: Codable, Hashable {
+public final class Dog: Codable, Hashable {
public var className: String
public var color: String? = "red"
@@ -18,5 +18,35 @@ public struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case className
+ case color
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(className, forKey: .className)
+ try container.encodeIfPresent(color, forKey: .color)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
+
+ public static func == (lhs: Dog, rhs: Dog) -> Bool {
+ lhs.className == rhs.className &&
+ lhs.color == rhs.color &&
+ lhs.breed == rhs.breed
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(className.hashValue)
+ hasher.combine(color?.hashValue)
+ hasher.combine(breed?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/DogAllOf.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/DogAllOf.swift
index 716776261d..ab765467b9 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/DogAllOf.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/DogAllOf.swift
@@ -7,12 +7,34 @@
import Foundation
-public struct DogAllOf: Codable, Hashable {
+public final class DogAllOf: Codable, Hashable {
public var breed: String?
public init(breed: String? = nil) {
self.breed = breed
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case breed
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(breed, forKey: .breed)
+ }
+
+
+
+ public static func == (lhs: DogAllOf, rhs: DogAllOf) -> Bool {
+ lhs.breed == rhs.breed
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(breed?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/EnumArrays.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/EnumArrays.swift
index aa13aa59f8..0b16bfde75 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/EnumArrays.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/EnumArrays.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct EnumArrays: Codable, Hashable {
+public final class EnumArrays: Codable, Hashable {
public enum JustSymbol: String, Codable, CaseIterable {
case greaterThanOrEqualTo = ">="
@@ -24,10 +24,31 @@ public struct EnumArrays: Codable, Hashable {
self.justSymbol = justSymbol
self.arrayEnum = arrayEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justSymbol = "just_symbol"
case arrayEnum = "array_enum"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
+ try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
+ }
+
+
+
+ public static func == (lhs: EnumArrays, rhs: EnumArrays) -> Bool {
+ lhs.justSymbol == rhs.justSymbol &&
+ lhs.arrayEnum == rhs.arrayEnum
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(justSymbol?.hashValue)
+ hasher.combine(arrayEnum?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/EnumTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/EnumTest.swift
index 8b62febdc9..08ced90f75 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/EnumTest.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/EnumTest.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct EnumTest: Codable, Hashable {
+public final class EnumTest: Codable, Hashable {
public enum EnumString: String, Codable, CaseIterable {
case upper = "UPPER"
@@ -40,7 +40,6 @@ public struct EnumTest: Codable, Hashable {
self.enumNumber = enumNumber
self.outerEnum = outerEnum
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case enumString = "enum_string"
case enumStringRequired = "enum_string_required"
@@ -49,4 +48,35 @@ public struct EnumTest: Codable, Hashable {
case outerEnum
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(enumString, forKey: .enumString)
+ try container.encode(enumStringRequired, forKey: .enumStringRequired)
+ try container.encodeIfPresent(enumInteger, forKey: .enumInteger)
+ try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
+ try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
+ }
+
+
+
+ public static func == (lhs: EnumTest, rhs: EnumTest) -> Bool {
+ lhs.enumString == rhs.enumString &&
+ lhs.enumStringRequired == rhs.enumStringRequired &&
+ lhs.enumInteger == rhs.enumInteger &&
+ lhs.enumNumber == rhs.enumNumber &&
+ lhs.outerEnum == rhs.outerEnum
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(enumString?.hashValue)
+ hasher.combine(enumStringRequired.hashValue)
+ hasher.combine(enumInteger?.hashValue)
+ hasher.combine(enumNumber?.hashValue)
+ hasher.combine(outerEnum?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/File.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/File.swift
index aa14d76239..ed7fe6a2ca 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/File.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/File.swift
@@ -8,7 +8,7 @@
import Foundation
/** Must be named `File` for test. */
-public struct File: Codable, Hashable {
+public final class File: Codable, Hashable {
/** Test capitalization */
public var sourceURI: String?
@@ -16,5 +16,27 @@ public struct File: Codable, Hashable {
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case sourceURI
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
+ }
+
+
+
+ public static func == (lhs: File, rhs: File) -> Bool {
+ lhs.sourceURI == rhs.sourceURI
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(sourceURI?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift
index 8598770977..4e78f79df4 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct FileSchemaTestClass: Codable, Hashable {
+public final class FileSchemaTestClass: Codable, Hashable {
public var file: File?
public var files: [File]?
@@ -16,5 +16,31 @@ public struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case file
+ case files
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(file, forKey: .file)
+ try container.encodeIfPresent(files, forKey: .files)
+ }
+
+
+
+ public static func == (lhs: FileSchemaTestClass, rhs: FileSchemaTestClass) -> Bool {
+ lhs.file == rhs.file &&
+ lhs.files == rhs.files
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(file?.hashValue)
+ hasher.combine(files?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift
index f09cb471b3..7b2ac4c533 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct FormatTest: Codable, Hashable {
+public final class FormatTest: Codable, Hashable {
public var integer: Int?
public var int32: Int?
@@ -38,5 +38,75 @@ public struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case integer
+ case int32
+ case int64
+ case number
+ case float
+ case double
+ case string
+ case byte
+ case binary
+ case date
+ case dateTime
+ case uuid
+ case password
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(integer, forKey: .integer)
+ try container.encodeIfPresent(int32, forKey: .int32)
+ try container.encodeIfPresent(int64, forKey: .int64)
+ try container.encode(number, forKey: .number)
+ try container.encodeIfPresent(float, forKey: .float)
+ try container.encodeIfPresent(double, forKey: .double)
+ try container.encodeIfPresent(string, forKey: .string)
+ try container.encode(byte, forKey: .byte)
+ try container.encodeIfPresent(binary, forKey: .binary)
+ try container.encode(date, forKey: .date)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encode(password, forKey: .password)
+ }
+
+
+
+ public static func == (lhs: FormatTest, rhs: FormatTest) -> Bool {
+ lhs.integer == rhs.integer &&
+ lhs.int32 == rhs.int32 &&
+ lhs.int64 == rhs.int64 &&
+ lhs.number == rhs.number &&
+ lhs.float == rhs.float &&
+ lhs.double == rhs.double &&
+ lhs.string == rhs.string &&
+ lhs.byte == rhs.byte &&
+ lhs.binary == rhs.binary &&
+ lhs.date == rhs.date &&
+ lhs.dateTime == rhs.dateTime &&
+ lhs.uuid == rhs.uuid &&
+ lhs.password == rhs.password
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(integer?.hashValue)
+ hasher.combine(int32?.hashValue)
+ hasher.combine(int64?.hashValue)
+ hasher.combine(number.hashValue)
+ hasher.combine(float?.hashValue)
+ hasher.combine(double?.hashValue)
+ hasher.combine(string?.hashValue)
+ hasher.combine(byte.hashValue)
+ hasher.combine(binary?.hashValue)
+ hasher.combine(date.hashValue)
+ hasher.combine(dateTime?.hashValue)
+ hasher.combine(uuid?.hashValue)
+ hasher.combine(password.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift
index 03d35274a4..61f9d19e68 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct HasOnlyReadOnly: Codable, Hashable {
+public final class HasOnlyReadOnly: Codable, Hashable {
public var bar: String?
public var foo: String?
@@ -16,5 +16,31 @@ public struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case foo
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(foo, forKey: .foo)
+ }
+
+
+
+ public static func == (lhs: HasOnlyReadOnly, rhs: HasOnlyReadOnly) -> Bool {
+ lhs.bar == rhs.bar &&
+ lhs.foo == rhs.foo
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(bar?.hashValue)
+ hasher.combine(foo?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/List.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/List.swift
index f8f08e4c6c..1fb3cdaa0d 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/List.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/List.swift
@@ -7,16 +7,34 @@
import Foundation
-public struct List: Codable, Hashable {
+public final class List: Codable, Hashable {
public var _123list: String?
public init(_123list: String? = nil) {
self._123list = _123list
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_123list, forKey: ._123list)
+ }
+
+
+
+ public static func == (lhs: List, rhs: List) -> Bool {
+ lhs._123list == rhs._123list
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(_123list?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/MapTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/MapTest.swift
index bd4e7b97e8..8c0b82b8e7 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/MapTest.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/MapTest.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct MapTest: Codable, Hashable {
+public final class MapTest: Codable, Hashable {
public enum MapOfEnumString: String, Codable, CaseIterable {
case upper = "UPPER"
@@ -24,7 +24,6 @@ public struct MapTest: Codable, Hashable {
self.directMap = directMap
self.indirectMap = indirectMap
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapMapOfString = "map_map_of_string"
case mapOfEnumString = "map_of_enum_string"
@@ -32,4 +31,32 @@ public struct MapTest: Codable, Hashable {
case indirectMap = "indirect_map"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(mapMapOfString, forKey: .mapMapOfString)
+ try container.encodeIfPresent(mapOfEnumString, forKey: .mapOfEnumString)
+ try container.encodeIfPresent(directMap, forKey: .directMap)
+ try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
+ }
+
+
+
+ public static func == (lhs: MapTest, rhs: MapTest) -> Bool {
+ lhs.mapMapOfString == rhs.mapMapOfString &&
+ lhs.mapOfEnumString == rhs.mapOfEnumString &&
+ lhs.directMap == rhs.directMap &&
+ lhs.indirectMap == rhs.indirectMap
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(mapMapOfString?.hashValue)
+ hasher.combine(mapOfEnumString?.hashValue)
+ hasher.combine(directMap?.hashValue)
+ hasher.combine(indirectMap?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
index 80c1781a2b..bfd55c9b14 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
+public final class MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
public var uuid: UUID?
public var dateTime: Date?
@@ -18,5 +18,35 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case uuid
+ case dateTime
+ case map
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(uuid, forKey: .uuid)
+ try container.encodeIfPresent(dateTime, forKey: .dateTime)
+ try container.encodeIfPresent(map, forKey: .map)
+ }
+
+
+
+ public static func == (lhs: MixedPropertiesAndAdditionalPropertiesClass, rhs: MixedPropertiesAndAdditionalPropertiesClass) -> Bool {
+ lhs.uuid == rhs.uuid &&
+ lhs.dateTime == rhs.dateTime &&
+ lhs.map == rhs.map
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(uuid?.hashValue)
+ hasher.combine(dateTime?.hashValue)
+ hasher.combine(map?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Model200Response.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Model200Response.swift
index d36d4e2735..95952d7c52 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Model200Response.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Model200Response.swift
@@ -8,7 +8,7 @@
import Foundation
/** Model for testing model name starting with number */
-public struct Model200Response: Codable, Hashable {
+public final class Model200Response: Codable, Hashable {
public var name: Int?
public var _class: String?
@@ -17,10 +17,31 @@ public struct Model200Response: Codable, Hashable {
self.name = name
self._class = _class
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case _class = "class"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(name, forKey: .name)
+ try container.encodeIfPresent(_class, forKey: ._class)
+ }
+
+
+
+ public static func == (lhs: Model200Response, rhs: Model200Response) -> Bool {
+ lhs.name == rhs.name &&
+ lhs._class == rhs._class
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(name?.hashValue)
+ hasher.combine(_class?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Name.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Name.swift
index 49cc575441..564c2d3ba3 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Name.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Name.swift
@@ -8,7 +8,7 @@
import Foundation
/** Model for testing model name same as property name */
-public struct Name: Codable, Hashable {
+public final class Name: Codable, Hashable {
public var name: Int
public var snakeCase: Int?
@@ -21,7 +21,6 @@ public struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@@ -29,4 +28,32 @@ public struct Name: Codable, Hashable {
case _123number = "123Number"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(name, forKey: .name)
+ try container.encodeIfPresent(snakeCase, forKey: .snakeCase)
+ try container.encodeIfPresent(property, forKey: .property)
+ try container.encodeIfPresent(_123number, forKey: ._123number)
+ }
+
+
+
+ public static func == (lhs: Name, rhs: Name) -> Bool {
+ lhs.name == rhs.name &&
+ lhs.snakeCase == rhs.snakeCase &&
+ lhs.property == rhs.property &&
+ lhs._123number == rhs._123number
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(name.hashValue)
+ hasher.combine(snakeCase?.hashValue)
+ hasher.combine(property?.hashValue)
+ hasher.combine(_123number?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/NumberOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/NumberOnly.swift
index 6b024294e2..0281c93875 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/NumberOnly.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/NumberOnly.swift
@@ -7,16 +7,34 @@
import Foundation
-public struct NumberOnly: Codable, Hashable {
+public final class NumberOnly: Codable, Hashable {
public var justNumber: Double?
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(justNumber, forKey: .justNumber)
+ }
+
+
+
+ public static func == (lhs: NumberOnly, rhs: NumberOnly) -> Bool {
+ lhs.justNumber == rhs.justNumber
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(justNumber?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift
index 8ef7cb79e2..e92045617a 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Order: Codable, Hashable {
+public final class Order: Codable, Hashable {
public enum Status: String, Codable, CaseIterable {
case placed = "placed"
@@ -30,5 +30,47 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case petId
+ case quantity
+ case shipDate
+ case status
+ case complete
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(petId, forKey: .petId)
+ try container.encodeIfPresent(quantity, forKey: .quantity)
+ try container.encodeIfPresent(shipDate, forKey: .shipDate)
+ try container.encodeIfPresent(status, forKey: .status)
+ try container.encodeIfPresent(complete, forKey: .complete)
+ }
+
+
+
+ public static func == (lhs: Order, rhs: Order) -> Bool {
+ lhs.id == rhs.id &&
+ lhs.petId == rhs.petId &&
+ lhs.quantity == rhs.quantity &&
+ lhs.shipDate == rhs.shipDate &&
+ lhs.status == rhs.status &&
+ lhs.complete == rhs.complete
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(id?.hashValue)
+ hasher.combine(petId?.hashValue)
+ hasher.combine(quantity?.hashValue)
+ hasher.combine(shipDate?.hashValue)
+ hasher.combine(status?.hashValue)
+ hasher.combine(complete?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/OuterComposite.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/OuterComposite.swift
index 9865764ff9..7ce51441ed 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/OuterComposite.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/OuterComposite.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct OuterComposite: Codable, Hashable {
+public final class OuterComposite: Codable, Hashable {
public var myNumber: Double?
public var myString: String?
@@ -18,11 +18,35 @@ public struct OuterComposite: Codable, Hashable {
self.myString = myString
self.myBoolean = myBoolean
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case myNumber = "my_number"
case myString = "my_string"
case myBoolean = "my_boolean"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(myNumber, forKey: .myNumber)
+ try container.encodeIfPresent(myString, forKey: .myString)
+ try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
+ }
+
+
+
+ public static func == (lhs: OuterComposite, rhs: OuterComposite) -> Bool {
+ lhs.myNumber == rhs.myNumber &&
+ lhs.myString == rhs.myString &&
+ lhs.myBoolean == rhs.myBoolean
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(myNumber?.hashValue)
+ hasher.combine(myString?.hashValue)
+ hasher.combine(myBoolean?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift
index 1bc823d3e9..109d226d62 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Pet: Codable, Hashable {
+public final class Pet: Codable, Hashable {
public enum Status: String, Codable, CaseIterable {
case available = "available"
@@ -30,5 +30,47 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case category
+ case name
+ case photoUrls
+ case tags
+ case status
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(category, forKey: .category)
+ try container.encode(name, forKey: .name)
+ try container.encode(photoUrls, forKey: .photoUrls)
+ try container.encodeIfPresent(tags, forKey: .tags)
+ try container.encodeIfPresent(status, forKey: .status)
+ }
+
+
+
+ public static func == (lhs: Pet, rhs: Pet) -> Bool {
+ lhs.id == rhs.id &&
+ lhs.category == rhs.category &&
+ lhs.name == rhs.name &&
+ lhs.photoUrls == rhs.photoUrls &&
+ lhs.tags == rhs.tags &&
+ lhs.status == rhs.status
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(id?.hashValue)
+ hasher.combine(category?.hashValue)
+ hasher.combine(name.hashValue)
+ hasher.combine(photoUrls.hashValue)
+ hasher.combine(tags?.hashValue)
+ hasher.combine(status?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift
index 03b5b0dbf0..6fff2152c0 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct ReadOnlyFirst: Codable, Hashable {
+public final class ReadOnlyFirst: Codable, Hashable {
public var bar: String?
public var baz: String?
@@ -16,5 +16,31 @@ public struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case bar
+ case baz
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(bar, forKey: .bar)
+ try container.encodeIfPresent(baz, forKey: .baz)
+ }
+
+
+
+ public static func == (lhs: ReadOnlyFirst, rhs: ReadOnlyFirst) -> Bool {
+ lhs.bar == rhs.bar &&
+ lhs.baz == rhs.baz
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(bar?.hashValue)
+ hasher.combine(baz?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Return.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Return.swift
index 5f539f4618..7083431b5d 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Return.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Return.swift
@@ -8,16 +8,34 @@
import Foundation
/** Model for testing reserved words */
-public struct Return: Codable, Hashable {
+public final class Return: Codable, Hashable {
public var _return: Int?
public init(_return: Int? = nil) {
self._return = _return
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case _return = "return"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(_return, forKey: ._return)
+ }
+
+
+
+ public static func == (lhs: Return, rhs: Return) -> Bool {
+ lhs._return == rhs._return
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(_return?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift
index cb82d2ae3a..d9ce42fc5c 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift
@@ -7,16 +7,34 @@
import Foundation
-public struct SpecialModelName: Codable, Hashable {
+public final class SpecialModelName: Codable, Hashable {
public var specialPropertyName: Int64?
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
+ }
+
+
+
+ public static func == (lhs: SpecialModelName, rhs: SpecialModelName) -> Bool {
+ lhs.specialPropertyName == rhs.specialPropertyName
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(specialPropertyName?.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift
index 77ab81f5f3..74605e1f6b 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift
@@ -7,8 +7,10 @@
import Foundation
-public struct StringBooleanMap: Codable, Hashable {
+public final class StringBooleanMap: Codable, Hashable {
+ public enum CodingKeys: CodingKey, CaseIterable {
+ }
public var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@@ -27,10 +29,9 @@ public struct StringBooleanMap: Codable, Hashable {
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
-
- var container = encoder.container(keyedBy: String.self)
-
- try container.encodeMap(additionalProperties)
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
+ try additionalPropertiesContainer.encodeMap(additionalProperties)
}
// Decodable protocol methods
@@ -42,4 +43,13 @@ public struct StringBooleanMap: Codable, Hashable {
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
+
+ public static func == (lhs: StringBooleanMap, rhs: StringBooleanMap) -> Bool {
+ lhs.additionalProperties == rhs.additionalProperties
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(additionalProperties.hashValue)
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift
index 8b8e24fc39..46f76ea301 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct Tag: Codable, Hashable {
+public final class Tag: Codable, Hashable {
public var id: Int64?
public var name: String?
@@ -16,5 +16,31 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case name
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(name, forKey: .name)
+ }
+
+
+
+ public static func == (lhs: Tag, rhs: Tag) -> Bool {
+ lhs.id == rhs.id &&
+ lhs.name == rhs.name
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(id?.hashValue)
+ hasher.combine(name?.hashValue)
+
+ }
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift
index f1920ef377..83aa5e5641 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct TypeHolderDefault: Codable, Hashable {
+public final class TypeHolderDefault: Codable, Hashable {
public var stringItem: String = "what"
public var numberItem: Double
@@ -22,7 +22,6 @@ public struct TypeHolderDefault: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,35 @@ public struct TypeHolderDefault: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
+ public static func == (lhs: TypeHolderDefault, rhs: TypeHolderDefault) -> Bool {
+ lhs.stringItem == rhs.stringItem &&
+ lhs.numberItem == rhs.numberItem &&
+ lhs.integerItem == rhs.integerItem &&
+ lhs.boolItem == rhs.boolItem &&
+ lhs.arrayItem == rhs.arrayItem
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(stringItem.hashValue)
+ hasher.combine(numberItem.hashValue)
+ hasher.combine(integerItem.hashValue)
+ hasher.combine(boolItem.hashValue)
+ hasher.combine(arrayItem.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift
index 1a23c1b486..8403f60354 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct TypeHolderExample: Codable, Hashable {
+public final class TypeHolderExample: Codable, Hashable {
public var stringItem: String
public var numberItem: Double
@@ -22,7 +22,6 @@ public struct TypeHolderExample: Codable, Hashable {
self.boolItem = boolItem
self.arrayItem = arrayItem
}
-
public enum CodingKeys: String, CodingKey, CaseIterable {
case stringItem = "string_item"
case numberItem = "number_item"
@@ -31,4 +30,35 @@ public struct TypeHolderExample: Codable, Hashable {
case arrayItem = "array_item"
}
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encode(stringItem, forKey: .stringItem)
+ try container.encode(numberItem, forKey: .numberItem)
+ try container.encode(integerItem, forKey: .integerItem)
+ try container.encode(boolItem, forKey: .boolItem)
+ try container.encode(arrayItem, forKey: .arrayItem)
+ }
+
+
+
+ public static func == (lhs: TypeHolderExample, rhs: TypeHolderExample) -> Bool {
+ lhs.stringItem == rhs.stringItem &&
+ lhs.numberItem == rhs.numberItem &&
+ lhs.integerItem == rhs.integerItem &&
+ lhs.boolItem == rhs.boolItem &&
+ lhs.arrayItem == rhs.arrayItem
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(stringItem.hashValue)
+ hasher.combine(numberItem.hashValue)
+ hasher.combine(integerItem.hashValue)
+ hasher.combine(boolItem.hashValue)
+ hasher.combine(arrayItem.hashValue)
+
+ }
+
}
diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift
index f3b4f6bb95..94e4cb058a 100644
--- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift
+++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift
@@ -7,7 +7,7 @@
import Foundation
-public struct User: Codable, Hashable {
+public final class User: Codable, Hashable {
public var id: Int64?
public var username: String?
@@ -29,5 +29,55 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case id
+ case username
+ case firstName
+ case lastName
+ case email
+ case password
+ case phone
+ case userStatus
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(id, forKey: .id)
+ try container.encodeIfPresent(username, forKey: .username)
+ try container.encodeIfPresent(firstName, forKey: .firstName)
+ try container.encodeIfPresent(lastName, forKey: .lastName)
+ try container.encodeIfPresent(email, forKey: .email)
+ try container.encodeIfPresent(password, forKey: .password)
+ try container.encodeIfPresent(phone, forKey: .phone)
+ try container.encodeIfPresent(userStatus, forKey: .userStatus)
+ }
+
+
+
+ public static func == (lhs: User, rhs: User) -> Bool {
+ lhs.id == rhs.id &&
+ lhs.username == rhs.username &&
+ lhs.firstName == rhs.firstName &&
+ lhs.lastName == rhs.lastName &&
+ lhs.email == rhs.email &&
+ lhs.password == rhs.password &&
+ lhs.phone == rhs.phone &&
+ lhs.userStatus == rhs.userStatus
+
+ }
+
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(id?.hashValue)
+ hasher.combine(username?.hashValue)
+ hasher.combine(firstName?.hashValue)
+ hasher.combine(lastName?.hashValue)
+ hasher.combine(email?.hashValue)
+ hasher.combine(password?.hashValue)
+ hasher.combine(phone?.hashValue)
+ hasher.combine(userStatus?.hashValue)
+
+ }
}