[swift5][client] add option to generate or not the model additional properties (#9375)

* [swift5][client] add option to generate or not the models additional properties

* [swift5][client] update sample projects

* [swift5][client] format code

* [swift5][client] format code

* [swift5][client] format code

* [swift5][client] update docs
This commit is contained in:
Bruno Coelho 2021-05-15 08:46:32 +01:00 committed by GitHub
parent ecedd28e4e
commit e6a10ae350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
394 changed files with 434 additions and 1267 deletions

View File

@ -10,3 +10,4 @@ additionalProperties:
projectName: PetstoreClient
podHomepage: https://github.com/openapitools/openapi-generator
useBacktickEscapes: true
generateModelAdditionalProperties: false

View File

@ -11,6 +11,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|apiNamePrefix|Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet => Pet.| |null|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|generateModelAdditionalProperties|Generate model additional properties (default: true)| |true|
|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).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true|
|lenientTypeCast|Accept and cast values for simple types (string-&gt;bool, string-&gt;int, int-&gt;string)| |false|

View File

@ -64,6 +64,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
public static final String USE_SPM_FILE_STRUCTURE = "useSPMFileStructure";
public static final String SWIFT_PACKAGE_PATH = "swiftPackagePath";
public static final String USE_BACKTICK_ESCAPES = "useBacktickEscapes";
public static final String GENERATE_MODEL_ADDITIONAL_PROPERTIES = "generateModelAdditionalProperties";
protected static final String LIBRARY_ALAMOFIRE = "alamofire";
protected static final String LIBRARY_URLSESSION = "urlsession";
protected static final String RESPONSE_LIBRARY_PROMISE_KIT = "PromiseKit";
@ -80,6 +81,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
protected boolean useSPMFileStructure = false;
protected String swiftPackagePath = "Classes" + File.separator + "OpenAPIs";
protected boolean useBacktickEscapes = false;
protected boolean generateModelAdditionalProperties = true;
protected String[] responseAs = new String[0];
protected String sourceFolder = swiftPackagePath;
protected HashSet objcReservedWords;
@ -267,6 +269,9 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
cliOptions.add(new CliOption(USE_BACKTICK_ESCAPES,
"Escape reserved words using backticks (default: false)")
.defaultValue(Boolean.FALSE.toString()));
cliOptions.add(new CliOption(GENERATE_MODEL_ADDITIONAL_PROPERTIES,
"Generate model additional properties (default: true)")
.defaultValue(Boolean.TRUE.toString()));
cliOptions.add(new CliOption(CodegenConstants.API_NAME_PREFIX, CodegenConstants.API_NAME_PREFIX_DESC));
cliOptions.add(new CliOption(USE_SPM_FILE_STRUCTURE, "Use SPM file structure"
@ -448,6 +453,11 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
setUseBacktickEscapes(convertPropertyToBooleanAndWriteBack(USE_BACKTICK_ESCAPES));
}
if (additionalProperties.containsKey(GENERATE_MODEL_ADDITIONAL_PROPERTIES)) {
setGenerateModelAdditionalProperties(convertPropertyToBooleanAndWriteBack(GENERATE_MODEL_ADDITIONAL_PROPERTIES));
}
additionalProperties.put(GENERATE_MODEL_ADDITIONAL_PROPERTIES, generateModelAdditionalProperties);
setLenientTypeCast(convertPropertyToBooleanAndWriteBack(LENIENT_TYPE_CAST));
// make api and model doc path available in mustache template
@ -862,6 +872,10 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
this.useBacktickEscapes = useBacktickEscapes;
}
public void setGenerateModelAdditionalProperties(boolean generateModelAdditionalProperties) {
this.generateModelAdditionalProperties = generateModelAdditionalProperties;
}
@Override
public String toEnumValue(String value, String datatype) {
// for string, array of string

View File

@ -92,7 +92,7 @@ extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
return self.uuidString
}
}
}{{#generateModelAdditionalProperties}}
extension String: CodingKey {
@ -178,7 +178,7 @@ extension KeyedDecodingContainerProtocol {
return map
}
}
}{{/generateModelAdditionalProperties}}
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {

View File

@ -36,12 +36,13 @@
{{/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}}
}{{#generateModelAdditionalProperties}}{{#additionalPropertiesType}}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#readonlyProperties}}private(set) {{/readonlyProperties}}var additionalProperties: [String: {{{additionalPropertiesType}}}] = [:]
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} subscript(key: String) -> {{{additionalPropertiesType}}}? {
@ -55,8 +56,7 @@
set {
additionalProperties[key] = newValue
}
}
{{/additionalPropertiesType}}
}{{/additionalPropertiesType}}{{/generateModelAdditionalProperties}}
// Encodable protocol methods
@ -65,13 +65,14 @@
{{#allVars}}
try container.encode{{^required}}IfPresent{{/required}}({{{name}}}, forKey: .{{{name}}})
{{/allVars}}
{{#generateModelAdditionalProperties}}
{{#additionalPropertiesType}}
var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
try additionalPropertiesContainer.encodeMap(additionalProperties)
{{/additionalPropertiesType}}
}
{{/generateModelAdditionalProperties}}
}{{#generateModelAdditionalProperties}}{{#additionalPropertiesType}}
{{#additionalPropertiesType}}
// Decodable protocol methods
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}}{{#objcCompatible}} required{{/objcCompatible}} init(from decoder: Decoder) throws {
@ -85,22 +86,19 @@
nonAdditionalPropertyKeys.insert("{{{baseName}}}")
{{/allVars}}
additionalProperties = try container.decodeMap({{{additionalPropertiesType}}}.self, excludedKeys: nonAdditionalPropertyKeys)
}
{{/additionalPropertiesType}}
}{{/additionalPropertiesType}}{{/generateModelAdditionalProperties}}{{^objcCompatible}}{{#useClasses}}
{{^objcCompatible}}{{#useClasses}}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func == (lhs: {{classname}}, rhs: {{classname}}) -> Bool {
{{#allVars}}
lhs.{{{name}}} == rhs.{{{name}}}{{^-last}} &&{{/-last}}
{{/allVars}}
{{#additionalPropertiesType}}{{#hasVars}}&& {{/hasVars}}lhs.additionalProperties == rhs.additionalProperties{{/additionalPropertiesType}}
{{#generateModelAdditionalProperties}}{{#additionalPropertiesType}}{{#hasVars}}&& {{/hasVars}}lhs.additionalProperties == rhs.additionalProperties{{/additionalPropertiesType}}{{/generateModelAdditionalProperties}}
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func hash(into hasher: inout Hasher) {
{{#allVars}}
hasher.combine({{{name}}}{{^required}}?{{/required}}.hashValue)
{{/allVars}}
{{#additionalPropertiesType}}hasher.combine(additionalProperties.hashValue){{/additionalPropertiesType}}
}
{{/useClasses}}{{/objcCompatible}}
{{#generateModelAdditionalProperties}}{{#additionalPropertiesType}}hasher.combine(additionalProperties.hashValue){{/additionalPropertiesType}}{{/generateModelAdditionalProperties}}
}{{/useClasses}}{{/objcCompatible}}
}

View File

@ -47,6 +47,7 @@ public class Swift5OptionsProvider implements OptionsProvider {
public static final String READONLY_PROPERTIES_VALUE = "false";
public static final String SWIFT_USE_API_NAMESPACE_VALUE = "swiftUseApiNamespace";
public static final String USE_BACKTICKS_ESCAPES_VALUE = "false";
public static final String GENERATE_MODEL_ADDITIONAL_PROPERTIES_VALUE = "true";
public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false";
public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true";
public static final String LIBRARY_VALUE = "alamofire";
@ -91,6 +92,7 @@ public class Swift5OptionsProvider implements OptionsProvider {
.put(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, "true")
.put(Swift5ClientCodegen.USE_SPM_FILE_STRUCTURE, USE_SPM_FILE_STRUCTURE_VALUE)
.put(Swift5ClientCodegen.SWIFT_PACKAGE_PATH, SWIFT_PACKAGE_PATH_VALUE)
.put(Swift5ClientCodegen.GENERATE_MODEL_ADDITIONAL_PROPERTIES, GENERATE_MODEL_ADDITIONAL_PROPERTIES_VALUE)
.build();
}

View File

@ -48,5 +48,6 @@ public class Swift5OptionsTest extends AbstractOptionsTest {
verify(clientCodegen).setLenientTypeCast(Boolean.parseBoolean(Swift5OptionsProvider.LENIENT_TYPE_CAST_VALUE));
verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(Swift5OptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE));
verify(clientCodegen).setReadonlyProperties(Boolean.parseBoolean(Swift5OptionsProvider.READONLY_PROPERTIES_VALUE));
verify(clientCodegen).setGenerateModelAdditionalProperties(Boolean.parseBoolean(Swift5OptionsProvider.GENERATE_MODEL_ADDITIONAL_PROPERTIES_VALUE));
}
}

View File

@ -17,6 +17,7 @@ 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"
@ -29,7 +30,4 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
try container.encodeIfPresent(mapString, forKey: .mapString)
try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
}
}

View File

@ -17,6 +17,7 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case className
case color
@ -29,7 +30,4 @@ public struct Animal: Codable, Hashable {
try container.encode(className, forKey: .className)
try container.encodeIfPresent(color, forKey: .color)
}
}

View File

@ -19,6 +19,7 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case code
case type
@ -33,7 +34,4 @@ public struct ApiResponse: Codable, Hashable {
try container.encodeIfPresent(type, forKey: .type)
try container.encodeIfPresent(message, forKey: .message)
}
}

View File

@ -15,6 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
@ -25,7 +26,4 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
}
}

View File

@ -15,6 +15,7 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
@ -25,7 +26,4 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
}
}

View File

@ -19,6 +19,7 @@ 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"
@ -33,7 +34,4 @@ public struct ArrayTest: Codable, Hashable {
try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
}
}

View File

@ -26,6 +26,7 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@ -46,7 +47,4 @@ public struct Capitalization: Codable, Hashable {
try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
}
}

View File

@ -19,6 +19,7 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case className
case color
@ -33,7 +34,4 @@ public struct Cat: Codable, Hashable {
try container.encodeIfPresent(color, forKey: .color)
try container.encodeIfPresent(declawed, forKey: .declawed)
}
}

View File

@ -15,6 +15,7 @@ public struct CatAllOf: Codable, Hashable {
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case declawed
}
@ -25,7 +26,4 @@ public struct CatAllOf: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(declawed, forKey: .declawed)
}
}

View File

@ -17,6 +17,7 @@ public struct Category: Codable, Hashable {
self.id = id
self.name = name
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case id
case name
@ -29,7 +30,4 @@ public struct Category: Codable, Hashable {
try container.encodeIfPresent(id, forKey: .id)
try container.encode(name, forKey: .name)
}
}

View File

@ -16,6 +16,7 @@ public struct ClassModel: Codable, Hashable {
public init(_class: String? = nil) {
self._class = _class
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case _class
}
@ -26,7 +27,4 @@ public struct ClassModel: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(_class, forKey: ._class)
}
}

View File

@ -15,6 +15,7 @@ public struct Client: Codable, Hashable {
public init(client: String? = nil) {
self.client = client
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case client
}
@ -25,7 +26,4 @@ public struct Client: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(client, forKey: .client)
}
}

View File

@ -19,6 +19,7 @@ public struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case className
case color
@ -33,7 +34,4 @@ public struct Dog: Codable, Hashable {
try container.encodeIfPresent(color, forKey: .color)
try container.encodeIfPresent(breed, forKey: .breed)
}
}

View File

@ -15,6 +15,7 @@ public struct DogAllOf: Codable, Hashable {
public init(breed: String? = nil) {
self.breed = breed
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case breed
}
@ -25,7 +26,4 @@ public struct DogAllOf: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(breed, forKey: .breed)
}
}

View File

@ -25,6 +25,7 @@ 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"
@ -37,7 +38,4 @@ public struct EnumArrays: Codable, Hashable {
try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
}
}

View File

@ -41,6 +41,7 @@ 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"
@ -59,7 +60,4 @@ public struct EnumTest: Codable, Hashable {
try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
}
}

View File

@ -17,6 +17,7 @@ public struct File: Codable, Hashable {
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case sourceURI
}
@ -27,7 +28,4 @@ public struct File: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
}
}

