forked from loafle/openapi-generator-original
update samples
This commit is contained in:
parent
f7c3773903
commit
7df0f56fdc
@ -15,6 +15,9 @@ public struct AdditionalPropertiesAnyType: Codable, Hashable {
|
||||
public init(name: String? = nil) {
|
||||
self.name = name
|
||||
}
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case name
|
||||
}
|
||||
public var additionalProperties: [String: AnyCodable] = [:]
|
||||
|
||||
public subscript(key: String) -> AnyCodable? {
|
||||
@ -33,11 +36,10 @@ public struct AdditionalPropertiesAnyType: Codable, Hashable {
|
||||
// Encodable protocol methods
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
var container = encoder.container(keyedBy: String.self)
|
||||
|
||||
try container.encodeIfPresent(name, forKey: "name")
|
||||
try container.encodeMap(additionalProperties)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(name, forKey: .name)
|
||||
var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
|
||||
try additionalPropertiesContainer.encodeMap(additionalProperties)
|
||||
}
|
||||
|
||||
// Decodable protocol methods
|
||||
@ -51,4 +53,5 @@ public struct AdditionalPropertiesAnyType: Codable, Hashable {
|
||||
additionalProperties = try container.decodeMap(AnyCodable.self, excludedKeys: nonAdditionalPropertyKeys)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ public struct AdditionalPropertiesArray: Codable, Hashable {
|
||||
public init(name: String? = nil) {
|
||||
self.name = name
|
||||
}
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case name
|
||||
}
|
||||
public var additionalProperties: [String: [AnyCodable]] = [:]
|
||||
|
||||
public subscript(key: String) -> [AnyCodable]? {
|
||||
@ -33,11 +36,10 @@ public struct AdditionalPropertiesArray: Codable, Hashable {
|
||||
// Encodable protocol methods
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
var container = encoder.container(keyedBy: String.self)
|
||||
|
||||
try container.encodeIfPresent(name, forKey: "name")
|
||||
try container.encodeMap(additionalProperties)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(name, forKey: .name)
|
||||
var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
|
||||
try additionalPropertiesContainer.encodeMap(additionalProperties)
|
||||
}
|
||||
|
||||
// Decodable protocol methods
|
||||
@ -51,4 +53,5 @@ public struct AdditionalPropertiesArray: Codable, Hashable {
|
||||
additionalProperties = try container.decodeMap([AnyCodable].self, excludedKeys: nonAdditionalPropertyKeys)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ public struct AdditionalPropertiesBoolean: Codable, Hashable {
|
||||
public init(name: String? = nil) {
|
||||
self.name = name
|
||||
}
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case name
|
||||
}
|
||||
public var additionalProperties: [String: Bool] = [:]
|
||||
|
||||
public subscript(key: String) -> Bool? {
|
||||
@ -33,11 +36,10 @@ public struct AdditionalPropertiesBoolean: Codable, Hashable {
|
||||
// Encodable protocol methods
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
var container = encoder.container(keyedBy: String.self)
|
||||
|
||||
try container.encodeIfPresent(name, forKey: "name")
|
||||
try container.encodeMap(additionalProperties)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(name, forKey: .name)
|
||||
var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
|
||||
try additionalPropertiesContainer.encodeMap(additionalProperties)
|
||||
}
|
||||
|
||||
// Decodable protocol methods
|
||||
@ -51,4 +53,5 @@ public struct AdditionalPropertiesBoolean: Codable, Hashable {
|
||||
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -54,7 +54,16 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(mapString, forKey: .mapString)
|
||||
try container.encodeIfPresent(mapNumber, forKey: .mapNumber)
|
||||
try container.encodeIfPresent(mapInteger, forKey: .mapInteger)
|
||||
try container.encodeIfPresent(mapBoolean, forKey: .mapBoolean)
|
||||
try container.encodeIfPresent(mapArrayInteger, forKey: .mapArrayInteger)
|
||||
try container.encodeIfPresent(mapArrayAnytype, forKey: .mapArrayAnytype)
|
||||
try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
|
||||
try container.encodeIfPresent(mapMapAnytype, forKey: .mapMapAnytype)
|
||||
try container.encodeIfPresent(anytype1, forKey: .anytype1)
|
||||
try container.encodeIfPresent(anytype2, forKey: .anytype2)
|
||||
try container.encodeIfPresent(anytype3, forKey: .anytype3)
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,6 +15,9 @@ public struct AdditionalPropertiesInteger: Codable, Hashable {
|
||||
public init(name: String? = nil) {
|
||||
self.name = name
|
||||
}
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case name
|
||||
}
|
||||
public var additionalProperties: [String: Int] = [:]
|
||||
|
||||
public subscript(key: String) -> Int? {
|
||||
@ -33,11 +36,10 @@ public struct AdditionalPropertiesInteger: Codable, Hashable {
|
||||
// Encodable protocol methods
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
var container = encoder.container(keyedBy: String.self)
|
||||
|
||||
try container.encodeIfPresent(name, forKey: "name")
|
||||
try container.encodeMap(additionalProperties)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(name, forKey: .name)
|
||||
var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
|
||||
try additionalPropertiesContainer.encodeMap(additionalProperties)
|
||||
}
|
||||
|
||||
// Decodable protocol methods
|
||||
@ -51,4 +53,5 @@ public struct AdditionalPropertiesInteger: Codable, Hashable {
|
||||
additionalProperties = try container.decodeMap(Int.self, excludedKeys: nonAdditionalPropertyKeys)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ public struct AdditionalPropertiesNumber: Codable, Hashable {
|
||||
public init(name: String? = nil) {
|
||||
self.name = name
|
||||
}
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case name
|
||||
}
|
||||
public var additionalProperties: [String: Double] = [:]
|
||||
|
||||
public subscript(key: String) -> Double? {
|
||||
@ -33,11 +36,10 @@ public struct AdditionalPropertiesNumber: Codable, Hashable {
|
||||
// Encodable protocol methods
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
var container = encoder.container(keyedBy: String.self)
|
||||
|
||||
try container.encodeIfPresent(name, forKey: "name")
|
||||
try container.encodeMap(additionalProperties)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(name, forKey: .name)
|
||||
var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
|
||||
try additionalPropertiesContainer.encodeMap(additionalProperties)
|
||||
}
|
||||
|
||||
// Decodable protocol methods
|
||||
@ -51,4 +53,5 @@ public struct AdditionalPropertiesNumber: Codable, Hashable {
|
||||
additionalProperties = try container.decodeMap(Double.self, excludedKeys: nonAdditionalPropertyKeys)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ public struct AdditionalPropertiesObject: Codable, Hashable {
|
||||
public init(name: String? = nil) {
|
||||
self.name = name
|
||||
}
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case name
|
||||
}
|
||||
public var additionalProperties: [String: [String: AnyCodable]] = [:]
|
||||
|
||||
public subscript(key: String) -> [String: AnyCodable]? {
|
||||
@ -33,11 +36,10 @@ public struct AdditionalPropertiesObject: Codable, Hashable {
|
||||
// Encodable protocol methods
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
var container = encoder.container(keyedBy: String.self)
|
||||
|
||||
try container.encodeIfPresent(name, forKey: "name")
|
||||
try container.encodeMap(additionalProperties)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(name, forKey: .name)
|
||||
var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
|
||||
try additionalPropertiesContainer.encodeMap(additionalProperties)
|
||||
}
|
||||
|
||||
// Decodable protocol methods
|
||||
@ -51,4 +53,5 @@ public struct AdditionalPropertiesObject: Codable, Hashable {
|
||||
additionalProperties = try container.decodeMap([String: AnyCodable].self, excludedKeys: nonAdditionalPropertyKeys)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ public struct AdditionalPropertiesString: Codable, Hashable {
|
||||
public init(name: String? = nil) {
|
||||
self.name = name
|
||||
}
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case name
|
||||
}
|
||||
public var additionalProperties: [String: String] = [:]
|
||||
|
||||
public subscript(key: String) -> String? {
|
||||
@ -33,11 +36,10 @@ public struct AdditionalPropertiesString: Codable, Hashable {
|
||||
// Encodable protocol methods
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
var container = encoder.container(keyedBy: String.self)
|
||||
|
||||
try container.encodeIfPresent(name, forKey: "name")
|
||||
try container.encodeMap(additionalProperties)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(name, forKey: .name)
|
||||
var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
|
||||
try additionalPropertiesContainer.encodeMap(additionalProperties)
|
||||
}
|
||||
|
||||
// Decodable protocol methods
|
||||
@ -51,4 +53,5 @@ public struct AdditionalPropertiesString: Codable, Hashable {
|
||||
additionalProperties = try container.decodeMap(String.self, excludedKeys: nonAdditionalPropertyKeys)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -21,5 +21,17 @@ public struct BigCat: Codable, Hashable {
|
||||
public init(kind: Kind? = nil) {
|
||||
self.kind = kind
|
||||
}
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case kind
|
||||
}
|
||||
|
||||
// Encodable protocol methods
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(kind, forKey: .kind)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -21,5 +21,17 @@ public struct BigCatAllOf: Codable, Hashable {
|
||||
public init(kind: Kind? = nil) {
|
||||
self.kind = kind
|
||||
}
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case kind
|
||||
}
|
||||
|
||||
// Encodable protocol methods
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(kind, forKey: .kind)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ import AnyCodable
|
||||
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
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ public struct FormatTest: Codable, Hashable {
|
||||
self.password = password
|
||||
self.bigDecimal = bigDecimal
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case integer
|
||||
case int32
|
||||
@ -58,21 +57,6 @@ public struct FormatTest: Codable, Hashable {
|
||||
case password
|
||||
case bigDecimal = "BigDecimal"
|
||||
}
|
||||
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
|
||||
|
||||
@ -91,6 +75,7 @@ public struct FormatTest: Codable, Hashable {
|
||||
try container.encodeIfPresent(dateTime, forKey: .dateTime)
|
||||
try container.encodeIfPresent(uuid, forKey: .uuid)
|
||||
try container.encode(password, forKey: .password)
|
||||
try container.encodeIfPresent(bigDecimal, forKey: .bigDecimal)
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,6 +40,7 @@ public struct TypeHolderExample: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(stringItem, forKey: .stringItem)
|
||||
try container.encode(numberItem, forKey: .numberItem)
|
||||
try container.encode(floatItem, forKey: .floatItem)
|
||||
try container.encode(integerItem, forKey: .integerItem)
|
||||
try container.encode(boolItem, forKey: .boolItem)
|
||||
try container.encode(arrayItem, forKey: .arrayItem)
|
||||
|
@ -71,7 +71,6 @@ public struct XmlItem: Codable, Hashable {
|
||||
self.prefixNsArray = prefixNsArray
|
||||
self.prefixNsWrappedArray = prefixNsWrappedArray
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case attributeString = "attribute_string"
|
||||
case attributeNumber = "attribute_number"
|
||||
@ -104,4 +103,41 @@ public struct XmlItem: Codable, Hashable {
|
||||
case prefixNsWrappedArray = "prefix_ns_wrapped_array"
|
||||
}
|
||||
|
||||
// Encodable protocol methods
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(attributeString, forKey: .attributeString)
|
||||
try container.encodeIfPresent(attributeNumber, forKey: .attributeNumber)
|
||||
try container.encodeIfPresent(attributeInteger, forKey: .attributeInteger)
|
||||
try container.encodeIfPresent(attributeBoolean, forKey: .attributeBoolean)
|
||||
try container.encodeIfPresent(wrappedArray, forKey: .wrappedArray)
|
||||
try container.encodeIfPresent(nameString, forKey: .nameString)
|
||||
try container.encodeIfPresent(nameNumber, forKey: .nameNumber)
|
||||
try container.encodeIfPresent(nameInteger, forKey: .nameInteger)
|
||||
try container.encodeIfPresent(nameBoolean, forKey: .nameBoolean)
|
||||
try container.encodeIfPresent(nameArray, forKey: .nameArray)
|
||||
try container.encodeIfPresent(nameWrappedArray, forKey: .nameWrappedArray)
|
||||
try container.encodeIfPresent(prefixString, forKey: .prefixString)
|
||||
try container.encodeIfPresent(prefixNumber, forKey: .prefixNumber)
|
||||
try container.encodeIfPresent(prefixInteger, forKey: .prefixInteger)
|
||||
try container.encodeIfPresent(prefixBoolean, forKey: .prefixBoolean)
|
||||
try container.encodeIfPresent(prefixArray, forKey: .prefixArray)
|
||||
try container.encodeIfPresent(prefixWrappedArray, forKey: .prefixWrappedArray)
|
||||
try container.encodeIfPresent(namespaceString, forKey: .namespaceString)
|
||||
try container.encodeIfPresent(namespaceNumber, forKey: .namespaceNumber)
|
||||
try container.encodeIfPresent(namespaceInteger, forKey: .namespaceInteger)
|
||||
try container.encodeIfPresent(namespaceBoolean, forKey: .namespaceBoolean)
|
||||
try container.encodeIfPresent(namespaceArray, forKey: .namespaceArray)
|
||||
try container.encodeIfPresent(namespaceWrappedArray, forKey: .namespaceWrappedArray)
|
||||
try container.encodeIfPresent(prefixNsString, forKey: .prefixNsString)
|
||||
try container.encodeIfPresent(prefixNsNumber, forKey: .prefixNsNumber)
|
||||
try container.encodeIfPresent(prefixNsInteger, forKey: .prefixNsInteger)
|
||||
try container.encodeIfPresent(prefixNsBoolean, forKey: .prefixNsBoolean)
|
||||
try container.encodeIfPresent(prefixNsArray, forKey: .prefixNsArray)
|
||||
try container.encodeIfPresent(prefixNsWrappedArray, forKey: .prefixNsWrappedArray)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user