diff --git a/bin/configs/swift5-urlsessionLibrary.yaml b/bin/configs/swift5-urlsessionLibrary.yaml
index 00bc36a58539..b260611e6029 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 dc3e27cdecef..9774b434f13d 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 715fa3dcd093..c119f723a2a3 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}}
+ }
+
+ {{#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}}
}
-{{/vendorExtensions.x-codegen-has-escaped-property-names}}{{/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 1cb539452dc2..38797a5bf10f 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 733b7bc51594..84c1dad9ec12 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 e57c8b471765..81111252404e 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 630992f6231e..beec80ae582f 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 4710793fc9a6..5ed956b92273 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 a41968d9b199..86f71f1534a5 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 f442ea725451..e692ebd28098 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 44b50bbe0063..692a3b212f3e 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 c6bf4460da6e..73335b4d3953 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 f9484f9bc8fd..c17cf0d20685 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 6a19bb02d0df..dfd5504a653c 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 5c8e8882831f..9b5340899a5f 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 1464b047c06a..f0e62d05b122 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 5aed7834d537..137b9a5254a9 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 716776261d30..4f7070a4f63d 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 aa13aa59f86a..eb761dca902b 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 8b62febdc959..45236c792609 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 aa14d762394d..15dbd0c03fcc 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 85987709776e..52b3f620cdae 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 f09cb471b360..232b8c492957 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 03d35274a4ee..0097907e9b44 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 f8f08e4c6c44..48704fd13823 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 bd4e7b97e81b..96af40355dd1 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 80c1781a2bfc..1f3a7ca820c5 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 d36d4e27352a..f6a5836117e4 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 49cc57544179..57336422c862 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 6b024294e288..861a307e19d5 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 8ef7cb79e2c8..1d2c31358171 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 9865764ff9bb..6935641c3643 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 1bc823d3e960..fa5b125ff13d 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 03b5b0dbf02b..2ff56cc1566b 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 5f539f461843..219b49420a12 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 cb82d2ae3adc..562ba86f6027 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 77ab81f5f341..a6903b84ce6f 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 8b8e24fc39c0..bda5be349339 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 f1920ef37788..e7896203919a 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 1a23c1b486b8..2952b6701674 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 f3b4f6bb958a..a1aa36bcfb0c 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 733b7bc51594..84c1dad9ec12 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 e57c8b471765..81111252404e 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 630992f6231e..beec80ae582f 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 4710793fc9a6..5ed956b92273 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 a41968d9b199..86f71f1534a5 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 f442ea725451..e692ebd28098 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 44b50bbe0063..692a3b212f3e 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 c6bf4460da6e..73335b4d3953 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 f9484f9bc8fd..c17cf0d20685 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 6a19bb02d0df..dfd5504a653c 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 5c8e8882831f..9b5340899a5f 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 1464b047c06a..f0e62d05b122 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 5aed7834d537..137b9a5254a9 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 716776261d30..4f7070a4f63d 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 aa13aa59f86a..eb761dca902b 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 8b62febdc959..45236c792609 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 aa14d762394d..15dbd0c03fcc 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 85987709776e..52b3f620cdae 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 f09cb471b360..232b8c492957 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 03d35274a4ee..0097907e9b44 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 f8f08e4c6c44..48704fd13823 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 bd4e7b97e81b..96af40355dd1 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 80c1781a2bfc..1f3a7ca820c5 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 d36d4e27352a..f6a5836117e4 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 49cc57544179..57336422c862 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 6b024294e288..861a307e19d5 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 8ef7cb79e2c8..1d2c31358171 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 9865764ff9bb..6935641c3643 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 1bc823d3e960..fa5b125ff13d 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 03b5b0dbf02b..2ff56cc1566b 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 5f539f461843..219b49420a12 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 cb82d2ae3adc..562ba86f6027 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 77ab81f5f341..a6903b84ce6f 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 8b8e24fc39c0..bda5be349339 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 f1920ef37788..e7896203919a 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 1a23c1b486b8..2952b6701674 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 f3b4f6bb958a..a1aa36bcfb0c 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 733b7bc51594..84c1dad9ec12 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 e57c8b471765..81111252404e 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 630992f6231e..beec80ae582f 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 4710793fc9a6..5ed956b92273 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 a41968d9b199..86f71f1534a5 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 f442ea725451..e692ebd28098 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 44b50bbe0063..692a3b212f3e 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 c6bf4460da6e..73335b4d3953 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 f9484f9bc8fd..c17cf0d20685 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 6a19bb02d0df..dfd5504a653c 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 5c8e8882831f..9b5340899a5f 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 1464b047c06a..f0e62d05b122 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 5aed7834d537..137b9a5254a9 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 716776261d30..4f7070a4f63d 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 aa13aa59f86a..eb761dca902b 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 8b62febdc959..45236c792609 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 aa14d762394d..15dbd0c03fcc 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 85987709776e..52b3f620cdae 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 f09cb471b360..232b8c492957 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 03d35274a4ee..0097907e9b44 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 f8f08e4c6c44..48704fd13823 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 bd4e7b97e81b..96af40355dd1 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 80c1781a2bfc..1f3a7ca820c5 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 d36d4e27352a..f6a5836117e4 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 49cc57544179..57336422c862 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 6b024294e288..861a307e19d5 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 8ef7cb79e2c8..1d2c31358171 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 9865764ff9bb..6935641c3643 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 1bc823d3e960..fa5b125ff13d 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 03b5b0dbf02b..2ff56cc1566b 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 5f539f461843..219b49420a12 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 cb82d2ae3adc..562ba86f6027 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 77ab81f5f341..a6903b84ce6f 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 8b8e24fc39c0..bda5be349339 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 f1920ef37788..e7896203919a 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 1a23c1b486b8..2952b6701674 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 f3b4f6bb958a..a1aa36bcfb0c 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 c8058e8db2a4..77798101de28 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 bbf2ef73f2cb..7f03d621a43f 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 4401234cb337..5a6dadc0efbe 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 ab283fe48852..0d6973e81655 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 a3a488b13f63..5cb474912560 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 566bb545dbf9..c6a5806130d9 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 34e7b0fd4e9c..b425caa61542 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 80422aa94a31..d3e38b1359f1 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 b117aad7133b..71475818338e 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 d5ce23fb27a0..39b6314c5f4f 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 fa96400f7a63..f7714be33640 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 c731155e26de..1e6af9eebf3a 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 a55eef8975b4..ffa880de23d5 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 081244637a51..287f42d078e6 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 a7fc1f24827a..7ee6ec868404 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 3b4f6c149fad..9ed7d49d38cc 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 33b54fdd4e80..30f6f8fb4ddd 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 de09406d53cf..fbb17db6d0e1 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 161bead82270..e43a80c44d10 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 5957070689e7..ae19d9bbd635 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 8a8f61af5890..ed9630866751 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 27ed6bce5571..7b76f6acb3ec 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 f0d615b5912b..d0cd292f32d0 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 bfa1e9e6c04c..0a3428c9e71a 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 1f5b70fc6c0a..2e54ec687ff2 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 7346dd89f4b9..567aa61a6fc6 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 37298aa93a6e..f111d9e2b133 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 959c1b6132fd..2a1d385b7f93 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 725d0ff947b1..3f6ba87c48d6 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 e0353da8f215..09c3210f9b0b 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 af6cb19d7da1..f9b2cc51be30 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 37c113960383..1b95c7a5705a 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 0c886ae0fc8f..3daabf5885e4 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 b11cacc9d9b3..8c9e97c320ea 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 c388433da77b..379a695e5748 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 cc134ec6af64..606a083e188d 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 998123e37e24..53ab287d601a 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 c29097c092b3..7d773a544048 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 6d5719e4395c..e11b2681cb35 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 8b4501e67aa6..ac2d648e04ec 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 52500e04b432..66c98a5fcdfe 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 a1408b0bd1b0..2f91bbc634dd 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 afbd9f12349b..b39c749f92aa 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 620f778bcc9a..328276bc7a65 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 528d7f886c0b..6d64cbfd15d4 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 38334c39011c..b0b5971f6eff 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 8ef73e96f019..89c695cd14e9 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 dd95bb5be0cd..819e1bd2eb1d 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 7b93023aa354..a4ce9ef38a12 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 2b42d0b45862..0c0e2cb80334 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 5542ffa7de75..c49009bc8902 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 6a4b10e996c1..5ec8b58e544c 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 0e034abbf725..886ce95e2de5 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 648f3a6bfb5a..9adbcf24ad28 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 4c1efdd41407..7956f737fbbc 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 be6118ef423f..773ea8ad2838 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 41c63007088d..7097a8909761 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 6e8c9d0f9abc..8a93813f845d 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 dd3e83306c3d..262ff77d5008 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 5124dd3b089d..b2e54a8e9f38 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 be5963357fdc..a98bdb63d50e 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 84f419103a41..f94b67e55569 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 7ca91927af7e..58809b2b6546 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 7a977c19c7c7..15809e01efa6 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 ba407e3ea25d..60b999005e4f 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 bd503cb36fce..22f4d5b19563 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 89c612262d2f..9e3a6ed6487e 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 15b0507a4785..4a8e8afc854b 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 40fa7365d0ac..efb6d07c5411 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 728a81434a73..e681ffaf689c 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 9238070c2cb1..e899975923ed 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 e17ada14c425..d8b058e41a48 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 c16846f4ac19..996cfa7125d6 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 e589a9c20048..15aecfe6ad9b 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 41b2bf459eff..38aa865c4937 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 ffe9730a6fe4..c430e0a7d27e 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 fc02765d30e2..097c4ec8896d 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 5900ded6aad4..3bc091cc0469 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 40e3a41c34d9..4a95e7383783 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 5b9831507979..b20a716f73a1 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 733b7bc51594..84c1dad9ec12 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 e57c8b471765..81111252404e 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 630992f6231e..beec80ae582f 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 4710793fc9a6..5ed956b92273 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 a41968d9b199..86f71f1534a5 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 f442ea725451..e692ebd28098 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 44b50bbe0063..692a3b212f3e 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 c6bf4460da6e..73335b4d3953 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 f9484f9bc8fd..c17cf0d20685 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 6a19bb02d0df..dfd5504a653c 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 5c8e8882831f..9b5340899a5f 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 1464b047c06a..f0e62d05b122 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 5aed7834d537..137b9a5254a9 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 716776261d30..4f7070a4f63d 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 aa13aa59f86a..eb761dca902b 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 8b62febdc959..45236c792609 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 aa14d762394d..15dbd0c03fcc 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 85987709776e..52b3f620cdae 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 f09cb471b360..232b8c492957 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 03d35274a4ee..0097907e9b44 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 f8f08e4c6c44..48704fd13823 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 bd4e7b97e81b..96af40355dd1 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 80c1781a2bfc..1f3a7ca820c5 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 d36d4e27352a..f6a5836117e4 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 49cc57544179..57336422c862 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 6b024294e288..861a307e19d5 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 8ef7cb79e2c8..1d2c31358171 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 9865764ff9bb..6935641c3643 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 1bc823d3e960..fa5b125ff13d 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 03b5b0dbf02b..2ff56cc1566b 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 5f539f461843..219b49420a12 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 cb82d2ae3adc..562ba86f6027 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 77ab81f5f341..a6903b84ce6f 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 8b8e24fc39c0..bda5be349339 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 f1920ef37788..e7896203919a 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 1a23c1b486b8..2952b6701674 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 f3b4f6bb958a..a1aa36bcfb0c 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 4c5e1a53bd4b..8367f675bf39 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 48229f750cdc..60f6bf71e55c 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 93b598e8d6f7..5e675ecb9259 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 6225dd84be7a..ec4e5c4c549a 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 698c3adf98cb..1f93674c1fd7 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 578d06178524..4bb7cb9e4fc4 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 6b4d8425c4af..be6f54eea710 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 731f11bf6f16..7e7da73d1082 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 34cf645193dd..f55fcf0da77d 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 4089925077ff..45cacce8d472 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 a76f014c0364..fa76c380e3fa 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 f1dd2364bfc2..35b4e19f17a9 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 ef91e2a47a5b..d9c600c8e629 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 0eab83890406..b1263d421a00 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 e3befc6dfe57..cb0593680902 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 d9dd6a64b064..f55d8b5d16d0 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 1fbc65d2db54..d359954b3ea5 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 aa4cf089d0f7..de3a5d1453ab 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 fce99baa8f02..75ad7d9f6f71 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 0b2b2f5887e4..2f8f0d5dc754 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 0247967c505f..45862d74d13f 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 15bdb8c852f1..864373dd97e8 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 1253cecf1b8c..02e9ce327cee 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 1c8c0b4b11f1..3b394c313161 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 59fc35b4999f..d3b7e502a736 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 71634b248270..9f9b5ec6526b 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 25ac0c3fabb1..a8101288f754 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 36a489ac41a3..b5e93fcc9bf3 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 561d18526968..3b3d0ce7bc24 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 ae8af88b8a29..e9d58c1ef0e9 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 1bb551dcaef8..80390f52969a 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 78dc5a7db12e..bff078ca5967 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 0a6fc2976ee4..37dfe65f8720 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 c35e07111a00..bf501c049b10 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 0ad0e39ab4d8..7557899f5ad6 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 a26b555da79e..8a4b7b1404b9 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 4c33cf58d3b6..f6bea2aee0fb 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 733b7bc51594..84c1dad9ec12 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 e57c8b471765..81111252404e 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 630992f6231e..beec80ae582f 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 4710793fc9a6..5ed956b92273 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 a41968d9b199..86f71f1534a5 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 f442ea725451..e692ebd28098 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 44b50bbe0063..692a3b212f3e 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 c6bf4460da6e..73335b4d3953 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 f9484f9bc8fd..c17cf0d20685 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 6a19bb02d0df..dfd5504a653c 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 5c8e8882831f..9b5340899a5f 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 1464b047c06a..f0e62d05b122 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 5aed7834d537..137b9a5254a9 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 716776261d30..4f7070a4f63d 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 aa13aa59f86a..eb761dca902b 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 8b62febdc959..45236c792609 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 aa14d762394d..15dbd0c03fcc 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 85987709776e..52b3f620cdae 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 f09cb471b360..232b8c492957 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 03d35274a4ee..0097907e9b44 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 f8f08e4c6c44..48704fd13823 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 bd4e7b97e81b..96af40355dd1 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 80c1781a2bfc..1f3a7ca820c5 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 d36d4e27352a..f6a5836117e4 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 49cc57544179..57336422c862 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 6b024294e288..861a307e19d5 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 8ef7cb79e2c8..1d2c31358171 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 9865764ff9bb..6935641c3643 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 1bc823d3e960..fa5b125ff13d 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 03b5b0dbf02b..2ff56cc1566b 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 5f539f461843..219b49420a12 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 cb82d2ae3adc..562ba86f6027 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 77ab81f5f341..a6903b84ce6f 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 8b8e24fc39c0..bda5be349339 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 f1920ef37788..e7896203919a 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 1a23c1b486b8..2952b6701674 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 f3b4f6bb958a..a1aa36bcfb0c 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 733b7bc51594..84c1dad9ec12 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 e57c8b471765..81111252404e 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 630992f6231e..beec80ae582f 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 4710793fc9a6..5ed956b92273 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 a41968d9b199..86f71f1534a5 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 f442ea725451..e692ebd28098 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 44b50bbe0063..692a3b212f3e 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 c6bf4460da6e..73335b4d3953 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 f9484f9bc8fd..c17cf0d20685 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 6a19bb02d0df..dfd5504a653c 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 ea377bceb252..e8dbe76c46b6 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 1464b047c06a..f0e62d05b122 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 5aed7834d537..137b9a5254a9 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 716776261d30..4f7070a4f63d 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 aa13aa59f86a..eb761dca902b 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 8b62febdc959..45236c792609 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 aa14d762394d..15dbd0c03fcc 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 85987709776e..52b3f620cdae 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 f09cb471b360..232b8c492957 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 03d35274a4ee..0097907e9b44 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 f8f08e4c6c44..48704fd13823 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 bd4e7b97e81b..96af40355dd1 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 80c1781a2bfc..1f3a7ca820c5 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 31c1c142e54a..0c9bc3d03fdb 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 49cc57544179..57336422c862 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 6b024294e288..861a307e19d5 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 8ef7cb79e2c8..1d2c31358171 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 9865764ff9bb..6935641c3643 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 1bc823d3e960..fa5b125ff13d 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 03b5b0dbf02b..2ff56cc1566b 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 40591ab2fb8c..37e34d010dce 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 cb82d2ae3adc..562ba86f6027 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 77ab81f5f341..a6903b84ce6f 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 8b8e24fc39c0..bda5be349339 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 f1920ef37788..e7896203919a 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 1a23c1b486b8..2952b6701674 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 f3b4f6bb958a..a1aa36bcfb0c 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 733b7bc51594..0b63e40afecc 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 e57c8b471765..827350f5f132 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 630992f6231e..a7560b2b05c3 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 4710793fc9a6..6b567914851f 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 a41968d9b199..5558ef13457f 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 f442ea725451..0d5750eec8e0 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 44b50bbe0063..03573fea5e30 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 c6bf4460da6e..3c79d5f3f484 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 f9484f9bc8fd..28204818be72 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 6a19bb02d0df..1465d8ec5d9b 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 1464b047c06a..77db41343a9c 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 5aed7834d537..5d91d3877aaf 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 716776261d30..ab765467b9e3 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 aa13aa59f86a..0b16bfde7573 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 8b62febdc959..08ced90f7570 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 aa14d762394d..ed7fe6a2cacb 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 85987709776e..4e78f79df47c 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 f09cb471b360..7b2ac4c53304 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 03d35274a4ee..61f9d19e68c5 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 f8f08e4c6c44..1fb3cdaa0db2 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 bd4e7b97e81b..8c0b82b8e7b0 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 80c1781a2bfc..bfd55c9b14eb 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 49cc57544179..564c2d3ba319 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 6b024294e288..0281c9387566 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 8ef7cb79e2c8..e92045617a9f 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 9865764ff9bb..7ce51441ed27 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 1bc823d3e960..109d226d62e3 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 03b5b0dbf02b..6fff2152c024 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 cb82d2ae3adc..d9ce42fc5c40 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 77ab81f5f341..74605e1f6b9c 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 8b8e24fc39c0..46f76ea301aa 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 f1920ef37788..83aa5e564195 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 1a23c1b486b8..8403f60354dc 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 f3b4f6bb958a..94e4cb058af3 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 733b7bc51594..0b63e40afecc 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 e57c8b471765..827350f5f132 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 630992f6231e..a7560b2b05c3 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 4710793fc9a6..6b567914851f 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 a41968d9b199..5558ef13457f 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 f442ea725451..0d5750eec8e0 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 44b50bbe0063..03573fea5e30 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 c6bf4460da6e..3c79d5f3f484 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 f9484f9bc8fd..28204818be72 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 6a19bb02d0df..1465d8ec5d9b 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 5c8e8882831f..92620d368f70 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 1464b047c06a..77db41343a9c 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 5aed7834d537..5d91d3877aaf 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 716776261d30..ab765467b9e3 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 aa13aa59f86a..0b16bfde7573 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 8b62febdc959..08ced90f7570 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 aa14d762394d..ed7fe6a2cacb 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 85987709776e..4e78f79df47c 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 f09cb471b360..7b2ac4c53304 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 03d35274a4ee..61f9d19e68c5 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 f8f08e4c6c44..1fb3cdaa0db2 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 bd4e7b97e81b..8c0b82b8e7b0 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 80c1781a2bfc..bfd55c9b14eb 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 d36d4e27352a..95952d7c5295 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 49cc57544179..564c2d3ba319 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 6b024294e288..0281c9387566 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 8ef7cb79e2c8..e92045617a9f 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 9865764ff9bb..7ce51441ed27 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 1bc823d3e960..109d226d62e3 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 03b5b0dbf02b..6fff2152c024 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 5f539f461843..7083431b5df4 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 cb82d2ae3adc..d9ce42fc5c40 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 77ab81f5f341..74605e1f6b9c 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 8b8e24fc39c0..46f76ea301aa 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 f1920ef37788..83aa5e564195 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 1a23c1b486b8..8403f60354dc 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 f3b4f6bb958a..94e4cb058af3 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)
+
+ }
}