View File

@ -17,6 +17,7 @@ public struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case file
case files
@ -29,7 +30,4 @@ public struct FileSchemaTestClass: Codable, Hashable {
try container.encodeIfPresent(file, forKey: .file)
try container.encodeIfPresent(files, forKey: .files)
}
}

View File

@ -39,6 +39,7 @@ public struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case integer
case int32
@ -73,7 +74,4 @@ public struct FormatTest: Codable, Hashable {
try container.encodeIfPresent(uuid, forKey: .uuid)
try container.encode(password, forKey: .password)
}
}

View File

@ -17,6 +17,7 @@ public struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case bar
case foo
@ -29,7 +30,4 @@ public struct HasOnlyReadOnly: Codable, Hashable {
try container.encodeIfPresent(bar, forKey: .bar)
try container.encodeIfPresent(foo, forKey: .foo)
}
}

View File

@ -15,6 +15,7 @@ public struct List: Codable, Hashable {
public init(_123list: String? = nil) {
self._123list = _123list
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
@ -25,7 +26,4 @@ public struct List: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(_123list, forKey: ._123list)
}
}

View File

@ -25,6 +25,7 @@ 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"
@ -41,7 +42,4 @@ public struct MapTest: Codable, Hashable {
try container.encodeIfPresent(directMap, forKey: .directMap)
try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
}
}

View File

@ -19,6 +19,7 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case uuid
case dateTime
@ -33,7 +34,4 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
try container.encodeIfPresent(dateTime, forKey: .dateTime)
try container.encodeIfPresent(map, forKey: .map)
}
}

View File

@ -18,6 +18,7 @@ public struct Model200Response: Codable, Hashable {
self.name = name
self._class = _class
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case _class = "class"
@ -30,7 +31,4 @@ public struct Model200Response: Codable, Hashable {
try container.encodeIfPresent(name, forKey: .name)
try container.encodeIfPresent(_class, forKey: ._class)
}
}

View File

@ -22,6 +22,7 @@ public struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@ -38,7 +39,4 @@ public struct Name: Codable, Hashable {
try container.encodeIfPresent(property, forKey: .property)
try container.encodeIfPresent(_123number, forKey: ._123number)
}
}

View File

@ -15,6 +15,7 @@ public struct NumberOnly: Codable, Hashable {
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
@ -25,7 +26,4 @@ public struct NumberOnly: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(justNumber, forKey: .justNumber)
}
}

View File

@ -31,6 +31,7 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case id
case petId
@ -51,7 +52,4 @@ public struct Order: Codable, Hashable {
try container.encodeIfPresent(status, forKey: .status)
try container.encodeIfPresent(complete, forKey: .complete)
}
}

View File

@ -19,6 +19,7 @@ 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"
@ -33,7 +34,4 @@ public struct OuterComposite: Codable, Hashable {
try container.encodeIfPresent(myString, forKey: .myString)
try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
}
}

View File

@ -31,6 +31,7 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case id
case category
@ -51,7 +52,4 @@ public struct Pet: Codable, Hashable {
try container.encodeIfPresent(tags, forKey: .tags)
try container.encodeIfPresent(status, forKey: .status)
}
}

View File

@ -17,6 +17,7 @@ public struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case bar
case baz
@ -29,7 +30,4 @@ public struct ReadOnlyFirst: Codable, Hashable {
try container.encodeIfPresent(bar, forKey: .bar)
try container.encodeIfPresent(baz, forKey: .baz)
}
}

View File

@ -16,6 +16,7 @@ public struct Return: Codable, Hashable {
public init(_return: Int? = nil) {
self._return = _return
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case _return = "return"
}
@ -26,7 +27,4 @@ public struct Return: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(_return, forKey: ._return)
}
}

View File

@ -15,6 +15,7 @@ public struct SpecialModelName: Codable, Hashable {
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
@ -25,7 +26,4 @@ public struct SpecialModelName: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
}
}

View File

@ -10,8 +10,10 @@ import AnyCodable
public struct StringBooleanMap: Codable, Hashable {
public enum CodingKeys: CodingKey, CaseIterable {
}
public var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@ -43,6 +45,4 @@ public struct StringBooleanMap: Codable, Hashable {
var nonAdditionalPropertyKeys = Set<String>()
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
}

View File

@ -17,6 +17,7 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case id
case name
@ -29,7 +30,4 @@ public struct Tag: Codable, Hashable {
try container.encodeIfPresent(id, forKey: .id)
try container.encodeIfPresent(name, forKey: .name)
}
}

View File

@ -23,6 +23,7 @@ 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"
@ -41,7 +42,4 @@ public struct TypeHolderDefault: Codable, Hashable {
try container.encode(boolItem, forKey: .boolItem)
try container.encode(arrayItem, forKey: .arrayItem)
}
}

View File

@ -23,6 +23,7 @@ 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"
@ -41,7 +42,4 @@ public struct TypeHolderExample: Codable, Hashable {
try container.encode(boolItem, forKey: .boolItem)
try container.encode(arrayItem, forKey: .arrayItem)
}
}

View File

@ -30,6 +30,7 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case id
case username
@ -54,7 +55,4 @@ public struct User: Codable, Hashable {
try container.encodeIfPresent(phone, forKey: .phone)
try container.encodeIfPresent(userStatus, forKey: .userStatus)
}
}

View File

@ -17,6 +17,7 @@ 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"
@ -29,7 +30,4 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
try container.encodeIfPresent(mapString, forKey: .mapString)
try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
}
}

View File

@ -17,6 +17,7 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case className
case color
@ -29,7 +30,4 @@ public struct Animal: Codable, Hashable {
try container.encode(className, forKey: .className)
try container.encodeIfPresent(color, forKey: .color)
}
}

View File

@ -19,6 +19,7 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case code
case type
@ -33,7 +34,4 @@ public struct ApiResponse: Codable, Hashable {
try container.encodeIfPresent(type, forKey: .type)
try container.encodeIfPresent(message, forKey: .message)
}
}

View File

@ -15,6 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
@ -25,7 +26,4 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
}
}

View File

@ -15,6 +15,7 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
@ -25,7 +26,4 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
}
}

View File

@ -19,6 +19,7 @@ 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"
@ -33,7 +34,4 @@ public struct ArrayTest: Codable, Hashable {
try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
}
}

View File

@ -26,6 +26,7 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@ -46,7 +47,4 @@ public struct Capitalization: Codable, Hashable {
try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
}
}

View File

@ -19,6 +19,7 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case className
case color
@ -33,7 +34,4 @@ public struct Cat: Codable, Hashable {
try container.encodeIfPresent(color, forKey: .color)
try container.encodeIfPresent(declawed, forKey: .declawed)
}
}

View File

@ -15,6 +15,7 @@ public struct CatAllOf: Codable, Hashable {
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case declawed
}
@ -25,7 +26,4 @@ public struct CatAllOf: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(declawed, forKey: .declawed)
}
}

View File

@ -17,6 +17,7 @@ public struct Category: Codable, Hashable {
self.id = id
self.name = name
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case id
case name
@ -29,7 +30,4 @@ public struct Category: Codable, Hashable {
try container.encodeIfPresent(id, forKey: .id)
try container.encode(name, forKey: .name)
}
}

View File

@ -16,6 +16,7 @@ public struct ClassModel: Codable, Hashable {
public init(_class: String? = nil) {
self._class = _class
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case _class
}
@ -26,7 +27,4 @@ public struct ClassModel: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(_class, forKey: ._class)
}
}

View File

@ -15,6 +15,7 @@ public struct Client: Codable, Hashable {
public init(client: String? = nil) {
self.client = client
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case client
}
@ -25,7 +26,4 @@ public struct Client: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(client, forKey: .client)
}
}

View File

@ -19,6 +19,7 @@ public struct Dog: Codable, Hashable {
self.color = color
self.breed = breed
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case className
case color
@ -33,7 +34,4 @@ public struct Dog: Codable, Hashable {
try container.encodeIfPresent(color, forKey: .color)
try container.encodeIfPresent(breed, forKey: .breed)
}
}

View File

@ -15,6 +15,7 @@ public struct DogAllOf: Codable, Hashable {
public init(breed: String? = nil) {
self.breed = breed
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case breed
}
@ -25,7 +26,4 @@ public struct DogAllOf: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(breed, forKey: .breed)
}
}

View File

@ -25,6 +25,7 @@ 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"
@ -37,7 +38,4 @@ public struct EnumArrays: Codable, Hashable {
try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
}
}

View File

@ -41,6 +41,7 @@ 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"
@ -59,7 +60,4 @@ public struct EnumTest: Codable, Hashable {
try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
}
}

View File

@ -17,6 +17,7 @@ public struct File: Codable, Hashable {
public init(sourceURI: String? = nil) {
self.sourceURI = sourceURI
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case sourceURI
}
@ -27,7 +28,4 @@ public struct File: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
}
}

View File

@ -17,6 +17,7 @@ public struct FileSchemaTestClass: Codable, Hashable {
self.file = file
self.files = files
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case file
case files
@ -29,7 +30,4 @@ public struct FileSchemaTestClass: Codable, Hashable {
try container.encodeIfPresent(file, forKey: .file)
try container.encodeIfPresent(files, forKey: .files)
}
}

View File

@ -39,6 +39,7 @@ public struct FormatTest: Codable, Hashable {
self.uuid = uuid
self.password = password
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case integer
case int32
@ -73,7 +74,4 @@ public struct FormatTest: Codable, Hashable {
try container.encodeIfPresent(uuid, forKey: .uuid)
try container.encode(password, forKey: .password)
}
}

View File

@ -17,6 +17,7 @@ public struct HasOnlyReadOnly: Codable, Hashable {
self.bar = bar
self.foo = foo
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case bar
case foo
@ -29,7 +30,4 @@ public struct HasOnlyReadOnly: Codable, Hashable {
try container.encodeIfPresent(bar, forKey: .bar)
try container.encodeIfPresent(foo, forKey: .foo)
}
}

View File

@ -15,6 +15,7 @@ public struct List: Codable, Hashable {
public init(_123list: String? = nil) {
self._123list = _123list
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case _123list = "123-list"
}
@ -25,7 +26,4 @@ public struct List: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(_123list, forKey: ._123list)
}
}

View File

@ -25,6 +25,7 @@ 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"
@ -41,7 +42,4 @@ public struct MapTest: Codable, Hashable {
try container.encodeIfPresent(directMap, forKey: .directMap)
try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
}
}

View File

@ -19,6 +19,7 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
self.dateTime = dateTime
self.map = map
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case uuid
case dateTime
@ -33,7 +34,4 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
try container.encodeIfPresent(dateTime, forKey: .dateTime)
try container.encodeIfPresent(map, forKey: .map)
}
}

View File

@ -18,6 +18,7 @@ public struct Model200Response: Codable, Hashable {
self.name = name
self._class = _class
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case _class = "class"
@ -30,7 +31,4 @@ public struct Model200Response: Codable, Hashable {
try container.encodeIfPresent(name, forKey: .name)
try container.encodeIfPresent(_class, forKey: ._class)
}
}

View File

@ -22,6 +22,7 @@ public struct Name: Codable, Hashable {
self.property = property
self._123number = _123number
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case name
case snakeCase = "snake_case"
@ -38,7 +39,4 @@ public struct Name: Codable, Hashable {
try container.encodeIfPresent(property, forKey: .property)
try container.encodeIfPresent(_123number, forKey: ._123number)
}
}

View File

@ -15,6 +15,7 @@ public struct NumberOnly: Codable, Hashable {
public init(justNumber: Double? = nil) {
self.justNumber = justNumber
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case justNumber = "JustNumber"
}
@ -25,7 +26,4 @@ public struct NumberOnly: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(justNumber, forKey: .justNumber)
}
}

View File

@ -31,6 +31,7 @@ public struct Order: Codable, Hashable {
self.status = status
self.complete = complete
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case id
case petId
@ -51,7 +52,4 @@ public struct Order: Codable, Hashable {
try container.encodeIfPresent(status, forKey: .status)
try container.encodeIfPresent(complete, forKey: .complete)
}
}

View File

@ -19,6 +19,7 @@ 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"
@ -33,7 +34,4 @@ public struct OuterComposite: Codable, Hashable {
try container.encodeIfPresent(myString, forKey: .myString)
try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
}
}

View File

@ -31,6 +31,7 @@ public struct Pet: Codable, Hashable {
self.tags = tags
self.status = status
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case id
case category
@ -51,7 +52,4 @@ public struct Pet: Codable, Hashable {
try container.encodeIfPresent(tags, forKey: .tags)
try container.encodeIfPresent(status, forKey: .status)
}
}

View File

@ -17,6 +17,7 @@ public struct ReadOnlyFirst: Codable, Hashable {
self.bar = bar
self.baz = baz
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case bar
case baz
@ -29,7 +30,4 @@ public struct ReadOnlyFirst: Codable, Hashable {
try container.encodeIfPresent(bar, forKey: .bar)
try container.encodeIfPresent(baz, forKey: .baz)
}
}

View File

@ -16,6 +16,7 @@ public struct Return: Codable, Hashable {
public init(_return: Int? = nil) {
self._return = _return
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case _return = "return"
}
@ -26,7 +27,4 @@ public struct Return: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(_return, forKey: ._return)
}
}

View File

@ -15,6 +15,7 @@ public struct SpecialModelName: Codable, Hashable {
public init(specialPropertyName: Int64? = nil) {
self.specialPropertyName = specialPropertyName
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case specialPropertyName = "$special[property.name]"
}
@ -25,7 +26,4 @@ public struct SpecialModelName: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
}
}

View File

@ -10,8 +10,10 @@ import AnyCodable
public struct StringBooleanMap: Codable, Hashable {
public enum CodingKeys: CodingKey, CaseIterable {
}
public var additionalProperties: [String: Bool] = [:]
public subscript(key: String) -> Bool? {
@ -43,6 +45,4 @@ public struct StringBooleanMap: Codable, Hashable {
var nonAdditionalPropertyKeys = Set<String>()
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
}

View File

@ -17,6 +17,7 @@ public struct Tag: Codable, Hashable {
self.id = id
self.name = name
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case id
case name
@ -29,7 +30,4 @@ public struct Tag: Codable, Hashable {
try container.encodeIfPresent(id, forKey: .id)
try container.encodeIfPresent(name, forKey: .name)
}
}

View File

@ -23,6 +23,7 @@ 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"
@ -41,7 +42,4 @@ public struct TypeHolderDefault: Codable, Hashable {
try container.encode(boolItem, forKey: .boolItem)
try container.encode(arrayItem, forKey: .arrayItem)
}
}

View File

@ -23,6 +23,7 @@ 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"
@ -41,7 +42,4 @@ public struct TypeHolderExample: Codable, Hashable {
try container.encode(boolItem, forKey: .boolItem)
try container.encode(arrayItem, forKey: .arrayItem)
}
}

View File

@ -30,6 +30,7 @@ public struct User: Codable, Hashable {
self.phone = phone
self.userStatus = userStatus
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case id
case username
@ -54,7 +55,4 @@ public struct User: Codable, Hashable {
try container.encodeIfPresent(phone, forKey: .phone)
try container.encodeIfPresent(userStatus, forKey: .userStatus)
}
}

View File

@ -15,9 +15,11 @@ 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? {
@ -52,6 +54,4 @@ public struct AdditionalPropertiesAnyType: Codable, Hashable {
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(AnyCodable.self, excludedKeys: nonAdditionalPropertyKeys)
}
}

View File

@ -15,9 +15,11 @@ 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]? {
@ -52,6 +54,4 @@ public struct AdditionalPropertiesArray: Codable, Hashable {
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap([AnyCodable].self, excludedKeys: nonAdditionalPropertyKeys)
}
}

View File

@ -15,9 +15,11 @@ 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? {
@ -52,6 +54,4 @@ public struct AdditionalPropertiesBoolean: Codable, Hashable {
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
}

View File

@ -35,6 +35,7 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
self.anytype2 = anytype2
self.anytype3 = anytype3
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case mapString = "map_string"
case mapNumber = "map_number"
@ -65,7 +66,4 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
try container.encodeIfPresent(anytype2, forKey: .anytype2)
try container.encodeIfPresent(anytype3, forKey: .anytype3)
}
}

View File

@ -15,9 +15,11 @@ 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? {
@ -52,6 +54,4 @@ public struct AdditionalPropertiesInteger: Codable, Hashable {
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Int.self, excludedKeys: nonAdditionalPropertyKeys)
}
}

View File

@ -15,9 +15,11 @@ 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? {
@ -52,6 +54,4 @@ public struct AdditionalPropertiesNumber: Codable, Hashable {
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Double.self, excludedKeys: nonAdditionalPropertyKeys)
}
}

View File

@ -15,9 +15,11 @@ 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]? {
@ -52,6 +54,4 @@ public struct AdditionalPropertiesObject: Codable, Hashable {
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap([String: AnyCodable].self, excludedKeys: nonAdditionalPropertyKeys)
}
}

View File

@ -15,9 +15,11 @@ 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? {
@ -52,6 +54,4 @@ public struct AdditionalPropertiesString: Codable, Hashable {
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(String.self, excludedKeys: nonAdditionalPropertyKeys)
}
}

View File

@ -17,6 +17,7 @@ public struct Animal: Codable, Hashable {
self.className = className
self.color = color
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case className
case color
@ -29,7 +30,4 @@ public struct Animal: Codable, Hashable {
try container.encode(className, forKey: .className)
try container.encodeIfPresent(color, forKey: .color)
}
}

View File

@ -19,6 +19,7 @@ public struct ApiResponse: Codable, Hashable {
self.type = type
self.message = message
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case code
case type
@ -33,7 +34,4 @@ public struct ApiResponse: Codable, Hashable {
try container.encodeIfPresent(type, forKey: .type)
try container.encodeIfPresent(message, forKey: .message)
}
}

View File

@ -15,6 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public init(arrayArrayNumber: [[Double]]? = nil) {
self.arrayArrayNumber = arrayArrayNumber
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayArrayNumber = "ArrayArrayNumber"
}
@ -25,7 +26,4 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
}
}

View File

@ -15,6 +15,7 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
public init(arrayNumber: [Double]? = nil) {
self.arrayNumber = arrayNumber
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case arrayNumber = "ArrayNumber"
}
@ -25,7 +26,4 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
}
}

View File

@ -19,6 +19,7 @@ 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"
@ -33,7 +34,4 @@ public struct ArrayTest: Codable, Hashable {
try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
}
}

View File

@ -21,6 +21,7 @@ public struct BigCat: Codable, Hashable {
public init(kind: Kind? = nil) {
self.kind = kind
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case kind
}
@ -31,7 +32,4 @@ public struct BigCat: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(kind, forKey: .kind)
}
}

View File

@ -21,6 +21,7 @@ public struct BigCatAllOf: Codable, Hashable {
public init(kind: Kind? = nil) {
self.kind = kind
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case kind
}
@ -31,7 +32,4 @@ public struct BigCatAllOf: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(kind, forKey: .kind)
}
}

View File

@ -26,6 +26,7 @@ public struct Capitalization: Codable, Hashable {
self.sCAETHFlowPoints = sCAETHFlowPoints
self.ATT_NAME = ATT_NAME
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case smallCamel
case capitalCamel = "CapitalCamel"
@ -46,7 +47,4 @@ public struct Capitalization: Codable, Hashable {
try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
}
}

View File

@ -19,6 +19,7 @@ public struct Cat: Codable, Hashable {
self.color = color
self.declawed = declawed
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case className
case color
@ -33,7 +34,4 @@ public struct Cat: Codable, Hashable {
try container.encodeIfPresent(color, forKey: .color)
try container.encodeIfPresent(declawed, forKey: .declawed)
}
}

View File

@ -15,6 +15,7 @@ public struct CatAllOf: Codable, Hashable {
public init(declawed: Bool? = nil) {
self.declawed = declawed
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case declawed
}
@ -25,7 +26,4 @@ public struct CatAllOf: Codable, Hashable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(declawed, forKey: .declawed)
}
}

View File

@ -17,6 +17,7 @@ public struct Category: Codable, Hashable {
self.id = id
self.name = name
}
public enum CodingKeys: String, CodingKey, CaseIterable {
case id
case name
@ -29,7 +30,4 @@ public struct Category: Codable, Hashable {
try container.encodeIfPresent(id, forKey: .id)
try container.encode(name, forKey: .name)
}
}

Some files were not shown because too many files have changed in this diff Show More