From de1566c7c3b4fa334fb0175253aa4e423ddbc184 Mon Sep 17 00:00:00 2001 From: Bernie Schelberg Date: Tue, 25 Oct 2022 20:35:40 +1000 Subject: [PATCH 1/6] fix #13150 Do not add schema / class name mapping where custom mapping exists --- .../openapitools/codegen/DefaultCodegen.java | 19 +++--- .../codegen/DefaultCodegenTest.java | 5 -- .../java/spring/SpringCodegenTest.java | 38 ++++++++++++ .../src/test/resources/bugs/issue_13150.yaml | 60 +++++++++++++++++++ 4 files changed, 108 insertions(+), 14 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/bugs/issue_13150.yaml diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index e9579cd82223..a4bb2b597c7c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -3361,15 +3361,15 @@ protected List getAllOfDescendants(String thisSchemaName, OpenAPI o break; } currentSchemaName = queue.remove(0); - MappedModel mm = new MappedModel(currentSchemaName, toModelName(currentSchemaName)); - descendentSchemas.add(mm); Schema cs = schemas.get(currentSchemaName); Map vendorExtensions = cs.getExtensions(); - if (vendorExtensions != null && !vendorExtensions.isEmpty() && vendorExtensions.containsKey("x-discriminator-value")) { - String xDiscriminatorValue = (String) vendorExtensions.get("x-discriminator-value"); - mm = new MappedModel(xDiscriminatorValue, toModelName(currentSchemaName)); - descendentSchemas.add(mm); - } + String mappingName = + Optional.ofNullable(vendorExtensions) + .map(ve -> ve.get("x-discriminator-value")) + .map(discriminatorValue -> (String) discriminatorValue) + .orElse(currentSchemaName); + MappedModel mm = new MappedModel(mappingName, toModelName(currentSchemaName)); + descendentSchemas.add(mm); } return descendentSchemas; } @@ -3419,10 +3419,11 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch // for schemas that allOf inherit from this schema, add those descendants to this discriminator map List otherDescendants = getAllOfDescendants(schemaName, openAPI); for (MappedModel otherDescendant : otherDescendants) { - // add only if the mapping names are not the same + // add only if the mapping names are not the same and the model names are not the same boolean matched = false; for (MappedModel uniqueDescendant : uniqueDescendants) { - if (uniqueDescendant.getMappingName().equals(otherDescendant.getMappingName())) { + if (uniqueDescendant.getMappingName().equals(otherDescendant.getMappingName()) + || (uniqueDescendant.getModelName().equals(otherDescendant.getModelName()))) { matched = true; break; } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index cfdc60aa0aa5..2bfcf9acb481 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -1100,7 +1100,6 @@ public void testComposedSchemaAllOfDiscriminatorMap() { cm = codegen.fromModel(modelName, sc); hs.clear(); hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"))); - hs.add(new CodegenDiscriminator.MappedModel("B", codegen.toModelName("B"))); hs.add(new CodegenDiscriminator.MappedModel("C", codegen.toModelName("C"))); Assert.assertEquals(cm.getHasDiscriminatorWithNonEmptyMapping(), true); Assert.assertEquals(cm.discriminator.getMappedModels(), hs); @@ -1584,8 +1583,6 @@ public void verifyXDiscriminatorValue() { discriminator.setPropertyBaseName(prop); discriminator.setMapping(null); discriminator.setMappedModels(new HashSet() {{ - add(new CodegenDiscriminator.MappedModel("DailySubObj", "DailySubObj")); - add(new CodegenDiscriminator.MappedModel("SubObj", "SubObj")); add(new CodegenDiscriminator.MappedModel("daily", "DailySubObj")); add(new CodegenDiscriminator.MappedModel("sub-obj", "SubObj")); }}); @@ -1991,8 +1988,6 @@ private void verifyPersonDiscriminator(CodegenDiscriminator discriminator) { test.getMapping().put("c", "Child"); test.getMappedModels().add(new CodegenDiscriminator.MappedModel("a", "Adult")); test.getMappedModels().add(new CodegenDiscriminator.MappedModel("c", "Child")); - test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Adult", "Adult")); - test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Child", "Child")); Assert.assertEquals(discriminator, test); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index ac1f12a3eb0f..79fac0c70481 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -1079,6 +1079,44 @@ public void testOneOfAndAllOf() throws IOException { assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/PizzaSpeziale.java"), "import java.math.BigDecimal"); } + @Test + public void testMappingSubtypesIssue13150() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + String outputPath = output.getAbsolutePath().replace('\\', '/'); + OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/bugs/issue_13150.yaml", null, new ParseOptions()).getOpenAPI(); + + SpringCodegen codegen = new SpringCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.setUseOneOfInterfaces(true); + + ClientOptInput input = new ClientOptInput(); + input.openAPI(openAPI); + input.config(codegen); + + DefaultGenerator generator = new DefaultGenerator(); + codegen.setHateoas(true); + generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true"); + generator.setGeneratorPropertyDefault(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "false"); + + codegen.setUseOneOfInterfaces(true); + codegen.setLegacyDiscriminatorBehavior(false); + + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true"); + generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false"); + + generator.opts(input).generate(); + + String jsonSubType = "@JsonSubTypes({\n" + + " @JsonSubTypes.Type(value = Foo.class, name = \"foo\")\n" + + "})"; + assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/Parent.java"), jsonSubType); + } + @Test public void testTypeMappings() { final SpringCodegen codegen = new SpringCodegen(); diff --git a/modules/openapi-generator/src/test/resources/bugs/issue_13150.yaml b/modules/openapi-generator/src/test/resources/bugs/issue_13150.yaml new file mode 100644 index 000000000000..07ee407b37e7 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/bugs/issue_13150.yaml @@ -0,0 +1,60 @@ +openapi: '3.0.0' +info: + version: '1.0.0' + title: 'FooService' +paths: + /parent: + put: + summary: put parent + operationId: putParent + parameters: + - name: name + in: path + required: true + description: Name of the account being updated. + schema: + type: string + requestBody: + description: The updated account definition to save. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Parent' + responses: + '200': + $ref: '#/components/responses/Parent' +components: + schemas: + Parent: + type: object + description: Defines an account by name. + properties: + name: + type: string + description: The account name. + type: + type: string + description: The account type discriminator. + required: + - name + - type + discriminator: + propertyName: type + mapping: + foo: '#/components/schemas/Foo' + + Foo: + allOf: + - $ref: "#/components/schemas/Parent" + - type: object + properties: + fooType: + type: string + responses: + Parent: + description: The saved account definition. + content: + application/json: + schema: + $ref: '#/components/schemas/Parent' \ No newline at end of file From 2bf0ea2379ce5d9e33d1deeba413d3a3a9909caf Mon Sep 17 00:00:00 2001 From: Bernie Schelberg Date: Tue, 25 Oct 2022 20:51:09 +1000 Subject: [PATCH 2/6] Fix Ruby tests --- .../org/openapitools/codegen/ruby/RubyClientCodegenTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java index 08bc443e3347..cfc625900d23 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java @@ -388,8 +388,6 @@ public void allOfTest() { Set mappedModels = new LinkedHashSet(); mappedModels.add(new CodegenDiscriminator.MappedModel("a", "Adult")); mappedModels.add(new CodegenDiscriminator.MappedModel("c", "Child")); - mappedModels.add(new CodegenDiscriminator.MappedModel("Adult", "Adult")); - mappedModels.add(new CodegenDiscriminator.MappedModel("Child", "Child")); Assert.assertEquals(codegenDiscriminator.getMappedModels(), mappedModels); } From 457123199a64ac166f1aba5cc4923822880691c6 Mon Sep 17 00:00:00 2001 From: Bernie Schelberg Date: Fri, 17 Feb 2023 13:37:21 +1000 Subject: [PATCH 3/6] Add Java example --- ...ith-fake-endpoints-models-for-testing.yaml | 9 ++-- .../java-helidon-client/mp/docs/Animal.md | 2 +- .../org/openapitools/client/model/Animal.java | 22 ++++----- .../org/openapitools/client/model/Cat.java | 2 + .../org/openapitools/client/model/Dog.java | 2 + .../java-helidon-client/se/docs/Animal.md | 2 +- .../org/openapitools/client/model/Animal.java | 22 ++++----- .../org/openapitools/client/model/Cat.java | 2 + .../org/openapitools/client/model/Dog.java | 2 + .../java/apache-httpclient/api/openapi.yaml | 9 ++-- .../java/apache-httpclient/docs/Animal.md | 2 +- .../org/openapitools/client/model/Animal.java | 48 +++++++++---------- .../org/openapitools/client/model/Cat.java | 18 ++++--- .../org/openapitools/client/model/Dog.java | 18 ++++--- .../petstore/java/feign/api/openapi.yaml | 9 ++-- .../org/openapitools/client/model/Animal.java | 42 ++++++++-------- .../org/openapitools/client/model/Cat.java | 12 +++-- .../org/openapitools/client/model/Dog.java | 12 +++-- .../java/webclient-jakarta/api/openapi.yaml | 9 ++-- .../java/webclient-jakarta/docs/Animal.md | 2 +- .../org/openapitools/client/model/Animal.java | 42 ++++++++-------- .../org/openapitools/client/model/Cat.java | 12 +++-- .../org/openapitools/client/model/Dog.java | 12 +++-- .../petstore/java/webclient/api/openapi.yaml | 9 ++-- .../petstore/java/webclient/docs/Animal.md | 2 +- .../org/openapitools/client/model/Animal.java | 42 ++++++++-------- .../org/openapitools/client/model/Cat.java | 12 +++-- .../org/openapitools/client/model/Dog.java | 12 +++-- .../org/openapitools/server/model/Animal.java | 22 ++++----- .../org/openapitools/server/model/Cat.java | 2 + .../org/openapitools/server/model/Dog.java | 2 + .../src/main/resources/META-INF/openapi.yml | 9 ++-- .../org/openapitools/server/model/Animal.java | 22 ++++----- .../org/openapitools/server/model/Cat.java | 2 + .../org/openapitools/server/model/Dog.java | 2 + .../src/main/resources/META-INF/openapi.yml | 9 ++-- 36 files changed, 272 insertions(+), 187 deletions(-) diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml index 6ec5b66e0e65..0e2775584a05 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1483,11 +1483,14 @@ components: Animal: type: object discriminator: - propertyName: className + propertyName: type + mapping: + DOG: '#/components/schemas/Dog' + CAT: '#/components/schemas/Cat' required: - - className + - type properties: - className: + type: type: string color: type: string diff --git a/samples/client/petstore/java-helidon-client/mp/docs/Animal.md b/samples/client/petstore/java-helidon-client/mp/docs/Animal.md index d9b32f14c88a..82a9be30cc3d 100644 --- a/samples/client/petstore/java-helidon-client/mp/docs/Animal.md +++ b/samples/client/petstore/java-helidon-client/mp/docs/Animal.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**className** | **String** | | | +|**type** | **String** | | | |**color** | **String** | | [optional] | diff --git a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Animal.java index 36ecf9c54f65..389ec85d289c 100644 --- a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Animal.java @@ -28,27 +28,27 @@ public class Animal { - private String className; + private String type; private String color = "red"; /** - * Get className - * @return className + * Get type + * @return type **/ - public String getClassName() { - return className; + public String getType() { + return type; } /** - * Set className + * Set type **/ - public void setClassName(String className) { - this.className = className; + public void setType(String type) { + this.type = type; } - public Animal className(String className) { - this.className = className; + public Animal type(String type) { + this.type = type; return this; } @@ -81,7 +81,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Cat.java index be9c69545616..d7e6bc70bf91 100644 --- a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Cat.java @@ -21,6 +21,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; diff --git a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Dog.java index 069dab8392d5..b4cd5a234a92 100644 --- a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Dog.java @@ -21,6 +21,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; diff --git a/samples/client/petstore/java-helidon-client/se/docs/Animal.md b/samples/client/petstore/java-helidon-client/se/docs/Animal.md index d9b32f14c88a..82a9be30cc3d 100644 --- a/samples/client/petstore/java-helidon-client/se/docs/Animal.md +++ b/samples/client/petstore/java-helidon-client/se/docs/Animal.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**className** | **String** | | | +|**type** | **String** | | | |**color** | **String** | | [optional] | diff --git a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Animal.java index 36ecf9c54f65..389ec85d289c 100644 --- a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Animal.java @@ -28,27 +28,27 @@ public class Animal { - private String className; + private String type; private String color = "red"; /** - * Get className - * @return className + * Get type + * @return type **/ - public String getClassName() { - return className; + public String getType() { + return type; } /** - * Set className + * Set type **/ - public void setClassName(String className) { - this.className = className; + public void setType(String type) { + this.type = type; } - public Animal className(String className) { - this.className = className; + public Animal type(String type) { + this.type = type; return this; } @@ -81,7 +81,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Cat.java index be9c69545616..d7e6bc70bf91 100644 --- a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Cat.java @@ -21,6 +21,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; diff --git a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Dog.java index 069dab8392d5..b4cd5a234a92 100644 --- a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Dog.java @@ -21,6 +21,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; diff --git a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml index 2828944e5542..65837c687775 100644 --- a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml +++ b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml @@ -1507,15 +1507,18 @@ components: - $ref: '#/components/schemas/Cat_allOf' Animal: discriminator: - propertyName: className + mapping: + DOG: '#/components/schemas/Dog' + CAT: '#/components/schemas/Cat' + propertyName: type properties: - className: + type: type: string color: default: red type: string required: - - className + - type type: object AnimalFarm: items: diff --git a/samples/client/petstore/java/apache-httpclient/docs/Animal.md b/samples/client/petstore/java/apache-httpclient/docs/Animal.md index d9b32f14c88a..82a9be30cc3d 100644 --- a/samples/client/petstore/java/apache-httpclient/docs/Animal.md +++ b/samples/client/petstore/java/apache-httpclient/docs/Animal.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**className** | **String** | | | +|**type** | **String** | | | |**color** | **String** | | [optional] | diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Animal.java index 1d37baf0f8c4..ee4e8e68c8e4 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Animal.java @@ -35,23 +35,23 @@ * Animal */ @JsonPropertyOrder({ - Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_TYPE, Animal.JSON_PROPERTY_COLOR }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = Cat.class, name = "Cat"), - @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), }) public class Animal { - public static final String JSON_PROPERTY_CLASS_NAME = "className"; - protected String className; + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; @@ -59,29 +59,29 @@ public class Animal { public Animal() { } - public Animal className(String className) { + public Animal type(String type) { - this.className = className; + this.type = type; return this; } /** - * Get className - * @return className + * Get type + * @return type **/ @javax.annotation.Nonnull - @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getClassName() { - return className; + public String getType() { + return type; } - @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setClassName(String className) { - this.className = className; + public void setType(String type) { + this.type = type; } @@ -120,20 +120,20 @@ public boolean equals(Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.className, animal.className) && + return Objects.equals(this.type, animal.type) && Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return Objects.hash(className, color); + return Objects.hash(type, color); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); @@ -182,10 +182,10 @@ public String toUrlQueryString(String prefix) { StringJoiner joiner = new StringJoiner("&"); - // add `className` to the URL query string - if (getClassName() != null) { + // add `type` to the URL query string + if (getType() != null) { try { - joiner.add(String.format("%sclassName%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClassName()), "UTF-8").replaceAll("\\+", "%20"))); + joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), "UTF-8").replaceAll("\\+", "%20"))); } catch (UnsupportedEncodingException e) { // Should never happen, UTF-8 is always supported throw new RuntimeException(e); diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Cat.java index b3ab6517bc0e..d89ac95ab28d 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Cat.java @@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; import java.io.UnsupportedEncodingException; @@ -38,10 +40,14 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) public class Cat extends Animal { public static final String JSON_PROPERTY_DECLAWED = "declawed"; @@ -148,10 +154,10 @@ public String toUrlQueryString(String prefix) { StringJoiner joiner = new StringJoiner("&"); - // add `className` to the URL query string - if (getClassName() != null) { + // add `type` to the URL query string + if (getType() != null) { try { - joiner.add(String.format("%sclassName%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClassName()), "UTF-8").replaceAll("\\+", "%20"))); + joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), "UTF-8").replaceAll("\\+", "%20"))); } catch (UnsupportedEncodingException e) { // Should never happen, UTF-8 is always supported throw new RuntimeException(e); diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Dog.java index 055a293ec286..5aa266f638c2 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Dog.java @@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; import java.io.UnsupportedEncodingException; @@ -38,10 +40,14 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) public class Dog extends Animal { public static final String JSON_PROPERTY_BREED = "breed"; @@ -148,10 +154,10 @@ public String toUrlQueryString(String prefix) { StringJoiner joiner = new StringJoiner("&"); - // add `className` to the URL query string - if (getClassName() != null) { + // add `type` to the URL query string + if (getType() != null) { try { - joiner.add(String.format("%sclassName%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClassName()), "UTF-8").replaceAll("\\+", "%20"))); + joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), "UTF-8").replaceAll("\\+", "%20"))); } catch (UnsupportedEncodingException e) { // Should never happen, UTF-8 is always supported throw new RuntimeException(e); diff --git a/samples/client/petstore/java/feign/api/openapi.yaml b/samples/client/petstore/java/feign/api/openapi.yaml index 2828944e5542..65837c687775 100644 --- a/samples/client/petstore/java/feign/api/openapi.yaml +++ b/samples/client/petstore/java/feign/api/openapi.yaml @@ -1507,15 +1507,18 @@ components: - $ref: '#/components/schemas/Cat_allOf' Animal: discriminator: - propertyName: className + mapping: + DOG: '#/components/schemas/Dog' + CAT: '#/components/schemas/Cat' + propertyName: type properties: - className: + type: type: string color: default: red type: string required: - - className + - type type: object AnimalFarm: items: diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java index 31932c6e6815..3bd908e49068 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java @@ -32,23 +32,23 @@ * Animal */ @JsonPropertyOrder({ - Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_TYPE, Animal.JSON_PROPERTY_COLOR }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = Cat.class, name = "Cat"), - @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), }) public class Animal { - public static final String JSON_PROPERTY_CLASS_NAME = "className"; - protected String className; + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; @@ -56,29 +56,29 @@ public class Animal { public Animal() { } - public Animal className(String className) { + public Animal type(String type) { - this.className = className; + this.type = type; return this; } /** - * Get className - * @return className + * Get type + * @return type **/ @javax.annotation.Nonnull - @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getClassName() { - return className; + public String getType() { + return type; } - @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setClassName(String className) { - this.className = className; + public void setType(String type) { + this.type = type; } @@ -117,20 +117,20 @@ public boolean equals(Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.className, animal.className) && + return Objects.equals(this.type, animal.type) && Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return Objects.hash(className, color); + return Objects.hash(type, color); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java index 98b53f1e4fd5..054eb8bf2d16 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java @@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -35,10 +37,14 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) public class Cat extends Animal { public static final String JSON_PROPERTY_DECLAWED = "declawed"; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java index 5de0e902a040..7cbfcccc75ea 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java @@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -35,10 +37,14 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) public class Dog extends Animal { public static final String JSON_PROPERTY_BREED = "breed"; diff --git a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml index 2828944e5542..65837c687775 100644 --- a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml @@ -1507,15 +1507,18 @@ components: - $ref: '#/components/schemas/Cat_allOf' Animal: discriminator: - propertyName: className + mapping: + DOG: '#/components/schemas/Dog' + CAT: '#/components/schemas/Cat' + propertyName: type properties: - className: + type: type: string color: default: red type: string required: - - className + - type type: object AnimalFarm: items: diff --git a/samples/client/petstore/java/webclient-jakarta/docs/Animal.md b/samples/client/petstore/java/webclient-jakarta/docs/Animal.md index d9b32f14c88a..82a9be30cc3d 100644 --- a/samples/client/petstore/java/webclient-jakarta/docs/Animal.md +++ b/samples/client/petstore/java/webclient-jakarta/docs/Animal.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**className** | **String** | | | +|**type** | **String** | | | |**color** | **String** | | [optional] | diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Animal.java index 217f89650372..5f4687c5e6b4 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Animal.java @@ -32,23 +32,23 @@ * Animal */ @JsonPropertyOrder({ - Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_TYPE, Animal.JSON_PROPERTY_COLOR }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = Cat.class, name = "Cat"), - @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), }) public class Animal { - public static final String JSON_PROPERTY_CLASS_NAME = "className"; - protected String className; + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; @@ -56,29 +56,29 @@ public class Animal { public Animal() { } - public Animal className(String className) { + public Animal type(String type) { - this.className = className; + this.type = type; return this; } /** - * Get className - * @return className + * Get type + * @return type **/ @jakarta.annotation.Nonnull - @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getClassName() { - return className; + public String getType() { + return type; } - @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setClassName(String className) { - this.className = className; + public void setType(String type) { + this.type = type; } @@ -117,20 +117,20 @@ public boolean equals(Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.className, animal.className) && + return Objects.equals(this.type, animal.type) && Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return Objects.hash(className, color); + return Objects.hash(type, color); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Cat.java index 762c68f3b8b4..852482efa2a7 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Cat.java @@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -35,10 +37,14 @@ }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) public class Cat extends Animal { public static final String JSON_PROPERTY_DECLAWED = "declawed"; diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Dog.java index e2d0287243f0..0d235f69c63c 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Dog.java @@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -35,10 +37,14 @@ }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) public class Dog extends Animal { public static final String JSON_PROPERTY_BREED = "breed"; diff --git a/samples/client/petstore/java/webclient/api/openapi.yaml b/samples/client/petstore/java/webclient/api/openapi.yaml index 2828944e5542..65837c687775 100644 --- a/samples/client/petstore/java/webclient/api/openapi.yaml +++ b/samples/client/petstore/java/webclient/api/openapi.yaml @@ -1507,15 +1507,18 @@ components: - $ref: '#/components/schemas/Cat_allOf' Animal: discriminator: - propertyName: className + mapping: + DOG: '#/components/schemas/Dog' + CAT: '#/components/schemas/Cat' + propertyName: type properties: - className: + type: type: string color: default: red type: string required: - - className + - type type: object AnimalFarm: items: diff --git a/samples/client/petstore/java/webclient/docs/Animal.md b/samples/client/petstore/java/webclient/docs/Animal.md index d9b32f14c88a..82a9be30cc3d 100644 --- a/samples/client/petstore/java/webclient/docs/Animal.md +++ b/samples/client/petstore/java/webclient/docs/Animal.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**className** | **String** | | | +|**type** | **String** | | | |**color** | **String** | | [optional] | diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java index 31932c6e6815..3bd908e49068 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java @@ -32,23 +32,23 @@ * Animal */ @JsonPropertyOrder({ - Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_TYPE, Animal.JSON_PROPERTY_COLOR }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = Cat.class, name = "Cat"), - @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), }) public class Animal { - public static final String JSON_PROPERTY_CLASS_NAME = "className"; - protected String className; + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; @@ -56,29 +56,29 @@ public class Animal { public Animal() { } - public Animal className(String className) { + public Animal type(String type) { - this.className = className; + this.type = type; return this; } /** - * Get className - * @return className + * Get type + * @return type **/ @javax.annotation.Nonnull - @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getClassName() { - return className; + public String getType() { + return type; } - @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setClassName(String className) { - this.className = className; + public void setType(String type) { + this.type = type; } @@ -117,20 +117,20 @@ public boolean equals(Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.className, animal.className) && + return Objects.equals(this.type, animal.type) && Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return Objects.hash(className, color); + return Objects.hash(type, color); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java index e14f5458acbf..fae6a98a3f5b 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java @@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -35,10 +37,14 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) public class Cat extends Animal { public static final String JSON_PROPERTY_DECLAWED = "declawed"; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java index 5de0e902a040..7cbfcccc75ea 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java @@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import org.openapitools.client.model.Animal; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -35,10 +37,14 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the className to be set during deserialization + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) public class Dog extends Animal { public static final String JSON_PROPERTY_BREED = "breed"; diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Animal.java b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Animal.java index da9c02ed0c39..ab513c62751c 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Animal.java +++ b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Animal.java @@ -28,28 +28,28 @@ public class Animal { - private String className; + private String type; private String color = "red"; /** - * Get className - * @return className + * Get type + * @return type **/ @NotNull - public String getClassName() { - return className; + public String getType() { + return type; } /** - * Set className + * Set type **/ - public void setClassName(String className) { - this.className = className; + public void setType(String type) { + this.type = type; } - public Animal className(String className) { - this.className = className; + public Animal type(String type) { + this.type = type; return this; } @@ -82,7 +82,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Cat.java b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Cat.java index 78534303e0ff..50d915d430f1 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Cat.java +++ b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Cat.java @@ -16,6 +16,8 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import org.openapitools.server.model.Animal; +import org.openapitools.server.model.Cat; +import org.openapitools.server.model.Dog; import jakarta.validation.constraints.*; import jakarta.validation.Valid; diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Dog.java b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Dog.java index e0f8e5a79b42..2808795623a5 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Dog.java +++ b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Dog.java @@ -16,6 +16,8 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import org.openapitools.server.model.Animal; +import org.openapitools.server.model.Cat; +import org.openapitools.server.model.Dog; import jakarta.validation.constraints.*; import jakarta.validation.Valid; diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml index 6667e32d34cb..c703a5bccf62 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml @@ -1507,15 +1507,18 @@ components: - $ref: '#/components/schemas/Cat_allOf' Animal: discriminator: - propertyName: className + mapping: + DOG: '#/components/schemas/Dog' + CAT: '#/components/schemas/Cat' + propertyName: type properties: - className: + type: type: string color: default: red type: string required: - - className + - type type: object AnimalFarm: items: diff --git a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Animal.java b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Animal.java index 72fd34477f82..2a751ddff64a 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Animal.java +++ b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Animal.java @@ -10,7 +10,7 @@ public class Animal { - private String className; + private String type; private String color = "red"; /** @@ -23,29 +23,29 @@ public Animal() { /** * Create Animal. * - * @param className className + * @param type type * @param color color */ public Animal( - String className, + String type, String color ) { - this.className = className; + this.type = type; this.color = color; } /** - * Get className - * @return className + * Get type + * @return type */ - public String getClassName() { - return className; + public String getType() { + return type; } - public void setClassName(String className) { - this.className = className; + public void setType(String type) { + this.type = type; } /** @@ -68,7 +68,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Cat.java b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Cat.java index 663f2a85183a..fcb4901aac11 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Cat.java +++ b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Cat.java @@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import org.openapitools.server.model.Animal; +import org.openapitools.server.model.Cat; +import org.openapitools.server.model.Dog; diff --git a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Dog.java b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Dog.java index 2c904956ac4c..9f9d5b0317e7 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Dog.java +++ b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Dog.java @@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import org.openapitools.server.model.Animal; +import org.openapitools.server.model.Cat; +import org.openapitools.server.model.Dog; diff --git a/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml index 6667e32d34cb..c703a5bccf62 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml @@ -1507,15 +1507,18 @@ components: - $ref: '#/components/schemas/Cat_allOf' Animal: discriminator: - propertyName: className + mapping: + DOG: '#/components/schemas/Dog' + CAT: '#/components/schemas/Cat' + propertyName: type properties: - className: + type: type: string color: default: red type: string required: - - className + - type type: object AnimalFarm: items: From a1a26eae8d5ae4801e2da2768bd645d7591a914a Mon Sep 17 00:00:00 2001 From: Bernie Schelberg Date: Fri, 17 Feb 2023 14:00:20 +1000 Subject: [PATCH 4/6] Generate other samples --- .../csharp/OpenAPIClient/docs/Animal.md | 2 +- .../petstore/csharp/OpenAPIClient/docs/Cat.md | 2 +- .../petstore/csharp/OpenAPIClient/docs/Dog.md | 2 +- .../src/Org.OpenAPITools/Model/Animal.cs | 32 +++++++-------- .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Dog.cs | 2 +- .../lib/openapi_petstore/model/animal.ex | 4 +- .../elixir/lib/openapi_petstore/model/cat.ex | 4 +- .../elixir/lib/openapi_petstore/model/dog.ex | 4 +- samples/client/petstore/perl/docs/Animal.md | 2 +- .../lib/WWW/OpenAPIClient/Object/Animal.pm | 8 ++-- .../OpenAPIClient-php/docs/Model/Animal.md | 2 +- .../OpenAPIClient-php/lib/Model/Animal.php | 40 +++++++++---------- .../petstore/ruby-autoload/docs/Animal.md | 4 +- .../lib/petstore/models/animal.rb | 22 +++++----- .../petstore/ruby-faraday/docs/Animal.md | 4 +- .../lib/petstore/models/animal.rb | 22 +++++----- samples/client/petstore/ruby/docs/Animal.md | 4 +- .../ruby/lib/petstore/models/animal.rb | 22 +++++----- .../builds/default-v3.0/models/Animal.ts | 12 +++--- .../doc/Animal.md | 2 +- .../doc/Cat.md | 2 +- .../doc/Dog.md | 2 +- .../lib/src/model/animal.dart | 10 ++--- .../lib/src/model/cat.dart | 10 ++--- .../lib/src/model/dog.dart | 10 ++--- .../petstore_client_lib_fake/doc/Animal.md | 2 +- .../petstore_client_lib_fake/doc/Cat.md | 2 +- .../petstore_client_lib_fake/doc/Dog.md | 2 +- .../lib/src/model/animal.dart | 32 +++++++-------- .../lib/src/model/cat.dart | 24 ++++++----- .../lib/src/model/dog.dart | 24 ++++++----- .../petstore_client_lib_fake/doc/Animal.md | 2 +- .../dart2/petstore_client_lib_fake/doc/Cat.md | 2 +- .../dart2/petstore_client_lib_fake/doc/Dog.md | 2 +- .../lib/model/animal.dart | 16 ++++---- .../lib/model/cat.dart | 16 ++++---- .../lib/model/dog.dart | 16 ++++---- .../petstore/python-legacy/docs/Animal.md | 2 +- .../petstore_api/models/animal.py | 36 ++++++++--------- .../schema/petstore/mysql/Model/Animal.sql | 6 +-- samples/schema/petstore/mysql/Model/Cat.sql | 6 +-- samples/schema/petstore/mysql/Model/Dog.sql | 6 +-- .../schema/petstore/mysql/mysql_schema.sql | 6 +-- .../generated/3_0/model/Animal.cpp | 12 +++--- .../cpp-restbed/generated/3_0/model/Animal.h | 6 +-- .../cpp-restbed/generated/3_0/model/Cat.cpp | 12 +++--- .../cpp-restbed/generated/3_0/model/Cat.h | 6 +-- .../cpp-restbed/generated/3_0/model/Dog.cpp | 12 +++--- .../cpp-restbed/generated/3_0/model/Dog.h | 6 +-- .../java/org/openapitools/model/Animal.java | 38 +++++++++--------- .../php-laravel/lib/app/Models/Animal.php | 4 +- .../php-laravel/lib/app/Models/Cat.php | 4 +- .../php-laravel/lib/app/Models/Dog.php | 4 +- 54 files changed, 271 insertions(+), 267 deletions(-) diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/Animal.md b/samples/client/petstore/csharp/OpenAPIClient/docs/Animal.md index 0a05bcdf0616..c12f38993771 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/Animal.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/Animal.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | +**Type** | **string** | | **Color** | **string** | | [optional] [default to "red"] [[Back to Model list]](../README.md#documentation-for-models) diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/Cat.md b/samples/client/petstore/csharp/OpenAPIClient/docs/Cat.md index 6609de8e12a5..8239a77a240a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/Cat.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/Cat.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | +**Type** | **string** | | **Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/Dog.md b/samples/client/petstore/csharp/OpenAPIClient/docs/Dog.md index 1f39769d2b93..68dd7bd6d968 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/Dog.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/Dog.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | **string** | | +**Type** | **string** | | **Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs index d06c695fa6ab..3367265dac34 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs @@ -29,7 +29,7 @@ namespace Org.OpenAPITools.Model /// Animal /// [DataContract] - [JsonConverter(typeof(JsonSubtypes), "className")] + [JsonConverter(typeof(JsonSubtypes), "type")] [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] public partial class Animal : IEquatable, IValidatableObject @@ -42,18 +42,18 @@ protected Animal() { } /// /// Initializes a new instance of the class. /// - /// className (required). + /// type (required). /// color (default to "red"). - public Animal(string className = default(string), string color = "red") + public Animal(string type = default(string), string color = "red") { - // to ensure "className" is required (not null) - if (className == null) + // to ensure "type" is required (not null) + if (type == null) { - throw new InvalidDataException("className is a required property for Animal and cannot be null"); + throw new InvalidDataException("type is a required property for Animal and cannot be null"); } else { - this.ClassName = className; + this.Type = type; } // use default value if no "color" provided @@ -68,10 +68,10 @@ protected Animal() { } } /// - /// Gets or Sets ClassName + /// Gets or Sets Type /// - [DataMember(Name="className", EmitDefaultValue=true)] - public string ClassName { get; set; } + [DataMember(Name="type", EmitDefaultValue=true)] + public string Type { get; set; } /// /// Gets or Sets Color @@ -87,7 +87,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Animal {\n"); - sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); sb.Append(" Color: ").Append(Color).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -124,9 +124,9 @@ public bool Equals(Animal input) return ( - this.ClassName == input.ClassName || - (this.ClassName != null && - this.ClassName.Equals(input.ClassName)) + this.Type == input.Type || + (this.Type != null && + this.Type.Equals(input.Type)) ) && ( this.Color == input.Color || @@ -144,8 +144,8 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.ClassName != null) - hashCode = hashCode * 59 + this.ClassName.GetHashCode(); + if (this.Type != null) + hashCode = hashCode * 59 + this.Type.GetHashCode(); if (this.Color != null) hashCode = hashCode * 59 + this.Color.GetHashCode(); return hashCode; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs index 3110e4e5fe01..8b79c026fe0b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs @@ -39,7 +39,7 @@ protected Cat() { } /// Initializes a new instance of the class. /// /// declawed. - public Cat(bool declawed = default(bool), string className = "Cat", string color = "red") : base(className, color) + public Cat(bool declawed = default(bool), string type = "Cat", string color = "red") : base(type, color) { this.Declawed = declawed; } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs index 9abd21610ace..551e2db1aa3d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs @@ -39,7 +39,7 @@ protected Dog() { } /// Initializes a new instance of the class. /// /// breed. - public Dog(string breed = default(string), string className = "Dog", string color = "red") : base(className, color) + public Dog(string breed = default(string), string type = "Dog", string color = "red") : base(type, color) { this.Breed = breed; } diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex index 282804e55dea..1c7236bee37c 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex @@ -8,12 +8,12 @@ defmodule OpenapiPetstore.Model.Animal do @derive [Poison.Encoder] defstruct [ - :className, + :type, :color ] @type t :: %__MODULE__{ - :className => String.t, + :type => String.t, :color => String.t | nil } end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex index 759f27265cab..e670cc27c57b 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex @@ -8,13 +8,13 @@ defmodule OpenapiPetstore.Model.Cat do @derive [Poison.Encoder] defstruct [ - :className, + :type, :color, :declawed ] @type t :: %__MODULE__{ - :className => String.t, + :type => String.t, :color => String.t | nil, :declawed => boolean() | nil } diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex index 01e97f3ace41..41c300a38298 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex @@ -8,13 +8,13 @@ defmodule OpenapiPetstore.Model.Dog do @derive [Poison.Encoder] defstruct [ - :className, + :type, :color, :breed ] @type t :: %__MODULE__{ - :className => String.t, + :type => String.t, :color => String.t | nil, :breed => String.t | nil } diff --git a/samples/client/petstore/perl/docs/Animal.md b/samples/client/petstore/perl/docs/Animal.md index 5a4ee9b8be75..5d3d259cea3b 100644 --- a/samples/client/petstore/perl/docs/Animal.md +++ b/samples/client/petstore/perl/docs/Animal.md @@ -8,7 +8,7 @@ use WWW::OpenAPIClient::Object::Animal; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**class_name** | **string** | | +**type** | **string** | | **color** | **string** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm index 610421d0af59..19fe96cafe3a 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm @@ -219,9 +219,9 @@ __PACKAGE__->class_documentation({description => '', } ); __PACKAGE__->method_documentation({ - 'class_name' => { + 'type' => { datatype => 'string', - base_name => 'className', + base_name => 'type', description => '', format => '', read_only => '', @@ -236,12 +236,12 @@ __PACKAGE__->method_documentation({ }); __PACKAGE__->openapi_types( { - 'class_name' => 'string', + 'type' => 'string', 'color' => 'string' } ); __PACKAGE__->attribute_map( { - 'class_name' => 'className', + 'type' => 'type', 'color' => 'color' } ); diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Animal.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Animal.md index ee79377b5661..8fd46a2f55c7 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Animal.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Animal.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**class_name** | **string** | | +**type** | **string** | | **color** | **string** | | [optional] [default to 'red'] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php index f02ef4583eea..a37bbe8f751c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php @@ -42,7 +42,7 @@ */ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable { - public const DISCRIMINATOR = 'class_name'; + public const DISCRIMINATOR = 'type'; /** * The original name of the model. @@ -57,7 +57,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'class_name' => 'string', + 'type' => 'string', 'color' => 'string' ]; @@ -69,7 +69,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'class_name' => null, + 'type' => null, 'color' => null ]; @@ -79,7 +79,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'class_name' => false, + 'type' => false, 'color' => false ]; @@ -169,7 +169,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'class_name' => 'className', + 'type' => 'type', 'color' => 'color' ]; @@ -179,7 +179,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'class_name' => 'setClassName', + 'type' => 'setType', 'color' => 'setColor' ]; @@ -189,7 +189,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'class_name' => 'getClassName', + 'type' => 'getType', 'color' => 'getColor' ]; @@ -250,11 +250,11 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('class_name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); $this->setIfExists('color', $data ?? [], 'red'); // Initialize discriminator property with the model name. - $this->container['class_name'] = static::$openAPIModelName; + $this->container['type'] = static::$openAPIModelName; } /** @@ -284,8 +284,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['class_name'] === null) { - $invalidProperties[] = "'class_name' can't be null"; + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; } return $invalidProperties; } @@ -303,28 +303,28 @@ public function valid() /** - * Gets class_name + * Gets type * * @return string */ - public function getClassName() + public function getType() { - return $this->container['class_name']; + return $this->container['type']; } /** - * Sets class_name + * Sets type * - * @param string $class_name class_name + * @param string $type type * * @return self */ - public function setClassName($class_name) + public function setType($type) { - if (is_null($class_name)) { - throw new \InvalidArgumentException('non-nullable class_name cannot be null'); + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); } - $this->container['class_name'] = $class_name; + $this->container['type'] = $type; return $this; } diff --git a/samples/client/petstore/ruby-autoload/docs/Animal.md b/samples/client/petstore/ruby-autoload/docs/Animal.md index 286ce80cb218..0f282bd41f0e 100644 --- a/samples/client/petstore/ruby-autoload/docs/Animal.md +++ b/samples/client/petstore/ruby-autoload/docs/Animal.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **class_name** | **String** | | | +| **type** | **String** | | | | **color** | **String** | | [optional][default to 'red'] | ## Example @@ -13,7 +13,7 @@ require 'petstore' instance = Petstore::Animal.new( - class_name: null, + type: null, color: null ) ``` diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb index 543d61643022..0cf77674fe5d 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb @@ -15,14 +15,14 @@ module Petstore class Animal - attr_accessor :class_name + attr_accessor :type attr_accessor :color # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'class_name' => :'className', + :'type' => :'type', :'color' => :'color' } end @@ -35,7 +35,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'class_name' => :'String', + :'type' => :'String', :'color' => :'String' } end @@ -48,7 +48,7 @@ def self.openapi_nullable # discriminator's property name in OpenAPI v3 def self.openapi_discriminator_name - :'class_name' + :'type' end # Initializes the object @@ -66,8 +66,8 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'class_name') - self.class_name = attributes[:'class_name'] + if attributes.key?(:'type') + self.type = attributes[:'type'] end if attributes.key?(:'color') @@ -81,8 +81,8 @@ def initialize(attributes = {}) # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new - if @class_name.nil? - invalid_properties.push('invalid value for "class_name", class_name cannot be nil.') + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') end invalid_properties @@ -91,7 +91,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return false if @class_name.nil? + return false if @type.nil? true end @@ -100,7 +100,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - class_name == o.class_name && + type == o.type && color == o.color end @@ -113,7 +113,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [class_name, color].hash + [type, color].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby-faraday/docs/Animal.md b/samples/client/petstore/ruby-faraday/docs/Animal.md index 286ce80cb218..0f282bd41f0e 100644 --- a/samples/client/petstore/ruby-faraday/docs/Animal.md +++ b/samples/client/petstore/ruby-faraday/docs/Animal.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **class_name** | **String** | | | +| **type** | **String** | | | | **color** | **String** | | [optional][default to 'red'] | ## Example @@ -13,7 +13,7 @@ require 'petstore' instance = Petstore::Animal.new( - class_name: null, + type: null, color: null ) ``` diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb index 543d61643022..0cf77674fe5d 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb @@ -15,14 +15,14 @@ module Petstore class Animal - attr_accessor :class_name + attr_accessor :type attr_accessor :color # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'class_name' => :'className', + :'type' => :'type', :'color' => :'color' } end @@ -35,7 +35,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'class_name' => :'String', + :'type' => :'String', :'color' => :'String' } end @@ -48,7 +48,7 @@ def self.openapi_nullable # discriminator's property name in OpenAPI v3 def self.openapi_discriminator_name - :'class_name' + :'type' end # Initializes the object @@ -66,8 +66,8 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'class_name') - self.class_name = attributes[:'class_name'] + if attributes.key?(:'type') + self.type = attributes[:'type'] end if attributes.key?(:'color') @@ -81,8 +81,8 @@ def initialize(attributes = {}) # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new - if @class_name.nil? - invalid_properties.push('invalid value for "class_name", class_name cannot be nil.') + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') end invalid_properties @@ -91,7 +91,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return false if @class_name.nil? + return false if @type.nil? true end @@ -100,7 +100,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - class_name == o.class_name && + type == o.type && color == o.color end @@ -113,7 +113,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [class_name, color].hash + [type, color].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby/docs/Animal.md b/samples/client/petstore/ruby/docs/Animal.md index 286ce80cb218..0f282bd41f0e 100644 --- a/samples/client/petstore/ruby/docs/Animal.md +++ b/samples/client/petstore/ruby/docs/Animal.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **class_name** | **String** | | | +| **type** | **String** | | | | **color** | **String** | | [optional][default to 'red'] | ## Example @@ -13,7 +13,7 @@ require 'petstore' instance = Petstore::Animal.new( - class_name: null, + type: null, color: null ) ``` diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal.rb b/samples/client/petstore/ruby/lib/petstore/models/animal.rb index 543d61643022..0cf77674fe5d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/animal.rb @@ -15,14 +15,14 @@ module Petstore class Animal - attr_accessor :class_name + attr_accessor :type attr_accessor :color # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'class_name' => :'className', + :'type' => :'type', :'color' => :'color' } end @@ -35,7 +35,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'class_name' => :'String', + :'type' => :'String', :'color' => :'String' } end @@ -48,7 +48,7 @@ def self.openapi_nullable # discriminator's property name in OpenAPI v3 def self.openapi_discriminator_name - :'class_name' + :'type' end # Initializes the object @@ -66,8 +66,8 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'class_name') - self.class_name = attributes[:'class_name'] + if attributes.key?(:'type') + self.type = attributes[:'type'] end if attributes.key?(:'color') @@ -81,8 +81,8 @@ def initialize(attributes = {}) # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new - if @class_name.nil? - invalid_properties.push('invalid value for "class_name", class_name cannot be nil.') + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') end invalid_properties @@ -91,7 +91,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return false if @class_name.nil? + return false if @type.nil? true end @@ -100,7 +100,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - class_name == o.class_name && + type == o.type && color == o.color end @@ -113,7 +113,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [class_name, color].hash + [type, color].hash end # Builds the object from hash diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts index 7c611d3f08e9..8a883d23db48 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts @@ -29,7 +29,7 @@ export interface Animal { * @type {string} * @memberof Animal */ - className: string; + type: string; /** * * @type {string} @@ -43,7 +43,7 @@ export interface Animal { */ export function instanceOfAnimal(value: object): boolean { let isInstance = true; - isInstance = isInstance && "className" in value; + isInstance = isInstance && "type" in value; return isInstance; } @@ -57,16 +57,16 @@ export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): An return json; } if (!ignoreDiscriminator) { - if (json['className'] === 'Cat') { + if (json['type'] === 'CAT') { return CatFromJSONTyped(json, true); } - if (json['className'] === 'Dog') { + if (json['type'] === 'DOG') { return DogFromJSONTyped(json, true); } } return { - 'className': json['className'], + 'type': json['type'], 'color': !exists(json, 'color') ? undefined : json['color'], }; } @@ -80,7 +80,7 @@ export function AnimalToJSON(value?: Animal | null): any { } return { - 'className': value.className, + 'type': value.type, 'color': value.color, }; } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Animal.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Animal.md index 415b56e9bc2e..8d7a316ca181 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Animal.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Animal.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**className** | **String** | | +**type** | **String** | | **color** | **String** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Cat.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Cat.md index 6552eea4b435..9bef6f5f6068 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Cat.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Cat.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**className** | **String** | | +**type** | **String** | | **color** | **String** | | [optional] [default to 'red'] **declawed** | **bool** | | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Dog.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Dog.md index d36439b767bb..fc49707080dd 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Dog.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Dog.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**className** | **String** | | +**type** | **String** | | **color** | **String** | | [optional] [default to 'red'] **breed** | **String** | | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/animal.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/animal.dart index 22a196ce7d7f..e2757821dc40 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/animal.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/animal.dart @@ -18,20 +18,20 @@ class Animal { /// Returns a new [Animal] instance. Animal({ - required this.className, + required this.type, this.color = 'red', }); @JsonKey( - name: r'className', + name: r'type', required: true, includeIfNull: false ) - final String className; + final String type; @@ -49,12 +49,12 @@ class Animal { @override bool operator ==(Object other) => identical(this, other) || other is Animal && - other.className == className && + other.type == type && other.color == color; @override int get hashCode => - className.hashCode + + type.hashCode + color.hashCode; factory Animal.fromJson(Map json) => _$AnimalFromJson(json); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/cat.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/cat.dart index 0b176faf313e..18c2f68c5ec2 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/cat.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/cat.dart @@ -21,7 +21,7 @@ class Cat { /// Returns a new [Cat] instance. Cat({ - required this.className, + required this.type, this.color = 'red', @@ -30,13 +30,13 @@ class Cat { @JsonKey( - name: r'className', + name: r'type', required: true, includeIfNull: false ) - final String className; + final String type; @@ -66,13 +66,13 @@ class Cat { @override bool operator ==(Object other) => identical(this, other) || other is Cat && - other.className == className && + other.type == type && other.color == color && other.declawed == declawed; @override int get hashCode => - className.hashCode + + type.hashCode + color.hashCode + declawed.hashCode; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/dog.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/dog.dart index a049d0479fb0..ed4cae09f3bf 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/dog.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/dog.dart @@ -21,7 +21,7 @@ class Dog { /// Returns a new [Dog] instance. Dog({ - required this.className, + required this.type, this.color = 'red', @@ -30,13 +30,13 @@ class Dog { @JsonKey( - name: r'className', + name: r'type', required: true, includeIfNull: false ) - final String className; + final String type; @@ -66,13 +66,13 @@ class Dog { @override bool operator ==(Object other) => identical(this, other) || other is Dog && - other.className == className && + other.type == type && other.color == color && other.breed == breed; @override int get hashCode => - className.hashCode + + type.hashCode + color.hashCode + breed.hashCode; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md index 415b56e9bc2e..8d7a316ca181 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**className** | **String** | | +**type** | **String** | | **color** | **String** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md index 6552eea4b435..9bef6f5f6068 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**className** | **String** | | +**type** | **String** | | **color** | **String** | | [optional] [default to 'red'] **declawed** | **bool** | | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md index d36439b767bb..fc49707080dd 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**className** | **String** | | +**type** | **String** | | **color** | **String** | | [optional] [default to 'red'] **breed** | **String** | | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/animal.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/animal.dart index 01a52a6a1707..4c0fe831ec21 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/animal.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/animal.dart @@ -13,21 +13,21 @@ part 'animal.g.dart'; /// Animal /// /// Properties: -/// * [className] +/// * [type] /// * [color] @BuiltValue(instantiable: false) abstract class Animal { - @BuiltValueField(wireName: r'className') - String get className; + @BuiltValueField(wireName: r'type') + String get type; @BuiltValueField(wireName: r'color') String? get color; - static const String discriminatorFieldName = r'className'; + static const String discriminatorFieldName = r'type'; static const Map discriminatorMapping = { - r'Cat': Cat, - r'Dog': Dog, + r'CAT': Cat, + r'DOG': Dog, }; @BuiltValueSerializer(custom: true) @@ -37,10 +37,10 @@ abstract class Animal { extension AnimalDiscriminatorExt on Animal { String? get discriminatorValue { if (this is Cat) { - return r'Cat'; + return r'CAT'; } if (this is Dog) { - return r'Dog'; + return r'DOG'; } return null; } @@ -48,10 +48,10 @@ extension AnimalDiscriminatorExt on Animal { extension AnimalBuilderDiscriminatorExt on AnimalBuilder { String? get discriminatorValue { if (this is CatBuilder) { - return r'Cat'; + return r'CAT'; } if (this is DogBuilder) { - return r'Dog'; + return r'DOG'; } return null; } @@ -69,9 +69,9 @@ class _$AnimalSerializer implements PrimitiveSerializer { Animal object, { FullType specifiedType = FullType.unspecified, }) sync* { - yield r'className'; + yield r'type'; yield serializers.serialize( - object.className, + object.type, specifiedType: const FullType(String), ); if (object.color != null) { @@ -108,9 +108,9 @@ class _$AnimalSerializer implements PrimitiveSerializer { final discIndex = serializedList.indexOf(Animal.discriminatorFieldName) + 1; final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; switch (discValue) { - case r'Cat': + case r'CAT': return serializers.deserialize(serialized, specifiedType: FullType(Cat)) as Cat; - case r'Dog': + case r'DOG': return serializers.deserialize(serialized, specifiedType: FullType(Dog)) as Dog; default: return serializers.deserialize(serialized, specifiedType: FullType($Animal)) as $Animal; @@ -160,12 +160,12 @@ class _$$AnimalSerializer implements PrimitiveSerializer<$Animal> { final key = serializedList[i] as String; final value = serializedList[i + 1]; switch (key) { - case r'className': + case r'type': final valueDes = serializers.deserialize( value, specifiedType: const FullType(String), ) as String; - result.className = valueDes; + result.type = valueDes; break; case r'color': final valueDes = serializers.deserialize( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/cat.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/cat.dart index 23d19b38b05a..8c745718481f 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/cat.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/cat.dart @@ -3,6 +3,8 @@ // // ignore_for_file: unused_element +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/cat.dart'; import 'package:openapi/src/model/animal.dart'; import 'package:openapi/src/model/cat_all_of.dart'; import 'package:built_value/built_value.dart'; @@ -13,7 +15,7 @@ part 'cat.g.dart'; /// Cat /// /// Properties: -/// * [className] +/// * [type] /// * [color] /// * [declawed] @BuiltValue() @@ -23,7 +25,7 @@ abstract class Cat implements Animal, CatAllOf, Built { factory Cat([void updates(CatBuilder b)]) = _$Cat; @BuiltValueHook(initializeBuilder: true) - static void _defaults(CatBuilder b) => b..className=b.discriminatorValue + static void _defaults(CatBuilder b) => b..type=b.discriminatorValue ..color = 'red'; @BuiltValueSerializer(custom: true) @@ -42,11 +44,6 @@ class _$CatSerializer implements PrimitiveSerializer { Cat object, { FullType specifiedType = FullType.unspecified, }) sync* { - yield r'className'; - yield serializers.serialize( - object.className, - specifiedType: const FullType(String), - ); if (object.color != null) { yield r'color'; yield serializers.serialize( @@ -54,6 +51,11 @@ class _$CatSerializer implements PrimitiveSerializer { specifiedType: const FullType(String), ); } + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(String), + ); if (object.declawed != null) { yield r'declawed'; yield serializers.serialize( @@ -84,19 +86,19 @@ class _$CatSerializer implements PrimitiveSerializer { final key = serializedList[i] as String; final value = serializedList[i + 1]; switch (key) { - case r'className': + case r'color': final valueDes = serializers.deserialize( value, specifiedType: const FullType(String), ) as String; - result.className = valueDes; + result.color = valueDes; break; - case r'color': + case r'type': final valueDes = serializers.deserialize( value, specifiedType: const FullType(String), ) as String; - result.color = valueDes; + result.type = valueDes; break; case r'declawed': final valueDes = serializers.deserialize( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/dog.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/dog.dart index 4d9974f25b1d..8d25e67daa6e 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/dog.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/dog.dart @@ -3,6 +3,8 @@ // // ignore_for_file: unused_element +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/cat.dart'; import 'package:openapi/src/model/dog_all_of.dart'; import 'package:openapi/src/model/animal.dart'; import 'package:built_value/built_value.dart'; @@ -13,7 +15,7 @@ part 'dog.g.dart'; /// Dog /// /// Properties: -/// * [className] +/// * [type] /// * [color] /// * [breed] @BuiltValue() @@ -23,7 +25,7 @@ abstract class Dog implements Animal, DogAllOf, Built { factory Dog([void updates(DogBuilder b)]) = _$Dog; @BuiltValueHook(initializeBuilder: true) - static void _defaults(DogBuilder b) => b..className=b.discriminatorValue + static void _defaults(DogBuilder b) => b..type=b.discriminatorValue ..color = 'red'; @BuiltValueSerializer(custom: true) @@ -42,11 +44,6 @@ class _$DogSerializer implements PrimitiveSerializer { Dog object, { FullType specifiedType = FullType.unspecified, }) sync* { - yield r'className'; - yield serializers.serialize( - object.className, - specifiedType: const FullType(String), - ); if (object.color != null) { yield r'color'; yield serializers.serialize( @@ -54,6 +51,11 @@ class _$DogSerializer implements PrimitiveSerializer { specifiedType: const FullType(String), ); } + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(String), + ); if (object.breed != null) { yield r'breed'; yield serializers.serialize( @@ -84,19 +86,19 @@ class _$DogSerializer implements PrimitiveSerializer { final key = serializedList[i] as String; final value = serializedList[i + 1]; switch (key) { - case r'className': + case r'color': final valueDes = serializers.deserialize( value, specifiedType: const FullType(String), ) as String; - result.className = valueDes; + result.color = valueDes; break; - case r'color': + case r'type': final valueDes = serializers.deserialize( value, specifiedType: const FullType(String), ) as String; - result.color = valueDes; + result.type = valueDes; break; case r'breed': final valueDes = serializers.deserialize( diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md index 415b56e9bc2e..8d7a316ca181 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**className** | **String** | | +**type** | **String** | | **color** | **String** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md index 6552eea4b435..9bef6f5f6068 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**className** | **String** | | +**type** | **String** | | **color** | **String** | | [optional] [default to 'red'] **declawed** | **bool** | | [optional] diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md index d36439b767bb..fc49707080dd 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**className** | **String** | | +**type** | **String** | | **color** | **String** | | [optional] [default to 'red'] **breed** | **String** | | [optional] diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart index 2329953a7085..42420687167b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart @@ -13,31 +13,31 @@ part of openapi.api; class Animal { /// Returns a new [Animal] instance. Animal({ - required this.className, + required this.type, this.color = 'red', }); - String className; + String type; String color; @override bool operator ==(Object other) => identical(this, other) || other is Animal && - other.className == className && + other.type == type && other.color == color; @override int get hashCode => // ignore: unnecessary_parenthesis - (className.hashCode) + + (type.hashCode) + (color.hashCode); @override - String toString() => 'Animal[className=$className, color=$color]'; + String toString() => 'Animal[type=$type, color=$color]'; Map toJson() { final json = {}; - json[r'className'] = this.className; + json[r'type'] = this.type; json[r'color'] = this.color; return json; } @@ -61,7 +61,7 @@ class Animal { }()); return Animal( - className: mapValueOfType(json, r'className')!, + type: mapValueOfType(json, r'type')!, color: mapValueOfType(json, r'color') ?? 'red', ); } @@ -112,7 +112,7 @@ class Animal { /// The list of required keys that must be present in a JSON. static const requiredKeys = { - 'className', + 'type', }; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart index 6bfb040ad1cc..062ae55ad063 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart @@ -13,12 +13,12 @@ part of openapi.api; class Cat { /// Returns a new [Cat] instance. Cat({ - required this.className, + required this.type, this.color = 'red', this.declawed, }); - String className; + String type; String color; @@ -32,23 +32,23 @@ class Cat { @override bool operator ==(Object other) => identical(this, other) || other is Cat && - other.className == className && + other.type == type && other.color == color && other.declawed == declawed; @override int get hashCode => // ignore: unnecessary_parenthesis - (className.hashCode) + + (type.hashCode) + (color.hashCode) + (declawed == null ? 0 : declawed!.hashCode); @override - String toString() => 'Cat[className=$className, color=$color, declawed=$declawed]'; + String toString() => 'Cat[type=$type, color=$color, declawed=$declawed]'; Map toJson() { final json = {}; - json[r'className'] = this.className; + json[r'type'] = this.type; json[r'color'] = this.color; if (this.declawed != null) { json[r'declawed'] = this.declawed; @@ -77,7 +77,7 @@ class Cat { }()); return Cat( - className: mapValueOfType(json, r'className')!, + type: mapValueOfType(json, r'type')!, color: mapValueOfType(json, r'color') ?? 'red', declawed: mapValueOfType(json, r'declawed'), ); @@ -129,7 +129,7 @@ class Cat { /// The list of required keys that must be present in a JSON. static const requiredKeys = { - 'className', + 'type', }; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart index 0375767475ab..c53b49e1f52f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart @@ -13,12 +13,12 @@ part of openapi.api; class Dog { /// Returns a new [Dog] instance. Dog({ - required this.className, + required this.type, this.color = 'red', this.breed, }); - String className; + String type; String color; @@ -32,23 +32,23 @@ class Dog { @override bool operator ==(Object other) => identical(this, other) || other is Dog && - other.className == className && + other.type == type && other.color == color && other.breed == breed; @override int get hashCode => // ignore: unnecessary_parenthesis - (className.hashCode) + + (type.hashCode) + (color.hashCode) + (breed == null ? 0 : breed!.hashCode); @override - String toString() => 'Dog[className=$className, color=$color, breed=$breed]'; + String toString() => 'Dog[type=$type, color=$color, breed=$breed]'; Map toJson() { final json = {}; - json[r'className'] = this.className; + json[r'type'] = this.type; json[r'color'] = this.color; if (this.breed != null) { json[r'breed'] = this.breed; @@ -77,7 +77,7 @@ class Dog { }()); return Dog( - className: mapValueOfType(json, r'className')!, + type: mapValueOfType(json, r'type')!, color: mapValueOfType(json, r'color') ?? 'red', breed: mapValueOfType(json, r'breed'), ); @@ -129,7 +129,7 @@ class Dog { /// The list of required keys that must be present in a JSON. static const requiredKeys = { - 'className', + 'type', }; } diff --git a/samples/openapi3/client/petstore/python-legacy/docs/Animal.md b/samples/openapi3/client/petstore/python-legacy/docs/Animal.md index 8bc43ab53f33..9a0ba18768cb 100755 --- a/samples/openapi3/client/petstore/python-legacy/docs/Animal.md +++ b/samples/openapi3/client/petstore/python-legacy/docs/Animal.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**class_name** | **str** | | +**type** | **str** | | **color** | **str** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/python-legacy/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/animal.py index d4a49534078d..721b0231b121 100755 --- a/samples/openapi3/client/petstore/python-legacy/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/animal.py @@ -36,12 +36,12 @@ class Animal(object): and the value is json key in definition. """ openapi_types = { - 'class_name': 'str', + 'type': 'str', 'color': 'str' } attribute_map = { - 'class_name': 'className', + 'type': 'type', 'color': 'color' } @@ -50,42 +50,42 @@ class Animal(object): 'Dog': 'Dog' } - def __init__(self, class_name=None, color='red', local_vars_configuration=None): # noqa: E501 + def __init__(self, type=None, color='red', local_vars_configuration=None): # noqa: E501 """Animal - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration.get_default_copy() self.local_vars_configuration = local_vars_configuration - self._class_name = None + self._type = None self._color = None - self.discriminator = 'class_name' + self.discriminator = 'type' - self.class_name = class_name + self.type = type if color is not None: self.color = color @property - def class_name(self): - """Gets the class_name of this Animal. # noqa: E501 + def type(self): + """Gets the type of this Animal. # noqa: E501 - :return: The class_name of this Animal. # noqa: E501 + :return: The type of this Animal. # noqa: E501 :rtype: str """ - return self._class_name + return self._type - @class_name.setter - def class_name(self, class_name): - """Sets the class_name of this Animal. + @type.setter + def type(self, type): + """Sets the type of this Animal. - :param class_name: The class_name of this Animal. # noqa: E501 - :type class_name: str + :param type: The type of this Animal. # noqa: E501 + :type type: str """ - if self.local_vars_configuration.client_side_validation and class_name is None: # noqa: E501 - raise ValueError("Invalid value for `class_name`, must not be `None`") # noqa: E501 + if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 - self._class_name = class_name + self._type = type @property def color(self): diff --git a/samples/schema/petstore/mysql/Model/Animal.sql b/samples/schema/petstore/mysql/Model/Animal.sql index f53dd36d200a..4da7db44b774 100644 --- a/samples/schema/petstore/mysql/Model/Animal.sql +++ b/samples/schema/petstore/mysql/Model/Animal.sql @@ -7,17 +7,17 @@ -- -- SELECT template for table `Animal` -- -SELECT `className`, `color` FROM `Animal` WHERE 1; +SELECT `type`, `color` FROM `Animal` WHERE 1; -- -- INSERT template for table `Animal` -- -INSERT INTO `Animal`(`className`, `color`) VALUES (?, ?); +INSERT INTO `Animal`(`type`, `color`) VALUES (?, ?); -- -- UPDATE template for table `Animal` -- -UPDATE `Animal` SET `className` = ?, `color` = ? WHERE 1; +UPDATE `Animal` SET `type` = ?, `color` = ? WHERE 1; -- -- DELETE template for table `Animal` diff --git a/samples/schema/petstore/mysql/Model/Cat.sql b/samples/schema/petstore/mysql/Model/Cat.sql index d71c6fd03147..a260d3d77697 100644 --- a/samples/schema/petstore/mysql/Model/Cat.sql +++ b/samples/schema/petstore/mysql/Model/Cat.sql @@ -7,17 +7,17 @@ -- -- SELECT template for table `Cat` -- -SELECT `className`, `color`, `declawed` FROM `Cat` WHERE 1; +SELECT `type`, `color`, `declawed` FROM `Cat` WHERE 1; -- -- INSERT template for table `Cat` -- -INSERT INTO `Cat`(`className`, `color`, `declawed`) VALUES (?, ?, ?); +INSERT INTO `Cat`(`type`, `color`, `declawed`) VALUES (?, ?, ?); -- -- UPDATE template for table `Cat` -- -UPDATE `Cat` SET `className` = ?, `color` = ?, `declawed` = ? WHERE 1; +UPDATE `Cat` SET `type` = ?, `color` = ?, `declawed` = ? WHERE 1; -- -- DELETE template for table `Cat` diff --git a/samples/schema/petstore/mysql/Model/Dog.sql b/samples/schema/petstore/mysql/Model/Dog.sql index 3651dcd76093..a843fde0fdbb 100644 --- a/samples/schema/petstore/mysql/Model/Dog.sql +++ b/samples/schema/petstore/mysql/Model/Dog.sql @@ -7,17 +7,17 @@ -- -- SELECT template for table `Dog` -- -SELECT `className`, `color`, `breed` FROM `Dog` WHERE 1; +SELECT `type`, `color`, `breed` FROM `Dog` WHERE 1; -- -- INSERT template for table `Dog` -- -INSERT INTO `Dog`(`className`, `color`, `breed`) VALUES (?, ?, ?); +INSERT INTO `Dog`(`type`, `color`, `breed`) VALUES (?, ?, ?); -- -- UPDATE template for table `Dog` -- -UPDATE `Dog` SET `className` = ?, `color` = ?, `breed` = ? WHERE 1; +UPDATE `Dog` SET `type` = ?, `color` = ?, `breed` = ? WHERE 1; -- -- DELETE template for table `Dog` diff --git a/samples/schema/petstore/mysql/mysql_schema.sql b/samples/schema/petstore/mysql/mysql_schema.sql index d22077b8d129..404de74349fa 100644 --- a/samples/schema/petstore/mysql/mysql_schema.sql +++ b/samples/schema/petstore/mysql/mysql_schema.sql @@ -38,7 +38,7 @@ CREATE TABLE IF NOT EXISTS `AllOfWithSingleRef` ( -- CREATE TABLE IF NOT EXISTS `Animal` ( - `className` TEXT NOT NULL, + `type` TEXT NOT NULL, `color` TEXT ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS `Capitalization` ( -- CREATE TABLE IF NOT EXISTS `Cat` ( - `className` TEXT NOT NULL, + `type` TEXT NOT NULL, `color` TEXT, `declawed` TINYINT(1) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -148,7 +148,7 @@ CREATE TABLE IF NOT EXISTS `DeprecatedObject` ( -- CREATE TABLE IF NOT EXISTS `Dog` ( - `className` TEXT NOT NULL, + `type` TEXT NOT NULL, `color` TEXT, `breed` TEXT DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.cpp b/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.cpp index 787d5c586570..eb625e36cf05 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.cpp +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.cpp @@ -62,7 +62,7 @@ ptree Animal::toPropertyTree() const { ptree pt; ptree tmp_node; - pt.put("className", m_ClassName); + pt.put("type", m_Type); pt.put("color", m_Color); return pt; } @@ -70,18 +70,18 @@ ptree Animal::toPropertyTree() const void Animal::fromPropertyTree(ptree const &pt) { ptree tmp_node; - m_ClassName = pt.get("className", ""); + m_Type = pt.get("type", ""); m_Color = pt.get("color", "red"); } -std::string Animal::getClassName() const +std::string Animal::getType() const { - return m_ClassName; + return m_Type; } -void Animal::setClassName(std::string value) +void Animal::setType(std::string value) { - m_ClassName = value; + m_Type = value; } diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.h b/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.h index 9ebbdb69bafe..e4add2dd0e06 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.h +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.h @@ -60,8 +60,8 @@ class Animal /// /// /// - std::string getClassName() const; - void setClassName(std::string value); + std::string getType() const; + void setType(std::string value); /// /// @@ -70,7 +70,7 @@ class Animal void setColor(std::string value); protected: - std::string m_ClassName = ""; + std::string m_Type = ""; std::string m_Color = "red"; }; diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.cpp b/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.cpp index 4ded45f6347c..7f00ec5f1732 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.cpp +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.cpp @@ -62,7 +62,7 @@ ptree Cat::toPropertyTree() const { ptree pt; ptree tmp_node; - pt.put("className", m_ClassName); + pt.put("type", m_Type); pt.put("color", m_Color); pt.put("declawed", m_Declawed); return pt; @@ -71,19 +71,19 @@ ptree Cat::toPropertyTree() const void Cat::fromPropertyTree(ptree const &pt) { ptree tmp_node; - m_ClassName = pt.get("className", ""); + m_Type = pt.get("type", ""); m_Color = pt.get("color", "red"); m_Declawed = pt.get("declawed", false); } -std::string Cat::getClassName() const +std::string Cat::getType() const { - return m_ClassName; + return m_Type; } -void Cat::setClassName(std::string value) +void Cat::setType(std::string value) { - m_ClassName = value; + m_Type = value; } diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.h b/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.h index 327163e36afd..4beb9e623982 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.h +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.h @@ -63,8 +63,8 @@ class Cat : public Animal, public Cat_allOf /// /// /// - std::string getClassName() const; - void setClassName(std::string value); + std::string getType() const; + void setType(std::string value); /// /// @@ -79,7 +79,7 @@ class Cat : public Animal, public Cat_allOf void setDeclawed(bool value); protected: - std::string m_ClassName = ""; + std::string m_Type = ""; std::string m_Color = "red"; bool m_Declawed = false; }; diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.cpp b/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.cpp index 1224e0034ed1..92ddc11d3425 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.cpp +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.cpp @@ -62,7 +62,7 @@ ptree Dog::toPropertyTree() const { ptree pt; ptree tmp_node; - pt.put("className", m_ClassName); + pt.put("type", m_Type); pt.put("color", m_Color); pt.put("breed", m_Breed); return pt; @@ -71,19 +71,19 @@ ptree Dog::toPropertyTree() const void Dog::fromPropertyTree(ptree const &pt) { ptree tmp_node; - m_ClassName = pt.get("className", ""); + m_Type = pt.get("type", ""); m_Color = pt.get("color", "red"); m_Breed = pt.get("breed", ""); } -std::string Dog::getClassName() const +std::string Dog::getType() const { - return m_ClassName; + return m_Type; } -void Dog::setClassName(std::string value) +void Dog::setType(std::string value) { - m_ClassName = value; + m_Type = value; } diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.h b/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.h index ed3fba175d50..97b4da916cfb 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.h +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.h @@ -63,8 +63,8 @@ class Dog : public Animal, public Dog_allOf /// /// /// - std::string getClassName() const; - void setClassName(std::string value); + std::string getType() const; + void setType(std::string value); /// /// @@ -79,7 +79,7 @@ class Dog : public Animal, public Dog_allOf void setBreed(std::string value); protected: - std::string m_ClassName = ""; + std::string m_Type = ""; std::string m_Color = "red"; std::string m_Breed = ""; }; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java index a5eae51787ce..2b6f5822dcc7 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java @@ -29,42 +29,42 @@ * Animal */ @JsonPropertyOrder({ - Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_TYPE, Animal.JSON_PROPERTY_COLOR }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = Cat.class, name = "Cat"), - @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), }) public class Animal { - public static final String JSON_PROPERTY_CLASS_NAME = "className"; - @JsonProperty(JSON_PROPERTY_CLASS_NAME) - private String className; + public static final String JSON_PROPERTY_TYPE = "type"; + @JsonProperty(JSON_PROPERTY_TYPE) + private String type; public static final String JSON_PROPERTY_COLOR = "color"; @JsonProperty(JSON_PROPERTY_COLOR) private String color = "red"; - public Animal className(String className) { - this.className = className; + public Animal type(String type) { + this.type = type; return this; } /** - * Get className - * @return className + * Get type + * @return type **/ - @JsonProperty(value = "className") + @JsonProperty(value = "type") @ApiModelProperty(required = true, value = "") @NotNull - public String getClassName() { - return className; + public String getType() { + return type; } - public void setClassName(String className) { - this.className = className; + public void setType(String type) { + this.type = type; } public Animal color(String color) { @@ -97,13 +97,13 @@ public boolean equals(Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.className, animal.className) && + return Objects.equals(this.type, animal.type) && Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return Objects.hash(className, color); + return Objects.hash(type, color); } @Override @@ -111,7 +111,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Animal.php b/samples/server/petstore/php-laravel/lib/app/Models/Animal.php index 849e9d293702..c5934c1593fd 100644 --- a/samples/server/petstore/php-laravel/lib/app/Models/Animal.php +++ b/samples/server/petstore/php-laravel/lib/app/Models/Animal.php @@ -9,8 +9,8 @@ */ class Animal { - /** @var string $className */ - public $className = ""; + /** @var string $type */ + public $type = ""; /** @var string $color */ public $color = 'red'; diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Cat.php b/samples/server/petstore/php-laravel/lib/app/Models/Cat.php index dc1051497f72..3209d073e7cd 100644 --- a/samples/server/petstore/php-laravel/lib/app/Models/Cat.php +++ b/samples/server/petstore/php-laravel/lib/app/Models/Cat.php @@ -9,8 +9,8 @@ */ class Cat { - /** @var string $className */ - public $className = ""; + /** @var string $type */ + public $type = ""; /** @var string $color */ public $color = 'red'; diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Dog.php b/samples/server/petstore/php-laravel/lib/app/Models/Dog.php index c089badb0dd9..93ce155f33dc 100644 --- a/samples/server/petstore/php-laravel/lib/app/Models/Dog.php +++ b/samples/server/petstore/php-laravel/lib/app/Models/Dog.php @@ -9,8 +9,8 @@ */ class Dog { - /** @var string $className */ - public $className = ""; + /** @var string $type */ + public $type = ""; /** @var string $color */ public $color = 'red'; From 17f8260e72929089fd58a95e10ce8c17aeb06f42 Mon Sep 17 00:00:00 2001 From: Bernie Schelberg Date: Mon, 20 Feb 2023 09:56:59 +1000 Subject: [PATCH 5/6] Change animal `type` property to `species` --- ...ith-fake-endpoints-models-for-testing.yaml | 6 +-- .../csharp/OpenAPIClient/docs/Animal.md | 2 +- .../petstore/csharp/OpenAPIClient/docs/Cat.md | 2 +- .../petstore/csharp/OpenAPIClient/docs/Dog.md | 2 +- .../src/Org.OpenAPITools/Model/Animal.cs | 32 +++++++------- .../src/Org.OpenAPITools/Model/Cat.cs | 2 +- .../src/Org.OpenAPITools/Model/Dog.cs | 2 +- .../lib/openapi_petstore/model/animal.ex | 4 +- .../elixir/lib/openapi_petstore/model/cat.ex | 4 +- .../elixir/lib/openapi_petstore/model/dog.ex | 4 +- .../java-helidon-client/mp/docs/Animal.md | 2 +- .../org/openapitools/client/model/Animal.java | 22 +++++----- .../java-helidon-client/se/docs/Animal.md | 2 +- .../org/openapitools/client/model/Animal.java | 22 +++++----- .../java/apache-httpclient/api/openapi.yaml | 6 +-- .../java/apache-httpclient/docs/Animal.md | 2 +- .../org/openapitools/client/model/Animal.java | 44 +++++++++---------- .../org/openapitools/client/model/Cat.java | 12 ++--- .../org/openapitools/client/model/Dog.java | 12 ++--- .../petstore/java/feign/api/openapi.yaml | 6 +-- .../org/openapitools/client/model/Animal.java | 38 ++++++++-------- .../org/openapitools/client/model/Cat.java | 6 +-- .../org/openapitools/client/model/Dog.java | 6 +-- .../java/webclient-jakarta/api/openapi.yaml | 6 +-- .../java/webclient-jakarta/docs/Animal.md | 2 +- .../org/openapitools/client/model/Animal.java | 38 ++++++++-------- .../org/openapitools/client/model/Cat.java | 6 +-- .../org/openapitools/client/model/Dog.java | 6 +-- .../petstore/java/webclient/api/openapi.yaml | 6 +-- .../petstore/java/webclient/docs/Animal.md | 2 +- .../org/openapitools/client/model/Animal.java | 38 ++++++++-------- .../org/openapitools/client/model/Cat.java | 6 +-- .../org/openapitools/client/model/Dog.java | 6 +-- samples/client/petstore/perl/docs/Animal.md | 2 +- .../lib/WWW/OpenAPIClient/Object/Animal.pm | 8 ++-- .../OpenAPIClient-php/docs/Model/Animal.md | 2 +- .../OpenAPIClient-php/lib/Model/Animal.php | 40 ++++++++--------- .../petstore/ruby-autoload/docs/Animal.md | 4 +- .../lib/petstore/models/animal.rb | 22 +++++----- .../petstore/ruby-faraday/docs/Animal.md | 4 +- .../lib/petstore/models/animal.rb | 22 +++++----- samples/client/petstore/ruby/docs/Animal.md | 4 +- .../ruby/lib/petstore/models/animal.rb | 22 +++++----- .../builds/default-v3.0/models/Animal.ts | 12 ++--- .../doc/Animal.md | 2 +- .../doc/Cat.md | 2 +- .../doc/Dog.md | 2 +- .../lib/src/model/animal.dart | 10 ++--- .../lib/src/model/cat.dart | 10 ++--- .../lib/src/model/dog.dart | 10 ++--- .../petstore_client_lib_fake/doc/Animal.md | 2 +- .../petstore_client_lib_fake/doc/Cat.md | 2 +- .../petstore_client_lib_fake/doc/Dog.md | 2 +- .../lib/src/model/animal.dart | 16 +++---- .../lib/src/model/cat.dart | 12 ++--- .../lib/src/model/dog.dart | 12 ++--- .../petstore_client_lib_fake/doc/Animal.md | 2 +- .../dart2/petstore_client_lib_fake/doc/Cat.md | 2 +- .../dart2/petstore_client_lib_fake/doc/Dog.md | 2 +- .../lib/model/animal.dart | 16 +++---- .../lib/model/cat.dart | 16 +++---- .../lib/model/dog.dart | 16 +++---- .../petstore/python-legacy/docs/Animal.md | 2 +- .../petstore_api/models/animal.py | 36 +++++++-------- .../schema/petstore/mysql/Model/Animal.sql | 6 +-- samples/schema/petstore/mysql/Model/Cat.sql | 6 +-- samples/schema/petstore/mysql/Model/Dog.sql | 6 +-- .../schema/petstore/mysql/mysql_schema.sql | 6 +-- .../generated/3_0/model/Animal.cpp | 12 ++--- .../cpp-restbed/generated/3_0/model/Animal.h | 6 +-- .../cpp-restbed/generated/3_0/model/Cat.cpp | 12 ++--- .../cpp-restbed/generated/3_0/model/Cat.h | 6 +-- .../cpp-restbed/generated/3_0/model/Dog.cpp | 12 ++--- .../cpp-restbed/generated/3_0/model/Dog.h | 6 +-- .../org/openapitools/server/model/Animal.java | 22 +++++----- .../src/main/resources/META-INF/openapi.yml | 6 +-- .../org/openapitools/server/model/Animal.java | 22 +++++----- .../src/main/resources/META-INF/openapi.yml | 6 +-- .../java/org/openapitools/model/Animal.java | 34 +++++++------- .../php-laravel/lib/app/Models/Animal.php | 4 +- .../php-laravel/lib/app/Models/Cat.php | 4 +- .../php-laravel/lib/app/Models/Dog.php | 4 +- 82 files changed, 426 insertions(+), 426 deletions(-) diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml index 0e2775584a05..dacfc2662650 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1483,14 +1483,14 @@ components: Animal: type: object discriminator: - propertyName: type + propertyName: species mapping: DOG: '#/components/schemas/Dog' CAT: '#/components/schemas/Cat' required: - - type + - species properties: - type: + species: type: string color: type: string diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/Animal.md b/samples/client/petstore/csharp/OpenAPIClient/docs/Animal.md index c12f38993771..c78d7cfe977f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/Animal.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/Animal.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Type** | **string** | | +**Species** | **string** | | **Color** | **string** | | [optional] [default to "red"] [[Back to Model list]](../README.md#documentation-for-models) diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/Cat.md b/samples/client/petstore/csharp/OpenAPIClient/docs/Cat.md index 8239a77a240a..dc85477cdf98 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/Cat.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/Cat.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Type** | **string** | | +**Species** | **string** | | **Color** | **string** | | [optional] [default to "red"] **Declawed** | **bool** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/Dog.md b/samples/client/petstore/csharp/OpenAPIClient/docs/Dog.md index 68dd7bd6d968..3fe42b3db07d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/Dog.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/Dog.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Type** | **string** | | +**Species** | **string** | | **Color** | **string** | | [optional] [default to "red"] **Breed** | **string** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs index 3367265dac34..704b1094b2a1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs @@ -29,7 +29,7 @@ namespace Org.OpenAPITools.Model /// Animal /// [DataContract] - [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonConverter(typeof(JsonSubtypes), "species")] [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] public partial class Animal : IEquatable, IValidatableObject @@ -42,18 +42,18 @@ protected Animal() { } /// /// Initializes a new instance of the class. /// - /// type (required). + /// species (required). /// color (default to "red"). - public Animal(string type = default(string), string color = "red") + public Animal(string species = default(string), string color = "red") { - // to ensure "type" is required (not null) - if (type == null) + // to ensure "species" is required (not null) + if (species == null) { - throw new InvalidDataException("type is a required property for Animal and cannot be null"); + throw new InvalidDataException("species is a required property for Animal and cannot be null"); } else { - this.Type = type; + this.Species = species; } // use default value if no "color" provided @@ -68,10 +68,10 @@ protected Animal() { } } /// - /// Gets or Sets Type + /// Gets or Sets Species /// - [DataMember(Name="type", EmitDefaultValue=true)] - public string Type { get; set; } + [DataMember(Name="species", EmitDefaultValue=true)] + public string Species { get; set; } /// /// Gets or Sets Color @@ -87,7 +87,7 @@ public override string ToString() { var sb = new StringBuilder(); sb.Append("class Animal {\n"); - sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Species: ").Append(Species).Append("\n"); sb.Append(" Color: ").Append(Color).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -124,9 +124,9 @@ public bool Equals(Animal input) return ( - this.Type == input.Type || - (this.Type != null && - this.Type.Equals(input.Type)) + this.Species == input.Species || + (this.Species != null && + this.Species.Equals(input.Species)) ) && ( this.Color == input.Color || @@ -144,8 +144,8 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (this.Type != null) - hashCode = hashCode * 59 + this.Type.GetHashCode(); + if (this.Species != null) + hashCode = hashCode * 59 + this.Species.GetHashCode(); if (this.Color != null) hashCode = hashCode * 59 + this.Color.GetHashCode(); return hashCode; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs index 8b79c026fe0b..d11ad6812cfc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs @@ -39,7 +39,7 @@ protected Cat() { } /// Initializes a new instance of the class. /// /// declawed. - public Cat(bool declawed = default(bool), string type = "Cat", string color = "red") : base(type, color) + public Cat(bool declawed = default(bool), string species = "Cat", string color = "red") : base(species, color) { this.Declawed = declawed; } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs index 551e2db1aa3d..ff5e224d7c7f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs @@ -39,7 +39,7 @@ protected Dog() { } /// Initializes a new instance of the class. /// /// breed. - public Dog(string breed = default(string), string type = "Dog", string color = "red") : base(type, color) + public Dog(string breed = default(string), string species = "Dog", string color = "red") : base(species, color) { this.Breed = breed; } diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex index 1c7236bee37c..6d37c7ec364d 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/animal.ex @@ -8,12 +8,12 @@ defmodule OpenapiPetstore.Model.Animal do @derive [Poison.Encoder] defstruct [ - :type, + :species, :color ] @type t :: %__MODULE__{ - :type => String.t, + :species => String.t, :color => String.t | nil } end diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex index e670cc27c57b..dd8f231537af 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/cat.ex @@ -8,13 +8,13 @@ defmodule OpenapiPetstore.Model.Cat do @derive [Poison.Encoder] defstruct [ - :type, + :species, :color, :declawed ] @type t :: %__MODULE__{ - :type => String.t, + :species => String.t, :color => String.t | nil, :declawed => boolean() | nil } diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex index 41c300a38298..4ec54a3ea2a6 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/dog.ex @@ -8,13 +8,13 @@ defmodule OpenapiPetstore.Model.Dog do @derive [Poison.Encoder] defstruct [ - :type, + :species, :color, :breed ] @type t :: %__MODULE__{ - :type => String.t, + :species => String.t, :color => String.t | nil, :breed => String.t | nil } diff --git a/samples/client/petstore/java-helidon-client/mp/docs/Animal.md b/samples/client/petstore/java-helidon-client/mp/docs/Animal.md index 82a9be30cc3d..8537b65d8302 100644 --- a/samples/client/petstore/java-helidon-client/mp/docs/Animal.md +++ b/samples/client/petstore/java-helidon-client/mp/docs/Animal.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**type** | **String** | | | +|**species** | **String** | | | |**color** | **String** | | [optional] | diff --git a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Animal.java index 389ec85d289c..6ab2d42d1c8e 100644 --- a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/Animal.java @@ -28,27 +28,27 @@ public class Animal { - private String type; + private String species; private String color = "red"; /** - * Get type - * @return type + * Get species + * @return species **/ - public String getType() { - return type; + public String getSpecies() { + return species; } /** - * Set type + * Set species **/ - public void setType(String type) { - this.type = type; + public void setSpecies(String species) { + this.species = species; } - public Animal type(String type) { - this.type = type; + public Animal species(String species) { + this.species = species; return this; } @@ -81,7 +81,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" species: ").append(toIndentedString(species)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java-helidon-client/se/docs/Animal.md b/samples/client/petstore/java-helidon-client/se/docs/Animal.md index 82a9be30cc3d..8537b65d8302 100644 --- a/samples/client/petstore/java-helidon-client/se/docs/Animal.md +++ b/samples/client/petstore/java-helidon-client/se/docs/Animal.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**type** | **String** | | | +|**species** | **String** | | | |**color** | **String** | | [optional] | diff --git a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Animal.java index 389ec85d289c..6ab2d42d1c8e 100644 --- a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/Animal.java @@ -28,27 +28,27 @@ public class Animal { - private String type; + private String species; private String color = "red"; /** - * Get type - * @return type + * Get species + * @return species **/ - public String getType() { - return type; + public String getSpecies() { + return species; } /** - * Set type + * Set species **/ - public void setType(String type) { - this.type = type; + public void setSpecies(String species) { + this.species = species; } - public Animal type(String type) { - this.type = type; + public Animal species(String species) { + this.species = species; return this; } @@ -81,7 +81,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" species: ").append(toIndentedString(species)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml index 65837c687775..18dc4a09453f 100644 --- a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml +++ b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml @@ -1510,15 +1510,15 @@ components: mapping: DOG: '#/components/schemas/Dog' CAT: '#/components/schemas/Cat' - propertyName: type + propertyName: species properties: - type: + species: type: string color: default: red type: string required: - - type + - species type: object AnimalFarm: items: diff --git a/samples/client/petstore/java/apache-httpclient/docs/Animal.md b/samples/client/petstore/java/apache-httpclient/docs/Animal.md index 82a9be30cc3d..8537b65d8302 100644 --- a/samples/client/petstore/java/apache-httpclient/docs/Animal.md +++ b/samples/client/petstore/java/apache-httpclient/docs/Animal.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**type** | **String** | | | +|**species** | **String** | | | |**color** | **String** | | [optional] | diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Animal.java index ee4e8e68c8e4..2d41c7c149e3 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Animal.java @@ -35,23 +35,23 @@ * Animal */ @JsonPropertyOrder({ - Animal.JSON_PROPERTY_TYPE, + Animal.JSON_PROPERTY_SPECIES, Animal.JSON_PROPERTY_COLOR }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), }) public class Animal { - public static final String JSON_PROPERTY_TYPE = "type"; - protected String type; + public static final String JSON_PROPERTY_SPECIES = "species"; + protected String species; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; @@ -59,29 +59,29 @@ public class Animal { public Animal() { } - public Animal type(String type) { + public Animal species(String species) { - this.type = type; + this.species = species; return this; } /** - * Get type - * @return type + * Get species + * @return species **/ @javax.annotation.Nonnull - @JsonProperty(JSON_PROPERTY_TYPE) + @JsonProperty(JSON_PROPERTY_SPECIES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getType() { - return type; + public String getSpecies() { + return species; } - @JsonProperty(JSON_PROPERTY_TYPE) + @JsonProperty(JSON_PROPERTY_SPECIES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(String type) { - this.type = type; + public void setSpecies(String species) { + this.species = species; } @@ -120,20 +120,20 @@ public boolean equals(Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.type, animal.type) && + return Objects.equals(this.species, animal.species) && Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return Objects.hash(type, color); + return Objects.hash(species, color); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" species: ").append(toIndentedString(species)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); @@ -182,10 +182,10 @@ public String toUrlQueryString(String prefix) { StringJoiner joiner = new StringJoiner("&"); - // add `type` to the URL query string - if (getType() != null) { + // add `species` to the URL query string + if (getSpecies() != null) { try { - joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), "UTF-8").replaceAll("\\+", "%20"))); + joiner.add(String.format("%sspecies%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSpecies()), "UTF-8").replaceAll("\\+", "%20"))); } catch (UnsupportedEncodingException e) { // Should never happen, UTF-8 is always supported throw new RuntimeException(e); diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Cat.java index d89ac95ab28d..b909570aff51 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Cat.java @@ -40,10 +40,10 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), @@ -154,10 +154,10 @@ public String toUrlQueryString(String prefix) { StringJoiner joiner = new StringJoiner("&"); - // add `type` to the URL query string - if (getType() != null) { + // add `species` to the URL query string + if (getSpecies() != null) { try { - joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), "UTF-8").replaceAll("\\+", "%20"))); + joiner.add(String.format("%sspecies%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSpecies()), "UTF-8").replaceAll("\\+", "%20"))); } catch (UnsupportedEncodingException e) { // Should never happen, UTF-8 is always supported throw new RuntimeException(e); diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Dog.java index 5aa266f638c2..deb21e79e6fe 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/Dog.java @@ -40,10 +40,10 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), @@ -154,10 +154,10 @@ public String toUrlQueryString(String prefix) { StringJoiner joiner = new StringJoiner("&"); - // add `type` to the URL query string - if (getType() != null) { + // add `species` to the URL query string + if (getSpecies() != null) { try { - joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), "UTF-8").replaceAll("\\+", "%20"))); + joiner.add(String.format("%sspecies%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSpecies()), "UTF-8").replaceAll("\\+", "%20"))); } catch (UnsupportedEncodingException e) { // Should never happen, UTF-8 is always supported throw new RuntimeException(e); diff --git a/samples/client/petstore/java/feign/api/openapi.yaml b/samples/client/petstore/java/feign/api/openapi.yaml index 65837c687775..18dc4a09453f 100644 --- a/samples/client/petstore/java/feign/api/openapi.yaml +++ b/samples/client/petstore/java/feign/api/openapi.yaml @@ -1510,15 +1510,15 @@ components: mapping: DOG: '#/components/schemas/Dog' CAT: '#/components/schemas/Cat' - propertyName: type + propertyName: species properties: - type: + species: type: string color: default: red type: string required: - - type + - species type: object AnimalFarm: items: diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java index 3bd908e49068..5636220ba65a 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java @@ -32,23 +32,23 @@ * Animal */ @JsonPropertyOrder({ - Animal.JSON_PROPERTY_TYPE, + Animal.JSON_PROPERTY_SPECIES, Animal.JSON_PROPERTY_COLOR }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), }) public class Animal { - public static final String JSON_PROPERTY_TYPE = "type"; - protected String type; + public static final String JSON_PROPERTY_SPECIES = "species"; + protected String species; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; @@ -56,29 +56,29 @@ public class Animal { public Animal() { } - public Animal type(String type) { + public Animal species(String species) { - this.type = type; + this.species = species; return this; } /** - * Get type - * @return type + * Get species + * @return species **/ @javax.annotation.Nonnull - @JsonProperty(JSON_PROPERTY_TYPE) + @JsonProperty(JSON_PROPERTY_SPECIES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getType() { - return type; + public String getSpecies() { + return species; } - @JsonProperty(JSON_PROPERTY_TYPE) + @JsonProperty(JSON_PROPERTY_SPECIES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(String type) { - this.type = type; + public void setSpecies(String species) { + this.species = species; } @@ -117,20 +117,20 @@ public boolean equals(Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.type, animal.type) && + return Objects.equals(this.species, animal.species) && Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return Objects.hash(type, color); + return Objects.hash(species, color); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" species: ").append(toIndentedString(species)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java index 054eb8bf2d16..a0a1f78ea53f 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Cat.java @@ -37,10 +37,10 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java index 7cbfcccc75ea..0c577d08b164 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Dog.java @@ -37,10 +37,10 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), diff --git a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml index 65837c687775..18dc4a09453f 100644 --- a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml @@ -1510,15 +1510,15 @@ components: mapping: DOG: '#/components/schemas/Dog' CAT: '#/components/schemas/Cat' - propertyName: type + propertyName: species properties: - type: + species: type: string color: default: red type: string required: - - type + - species type: object AnimalFarm: items: diff --git a/samples/client/petstore/java/webclient-jakarta/docs/Animal.md b/samples/client/petstore/java/webclient-jakarta/docs/Animal.md index 82a9be30cc3d..8537b65d8302 100644 --- a/samples/client/petstore/java/webclient-jakarta/docs/Animal.md +++ b/samples/client/petstore/java/webclient-jakarta/docs/Animal.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**type** | **String** | | | +|**species** | **String** | | | |**color** | **String** | | [optional] | diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Animal.java index 5f4687c5e6b4..0741316c55d0 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Animal.java @@ -32,23 +32,23 @@ * Animal */ @JsonPropertyOrder({ - Animal.JSON_PROPERTY_TYPE, + Animal.JSON_PROPERTY_SPECIES, Animal.JSON_PROPERTY_COLOR }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), }) public class Animal { - public static final String JSON_PROPERTY_TYPE = "type"; - protected String type; + public static final String JSON_PROPERTY_SPECIES = "species"; + protected String species; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; @@ -56,29 +56,29 @@ public class Animal { public Animal() { } - public Animal type(String type) { + public Animal species(String species) { - this.type = type; + this.species = species; return this; } /** - * Get type - * @return type + * Get species + * @return species **/ @jakarta.annotation.Nonnull - @JsonProperty(JSON_PROPERTY_TYPE) + @JsonProperty(JSON_PROPERTY_SPECIES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getType() { - return type; + public String getSpecies() { + return species; } - @JsonProperty(JSON_PROPERTY_TYPE) + @JsonProperty(JSON_PROPERTY_SPECIES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(String type) { - this.type = type; + public void setSpecies(String species) { + this.species = species; } @@ -117,20 +117,20 @@ public boolean equals(Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.type, animal.type) && + return Objects.equals(this.species, animal.species) && Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return Objects.hash(type, color); + return Objects.hash(species, color); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" species: ").append(toIndentedString(species)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Cat.java index 852482efa2a7..8af9e82885e2 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Cat.java @@ -37,10 +37,10 @@ }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Dog.java index 0d235f69c63c..b8e2fa97fc68 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/Dog.java @@ -37,10 +37,10 @@ }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), diff --git a/samples/client/petstore/java/webclient/api/openapi.yaml b/samples/client/petstore/java/webclient/api/openapi.yaml index 65837c687775..18dc4a09453f 100644 --- a/samples/client/petstore/java/webclient/api/openapi.yaml +++ b/samples/client/petstore/java/webclient/api/openapi.yaml @@ -1510,15 +1510,15 @@ components: mapping: DOG: '#/components/schemas/Dog' CAT: '#/components/schemas/Cat' - propertyName: type + propertyName: species properties: - type: + species: type: string color: default: red type: string required: - - type + - species type: object AnimalFarm: items: diff --git a/samples/client/petstore/java/webclient/docs/Animal.md b/samples/client/petstore/java/webclient/docs/Animal.md index 82a9be30cc3d..8537b65d8302 100644 --- a/samples/client/petstore/java/webclient/docs/Animal.md +++ b/samples/client/petstore/java/webclient/docs/Animal.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**type** | **String** | | | +|**species** | **String** | | | |**color** | **String** | | [optional] | diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java index 3bd908e49068..5636220ba65a 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java @@ -32,23 +32,23 @@ * Animal */ @JsonPropertyOrder({ - Animal.JSON_PROPERTY_TYPE, + Animal.JSON_PROPERTY_SPECIES, Animal.JSON_PROPERTY_COLOR }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), }) public class Animal { - public static final String JSON_PROPERTY_TYPE = "type"; - protected String type; + public static final String JSON_PROPERTY_SPECIES = "species"; + protected String species; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; @@ -56,29 +56,29 @@ public class Animal { public Animal() { } - public Animal type(String type) { + public Animal species(String species) { - this.type = type; + this.species = species; return this; } /** - * Get type - * @return type + * Get species + * @return species **/ @javax.annotation.Nonnull - @JsonProperty(JSON_PROPERTY_TYPE) + @JsonProperty(JSON_PROPERTY_SPECIES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getType() { - return type; + public String getSpecies() { + return species; } - @JsonProperty(JSON_PROPERTY_TYPE) + @JsonProperty(JSON_PROPERTY_SPECIES) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(String type) { - this.type = type; + public void setSpecies(String species) { + this.species = species; } @@ -117,20 +117,20 @@ public boolean equals(Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.type, animal.type) && + return Objects.equals(this.species, animal.species) && Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return Objects.hash(type, color); + return Objects.hash(species, color); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" species: ").append(toIndentedString(species)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java index fae6a98a3f5b..bdf8755618be 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java @@ -37,10 +37,10 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java index 7cbfcccc75ea..0c577d08b164 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java @@ -37,10 +37,10 @@ }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonIgnoreProperties( - value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the type to be set during deserialization + value = "species", // ignore manually set species, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the species to be set during deserialization ) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), diff --git a/samples/client/petstore/perl/docs/Animal.md b/samples/client/petstore/perl/docs/Animal.md index 5d3d259cea3b..c32a30ab2fa6 100644 --- a/samples/client/petstore/perl/docs/Animal.md +++ b/samples/client/petstore/perl/docs/Animal.md @@ -8,7 +8,7 @@ use WWW::OpenAPIClient::Object::Animal; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **string** | | +**species** | **string** | | **color** | **string** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm index 19fe96cafe3a..25a76da9d719 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm @@ -219,9 +219,9 @@ __PACKAGE__->class_documentation({description => '', } ); __PACKAGE__->method_documentation({ - 'type' => { + 'species' => { datatype => 'string', - base_name => 'type', + base_name => 'species', description => '', format => '', read_only => '', @@ -236,12 +236,12 @@ __PACKAGE__->method_documentation({ }); __PACKAGE__->openapi_types( { - 'type' => 'string', + 'species' => 'string', 'color' => 'string' } ); __PACKAGE__->attribute_map( { - 'type' => 'type', + 'species' => 'species', 'color' => 'color' } ); diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Animal.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Animal.md index 8fd46a2f55c7..57886d7cd5c7 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Animal.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/Animal.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **string** | | +**species** | **string** | | **color** | **string** | | [optional] [default to 'red'] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php index a37bbe8f751c..2364697a9f9f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php @@ -42,7 +42,7 @@ */ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable { - public const DISCRIMINATOR = 'type'; + public const DISCRIMINATOR = 'species'; /** * The original name of the model. @@ -57,7 +57,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'type' => 'string', + 'species' => 'string', 'color' => 'string' ]; @@ -69,7 +69,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'type' => null, + 'species' => null, 'color' => null ]; @@ -79,7 +79,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ - 'type' => false, + 'species' => false, 'color' => false ]; @@ -169,7 +169,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'type' => 'type', + 'species' => 'species', 'color' => 'color' ]; @@ -179,7 +179,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'type' => 'setType', + 'species' => 'setSpecies', 'color' => 'setColor' ]; @@ -189,7 +189,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'type' => 'getType', + 'species' => 'getSpecies', 'color' => 'getColor' ]; @@ -250,11 +250,11 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('species', $data ?? [], null); $this->setIfExists('color', $data ?? [], 'red'); // Initialize discriminator property with the model name. - $this->container['type'] = static::$openAPIModelName; + $this->container['species'] = static::$openAPIModelName; } /** @@ -284,8 +284,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['type'] === null) { - $invalidProperties[] = "'type' can't be null"; + if ($this->container['species'] === null) { + $invalidProperties[] = "'species' can't be null"; } return $invalidProperties; } @@ -303,28 +303,28 @@ public function valid() /** - * Gets type + * Gets species * * @return string */ - public function getType() + public function getSpecies() { - return $this->container['type']; + return $this->container['species']; } /** - * Sets type + * Sets species * - * @param string $type type + * @param string $species species * * @return self */ - public function setType($type) + public function setSpecies($species) { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); + if (is_null($species)) { + throw new \InvalidArgumentException('non-nullable species cannot be null'); } - $this->container['type'] = $type; + $this->container['species'] = $species; return $this; } diff --git a/samples/client/petstore/ruby-autoload/docs/Animal.md b/samples/client/petstore/ruby-autoload/docs/Animal.md index 0f282bd41f0e..ce7b2a43991a 100644 --- a/samples/client/petstore/ruby-autoload/docs/Animal.md +++ b/samples/client/petstore/ruby-autoload/docs/Animal.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **type** | **String** | | | +| **species** | **String** | | | | **color** | **String** | | [optional][default to 'red'] | ## Example @@ -13,7 +13,7 @@ require 'petstore' instance = Petstore::Animal.new( - type: null, + species: null, color: null ) ``` diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb index 0cf77674fe5d..f7a18010986d 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/animal.rb @@ -15,14 +15,14 @@ module Petstore class Animal - attr_accessor :type + attr_accessor :species attr_accessor :color # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'type' => :'type', + :'species' => :'species', :'color' => :'color' } end @@ -35,7 +35,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'type' => :'String', + :'species' => :'String', :'color' => :'String' } end @@ -48,7 +48,7 @@ def self.openapi_nullable # discriminator's property name in OpenAPI v3 def self.openapi_discriminator_name - :'type' + :'species' end # Initializes the object @@ -66,8 +66,8 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'type') - self.type = attributes[:'type'] + if attributes.key?(:'species') + self.species = attributes[:'species'] end if attributes.key?(:'color') @@ -81,8 +81,8 @@ def initialize(attributes = {}) # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') + if @species.nil? + invalid_properties.push('invalid value for "species", species cannot be nil.') end invalid_properties @@ -91,7 +91,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return false if @type.nil? + return false if @species.nil? true end @@ -100,7 +100,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - type == o.type && + species == o.species && color == o.color end @@ -113,7 +113,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [type, color].hash + [species, color].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby-faraday/docs/Animal.md b/samples/client/petstore/ruby-faraday/docs/Animal.md index 0f282bd41f0e..ce7b2a43991a 100644 --- a/samples/client/petstore/ruby-faraday/docs/Animal.md +++ b/samples/client/petstore/ruby-faraday/docs/Animal.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **type** | **String** | | | +| **species** | **String** | | | | **color** | **String** | | [optional][default to 'red'] | ## Example @@ -13,7 +13,7 @@ require 'petstore' instance = Petstore::Animal.new( - type: null, + species: null, color: null ) ``` diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb index 0cf77674fe5d..f7a18010986d 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/animal.rb @@ -15,14 +15,14 @@ module Petstore class Animal - attr_accessor :type + attr_accessor :species attr_accessor :color # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'type' => :'type', + :'species' => :'species', :'color' => :'color' } end @@ -35,7 +35,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'type' => :'String', + :'species' => :'String', :'color' => :'String' } end @@ -48,7 +48,7 @@ def self.openapi_nullable # discriminator's property name in OpenAPI v3 def self.openapi_discriminator_name - :'type' + :'species' end # Initializes the object @@ -66,8 +66,8 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'type') - self.type = attributes[:'type'] + if attributes.key?(:'species') + self.species = attributes[:'species'] end if attributes.key?(:'color') @@ -81,8 +81,8 @@ def initialize(attributes = {}) # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') + if @species.nil? + invalid_properties.push('invalid value for "species", species cannot be nil.') end invalid_properties @@ -91,7 +91,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return false if @type.nil? + return false if @species.nil? true end @@ -100,7 +100,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - type == o.type && + species == o.species && color == o.color end @@ -113,7 +113,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [type, color].hash + [species, color].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby/docs/Animal.md b/samples/client/petstore/ruby/docs/Animal.md index 0f282bd41f0e..ce7b2a43991a 100644 --- a/samples/client/petstore/ruby/docs/Animal.md +++ b/samples/client/petstore/ruby/docs/Animal.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **type** | **String** | | | +| **species** | **String** | | | | **color** | **String** | | [optional][default to 'red'] | ## Example @@ -13,7 +13,7 @@ require 'petstore' instance = Petstore::Animal.new( - type: null, + species: null, color: null ) ``` diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal.rb b/samples/client/petstore/ruby/lib/petstore/models/animal.rb index 0cf77674fe5d..f7a18010986d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/animal.rb @@ -15,14 +15,14 @@ module Petstore class Animal - attr_accessor :type + attr_accessor :species attr_accessor :color # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'type' => :'type', + :'species' => :'species', :'color' => :'color' } end @@ -35,7 +35,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'type' => :'String', + :'species' => :'String', :'color' => :'String' } end @@ -48,7 +48,7 @@ def self.openapi_nullable # discriminator's property name in OpenAPI v3 def self.openapi_discriminator_name - :'type' + :'species' end # Initializes the object @@ -66,8 +66,8 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'type') - self.type = attributes[:'type'] + if attributes.key?(:'species') + self.species = attributes[:'species'] end if attributes.key?(:'color') @@ -81,8 +81,8 @@ def initialize(attributes = {}) # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new - if @type.nil? - invalid_properties.push('invalid value for "type", type cannot be nil.') + if @species.nil? + invalid_properties.push('invalid value for "species", species cannot be nil.') end invalid_properties @@ -91,7 +91,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return false if @type.nil? + return false if @species.nil? true end @@ -100,7 +100,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - type == o.type && + species == o.species && color == o.color end @@ -113,7 +113,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [type, color].hash + [species, color].hash end # Builds the object from hash diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts index 8a883d23db48..6bd5a06dc190 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts @@ -29,7 +29,7 @@ export interface Animal { * @type {string} * @memberof Animal */ - type: string; + species: string; /** * * @type {string} @@ -43,7 +43,7 @@ export interface Animal { */ export function instanceOfAnimal(value: object): boolean { let isInstance = true; - isInstance = isInstance && "type" in value; + isInstance = isInstance && "species" in value; return isInstance; } @@ -57,16 +57,16 @@ export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): An return json; } if (!ignoreDiscriminator) { - if (json['type'] === 'CAT') { + if (json['species'] === 'CAT') { return CatFromJSONTyped(json, true); } - if (json['type'] === 'DOG') { + if (json['species'] === 'DOG') { return DogFromJSONTyped(json, true); } } return { - 'type': json['type'], + 'species': json['species'], 'color': !exists(json, 'color') ? undefined : json['color'], }; } @@ -80,7 +80,7 @@ export function AnimalToJSON(value?: Animal | null): any { } return { - 'type': value.type, + 'species': value.species, 'color': value.color, }; } diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Animal.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Animal.md index 8d7a316ca181..da74d93dcd26 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Animal.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Animal.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **String** | | +**species** | **String** | | **color** | **String** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Cat.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Cat.md index 9bef6f5f6068..e19d1566d32e 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Cat.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Cat.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **String** | | +**species** | **String** | | **color** | **String** | | [optional] [default to 'red'] **declawed** | **bool** | | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Dog.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Dog.md index fc49707080dd..61763aecfc0c 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Dog.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/Dog.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **String** | | +**species** | **String** | | **color** | **String** | | [optional] [default to 'red'] **breed** | **String** | | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/animal.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/animal.dart index e2757821dc40..432c1cedd018 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/animal.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/animal.dart @@ -18,20 +18,20 @@ class Animal { /// Returns a new [Animal] instance. Animal({ - required this.type, + required this.species, this.color = 'red', }); @JsonKey( - name: r'type', + name: r'species', required: true, includeIfNull: false ) - final String type; + final String species; @@ -49,12 +49,12 @@ class Animal { @override bool operator ==(Object other) => identical(this, other) || other is Animal && - other.type == type && + other.species == species && other.color == color; @override int get hashCode => - type.hashCode + + species.hashCode + color.hashCode; factory Animal.fromJson(Map json) => _$AnimalFromJson(json); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/cat.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/cat.dart index 18c2f68c5ec2..84a4bff1046e 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/cat.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/cat.dart @@ -21,7 +21,7 @@ class Cat { /// Returns a new [Cat] instance. Cat({ - required this.type, + required this.species, this.color = 'red', @@ -30,13 +30,13 @@ class Cat { @JsonKey( - name: r'type', + name: r'species', required: true, includeIfNull: false ) - final String type; + final String species; @@ -66,13 +66,13 @@ class Cat { @override bool operator ==(Object other) => identical(this, other) || other is Cat && - other.type == type && + other.species == species && other.color == color && other.declawed == declawed; @override int get hashCode => - type.hashCode + + species.hashCode + color.hashCode + declawed.hashCode; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/dog.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/dog.dart index ed4cae09f3bf..fe53464b846a 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/dog.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/dog.dart @@ -21,7 +21,7 @@ class Dog { /// Returns a new [Dog] instance. Dog({ - required this.type, + required this.species, this.color = 'red', @@ -30,13 +30,13 @@ class Dog { @JsonKey( - name: r'type', + name: r'species', required: true, includeIfNull: false ) - final String type; + final String species; @@ -66,13 +66,13 @@ class Dog { @override bool operator ==(Object other) => identical(this, other) || other is Dog && - other.type == type && + other.species == species && other.color == color && other.breed == breed; @override int get hashCode => - type.hashCode + + species.hashCode + color.hashCode + breed.hashCode; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md index 8d7a316ca181..da74d93dcd26 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Animal.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **String** | | +**species** | **String** | | **color** | **String** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md index 9bef6f5f6068..e19d1566d32e 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Cat.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **String** | | +**species** | **String** | | **color** | **String** | | [optional] [default to 'red'] **declawed** | **bool** | | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md index fc49707080dd..61763aecfc0c 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Dog.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **String** | | +**species** | **String** | | **color** | **String** | | [optional] [default to 'red'] **breed** | **String** | | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/animal.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/animal.dart index 4c0fe831ec21..7088a371d9e9 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/animal.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/animal.dart @@ -13,17 +13,17 @@ part 'animal.g.dart'; /// Animal /// /// Properties: -/// * [type] +/// * [species] /// * [color] @BuiltValue(instantiable: false) abstract class Animal { - @BuiltValueField(wireName: r'type') - String get type; + @BuiltValueField(wireName: r'species') + String get species; @BuiltValueField(wireName: r'color') String? get color; - static const String discriminatorFieldName = r'type'; + static const String discriminatorFieldName = r'species'; static const Map discriminatorMapping = { r'CAT': Cat, @@ -69,9 +69,9 @@ class _$AnimalSerializer implements PrimitiveSerializer { Animal object, { FullType specifiedType = FullType.unspecified, }) sync* { - yield r'type'; + yield r'species'; yield serializers.serialize( - object.type, + object.species, specifiedType: const FullType(String), ); if (object.color != null) { @@ -160,12 +160,12 @@ class _$$AnimalSerializer implements PrimitiveSerializer<$Animal> { final key = serializedList[i] as String; final value = serializedList[i + 1]; switch (key) { - case r'type': + case r'species': final valueDes = serializers.deserialize( value, specifiedType: const FullType(String), ) as String; - result.type = valueDes; + result.species = valueDes; break; case r'color': final valueDes = serializers.deserialize( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/cat.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/cat.dart index 8c745718481f..68ad32f9e729 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/cat.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/cat.dart @@ -15,7 +15,7 @@ part 'cat.g.dart'; /// Cat /// /// Properties: -/// * [type] +/// * [species] /// * [color] /// * [declawed] @BuiltValue() @@ -25,7 +25,7 @@ abstract class Cat implements Animal, CatAllOf, Built { factory Cat([void updates(CatBuilder b)]) = _$Cat; @BuiltValueHook(initializeBuilder: true) - static void _defaults(CatBuilder b) => b..type=b.discriminatorValue + static void _defaults(CatBuilder b) => b..species=b.discriminatorValue ..color = 'red'; @BuiltValueSerializer(custom: true) @@ -51,9 +51,9 @@ class _$CatSerializer implements PrimitiveSerializer { specifiedType: const FullType(String), ); } - yield r'type'; + yield r'species'; yield serializers.serialize( - object.type, + object.species, specifiedType: const FullType(String), ); if (object.declawed != null) { @@ -93,12 +93,12 @@ class _$CatSerializer implements PrimitiveSerializer { ) as String; result.color = valueDes; break; - case r'type': + case r'species': final valueDes = serializers.deserialize( value, specifiedType: const FullType(String), ) as String; - result.type = valueDes; + result.species = valueDes; break; case r'declawed': final valueDes = serializers.deserialize( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/dog.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/dog.dart index 8d25e67daa6e..0687c32e164a 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/dog.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/dog.dart @@ -15,7 +15,7 @@ part 'dog.g.dart'; /// Dog /// /// Properties: -/// * [type] +/// * [species] /// * [color] /// * [breed] @BuiltValue() @@ -25,7 +25,7 @@ abstract class Dog implements Animal, DogAllOf, Built { factory Dog([void updates(DogBuilder b)]) = _$Dog; @BuiltValueHook(initializeBuilder: true) - static void _defaults(DogBuilder b) => b..type=b.discriminatorValue + static void _defaults(DogBuilder b) => b..species=b.discriminatorValue ..color = 'red'; @BuiltValueSerializer(custom: true) @@ -51,9 +51,9 @@ class _$DogSerializer implements PrimitiveSerializer { specifiedType: const FullType(String), ); } - yield r'type'; + yield r'species'; yield serializers.serialize( - object.type, + object.species, specifiedType: const FullType(String), ); if (object.breed != null) { @@ -93,12 +93,12 @@ class _$DogSerializer implements PrimitiveSerializer { ) as String; result.color = valueDes; break; - case r'type': + case r'species': final valueDes = serializers.deserialize( value, specifiedType: const FullType(String), ) as String; - result.type = valueDes; + result.species = valueDes; break; case r'breed': final valueDes = serializers.deserialize( diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md index 8d7a316ca181..da74d93dcd26 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Animal.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **String** | | +**species** | **String** | | **color** | **String** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md index 9bef6f5f6068..e19d1566d32e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Cat.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **String** | | +**species** | **String** | | **color** | **String** | | [optional] [default to 'red'] **declawed** | **bool** | | [optional] diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md index fc49707080dd..61763aecfc0c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Dog.md @@ -8,7 +8,7 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **String** | | +**species** | **String** | | **color** | **String** | | [optional] [default to 'red'] **breed** | **String** | | [optional] diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart index 42420687167b..99c720af4fea 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart @@ -13,31 +13,31 @@ part of openapi.api; class Animal { /// Returns a new [Animal] instance. Animal({ - required this.type, + required this.species, this.color = 'red', }); - String type; + String species; String color; @override bool operator ==(Object other) => identical(this, other) || other is Animal && - other.type == type && + other.species == species && other.color == color; @override int get hashCode => // ignore: unnecessary_parenthesis - (type.hashCode) + + (species.hashCode) + (color.hashCode); @override - String toString() => 'Animal[type=$type, color=$color]'; + String toString() => 'Animal[species=$species, color=$color]'; Map toJson() { final json = {}; - json[r'type'] = this.type; + json[r'species'] = this.species; json[r'color'] = this.color; return json; } @@ -61,7 +61,7 @@ class Animal { }()); return Animal( - type: mapValueOfType(json, r'type')!, + species: mapValueOfType(json, r'species')!, color: mapValueOfType(json, r'color') ?? 'red', ); } @@ -112,7 +112,7 @@ class Animal { /// The list of required keys that must be present in a JSON. static const requiredKeys = { - 'type', + 'species', }; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart index 062ae55ad063..c1854ab47a43 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart @@ -13,12 +13,12 @@ part of openapi.api; class Cat { /// Returns a new [Cat] instance. Cat({ - required this.type, + required this.species, this.color = 'red', this.declawed, }); - String type; + String species; String color; @@ -32,23 +32,23 @@ class Cat { @override bool operator ==(Object other) => identical(this, other) || other is Cat && - other.type == type && + other.species == species && other.color == color && other.declawed == declawed; @override int get hashCode => // ignore: unnecessary_parenthesis - (type.hashCode) + + (species.hashCode) + (color.hashCode) + (declawed == null ? 0 : declawed!.hashCode); @override - String toString() => 'Cat[type=$type, color=$color, declawed=$declawed]'; + String toString() => 'Cat[species=$species, color=$color, declawed=$declawed]'; Map toJson() { final json = {}; - json[r'type'] = this.type; + json[r'species'] = this.species; json[r'color'] = this.color; if (this.declawed != null) { json[r'declawed'] = this.declawed; @@ -77,7 +77,7 @@ class Cat { }()); return Cat( - type: mapValueOfType(json, r'type')!, + species: mapValueOfType(json, r'species')!, color: mapValueOfType(json, r'color') ?? 'red', declawed: mapValueOfType(json, r'declawed'), ); @@ -129,7 +129,7 @@ class Cat { /// The list of required keys that must be present in a JSON. static const requiredKeys = { - 'type', + 'species', }; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart index c53b49e1f52f..a767abc31198 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart @@ -13,12 +13,12 @@ part of openapi.api; class Dog { /// Returns a new [Dog] instance. Dog({ - required this.type, + required this.species, this.color = 'red', this.breed, }); - String type; + String species; String color; @@ -32,23 +32,23 @@ class Dog { @override bool operator ==(Object other) => identical(this, other) || other is Dog && - other.type == type && + other.species == species && other.color == color && other.breed == breed; @override int get hashCode => // ignore: unnecessary_parenthesis - (type.hashCode) + + (species.hashCode) + (color.hashCode) + (breed == null ? 0 : breed!.hashCode); @override - String toString() => 'Dog[type=$type, color=$color, breed=$breed]'; + String toString() => 'Dog[species=$species, color=$color, breed=$breed]'; Map toJson() { final json = {}; - json[r'type'] = this.type; + json[r'species'] = this.species; json[r'color'] = this.color; if (this.breed != null) { json[r'breed'] = this.breed; @@ -77,7 +77,7 @@ class Dog { }()); return Dog( - type: mapValueOfType(json, r'type')!, + species: mapValueOfType(json, r'species')!, color: mapValueOfType(json, r'color') ?? 'red', breed: mapValueOfType(json, r'breed'), ); @@ -129,7 +129,7 @@ class Dog { /// The list of required keys that must be present in a JSON. static const requiredKeys = { - 'type', + 'species', }; } diff --git a/samples/openapi3/client/petstore/python-legacy/docs/Animal.md b/samples/openapi3/client/petstore/python-legacy/docs/Animal.md index 9a0ba18768cb..34676c187ff6 100755 --- a/samples/openapi3/client/petstore/python-legacy/docs/Animal.md +++ b/samples/openapi3/client/petstore/python-legacy/docs/Animal.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **str** | | +**species** | **str** | | **color** | **str** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/python-legacy/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/animal.py index 721b0231b121..8ae82dd7a3c6 100755 --- a/samples/openapi3/client/petstore/python-legacy/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/animal.py @@ -36,12 +36,12 @@ class Animal(object): and the value is json key in definition. """ openapi_types = { - 'type': 'str', + 'species': 'str', 'color': 'str' } attribute_map = { - 'type': 'type', + 'species': 'species', 'color': 'color' } @@ -50,42 +50,42 @@ class Animal(object): 'Dog': 'Dog' } - def __init__(self, type=None, color='red', local_vars_configuration=None): # noqa: E501 + def __init__(self, species=None, color='red', local_vars_configuration=None): # noqa: E501 """Animal - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration.get_default_copy() self.local_vars_configuration = local_vars_configuration - self._type = None + self._species = None self._color = None - self.discriminator = 'type' + self.discriminator = 'species' - self.type = type + self.species = species if color is not None: self.color = color @property - def type(self): - """Gets the type of this Animal. # noqa: E501 + def species(self): + """Gets the species of this Animal. # noqa: E501 - :return: The type of this Animal. # noqa: E501 + :return: The species of this Animal. # noqa: E501 :rtype: str """ - return self._type + return self._species - @type.setter - def type(self, type): - """Sets the type of this Animal. + @species.setter + def species(self, species): + """Sets the species of this Animal. - :param type: The type of this Animal. # noqa: E501 - :type type: str + :param species: The species of this Animal. # noqa: E501 + :type species: str """ - if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501 - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + if self.local_vars_configuration.client_side_validation and species is None: # noqa: E501 + raise ValueError("Invalid value for `species`, must not be `None`") # noqa: E501 - self._type = type + self._species = species @property def color(self): diff --git a/samples/schema/petstore/mysql/Model/Animal.sql b/samples/schema/petstore/mysql/Model/Animal.sql index 4da7db44b774..0b5fe3fdf551 100644 --- a/samples/schema/petstore/mysql/Model/Animal.sql +++ b/samples/schema/petstore/mysql/Model/Animal.sql @@ -7,17 +7,17 @@ -- -- SELECT template for table `Animal` -- -SELECT `type`, `color` FROM `Animal` WHERE 1; +SELECT `species`, `color` FROM `Animal` WHERE 1; -- -- INSERT template for table `Animal` -- -INSERT INTO `Animal`(`type`, `color`) VALUES (?, ?); +INSERT INTO `Animal`(`species`, `color`) VALUES (?, ?); -- -- UPDATE template for table `Animal` -- -UPDATE `Animal` SET `type` = ?, `color` = ? WHERE 1; +UPDATE `Animal` SET `species` = ?, `color` = ? WHERE 1; -- -- DELETE template for table `Animal` diff --git a/samples/schema/petstore/mysql/Model/Cat.sql b/samples/schema/petstore/mysql/Model/Cat.sql index a260d3d77697..24a33ea679ce 100644 --- a/samples/schema/petstore/mysql/Model/Cat.sql +++ b/samples/schema/petstore/mysql/Model/Cat.sql @@ -7,17 +7,17 @@ -- -- SELECT template for table `Cat` -- -SELECT `type`, `color`, `declawed` FROM `Cat` WHERE 1; +SELECT `species`, `color`, `declawed` FROM `Cat` WHERE 1; -- -- INSERT template for table `Cat` -- -INSERT INTO `Cat`(`type`, `color`, `declawed`) VALUES (?, ?, ?); +INSERT INTO `Cat`(`species`, `color`, `declawed`) VALUES (?, ?, ?); -- -- UPDATE template for table `Cat` -- -UPDATE `Cat` SET `type` = ?, `color` = ?, `declawed` = ? WHERE 1; +UPDATE `Cat` SET `species` = ?, `color` = ?, `declawed` = ? WHERE 1; -- -- DELETE template for table `Cat` diff --git a/samples/schema/petstore/mysql/Model/Dog.sql b/samples/schema/petstore/mysql/Model/Dog.sql index a843fde0fdbb..10408b31a3a2 100644 --- a/samples/schema/petstore/mysql/Model/Dog.sql +++ b/samples/schema/petstore/mysql/Model/Dog.sql @@ -7,17 +7,17 @@ -- -- SELECT template for table `Dog` -- -SELECT `type`, `color`, `breed` FROM `Dog` WHERE 1; +SELECT `species`, `color`, `breed` FROM `Dog` WHERE 1; -- -- INSERT template for table `Dog` -- -INSERT INTO `Dog`(`type`, `color`, `breed`) VALUES (?, ?, ?); +INSERT INTO `Dog`(`species`, `color`, `breed`) VALUES (?, ?, ?); -- -- UPDATE template for table `Dog` -- -UPDATE `Dog` SET `type` = ?, `color` = ?, `breed` = ? WHERE 1; +UPDATE `Dog` SET `species` = ?, `color` = ?, `breed` = ? WHERE 1; -- -- DELETE template for table `Dog` diff --git a/samples/schema/petstore/mysql/mysql_schema.sql b/samples/schema/petstore/mysql/mysql_schema.sql index 404de74349fa..8917cd73da1c 100644 --- a/samples/schema/petstore/mysql/mysql_schema.sql +++ b/samples/schema/petstore/mysql/mysql_schema.sql @@ -38,7 +38,7 @@ CREATE TABLE IF NOT EXISTS `AllOfWithSingleRef` ( -- CREATE TABLE IF NOT EXISTS `Animal` ( - `type` TEXT NOT NULL, + `species` TEXT NOT NULL, `color` TEXT ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS `Capitalization` ( -- CREATE TABLE IF NOT EXISTS `Cat` ( - `type` TEXT NOT NULL, + `species` TEXT NOT NULL, `color` TEXT, `declawed` TINYINT(1) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -148,7 +148,7 @@ CREATE TABLE IF NOT EXISTS `DeprecatedObject` ( -- CREATE TABLE IF NOT EXISTS `Dog` ( - `type` TEXT NOT NULL, + `species` TEXT NOT NULL, `color` TEXT, `breed` TEXT DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.cpp b/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.cpp index eb625e36cf05..5f7ca18a7dc5 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.cpp +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.cpp @@ -62,7 +62,7 @@ ptree Animal::toPropertyTree() const { ptree pt; ptree tmp_node; - pt.put("type", m_Type); + pt.put("species", m_Species); pt.put("color", m_Color); return pt; } @@ -70,18 +70,18 @@ ptree Animal::toPropertyTree() const void Animal::fromPropertyTree(ptree const &pt) { ptree tmp_node; - m_Type = pt.get("type", ""); + m_Species = pt.get("species", ""); m_Color = pt.get("color", "red"); } -std::string Animal::getType() const +std::string Animal::getSpecies() const { - return m_Type; + return m_Species; } -void Animal::setType(std::string value) +void Animal::setSpecies(std::string value) { - m_Type = value; + m_Species = value; } diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.h b/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.h index e4add2dd0e06..d6ea49ad8d2f 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.h +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Animal.h @@ -60,8 +60,8 @@ class Animal /// /// /// - std::string getType() const; - void setType(std::string value); + std::string getSpecies() const; + void setSpecies(std::string value); /// /// @@ -70,7 +70,7 @@ class Animal void setColor(std::string value); protected: - std::string m_Type = ""; + std::string m_Species = ""; std::string m_Color = "red"; }; diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.cpp b/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.cpp index 7f00ec5f1732..af4da5765ca3 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.cpp +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.cpp @@ -62,7 +62,7 @@ ptree Cat::toPropertyTree() const { ptree pt; ptree tmp_node; - pt.put("type", m_Type); + pt.put("species", m_Species); pt.put("color", m_Color); pt.put("declawed", m_Declawed); return pt; @@ -71,19 +71,19 @@ ptree Cat::toPropertyTree() const void Cat::fromPropertyTree(ptree const &pt) { ptree tmp_node; - m_Type = pt.get("type", ""); + m_Species = pt.get("species", ""); m_Color = pt.get("color", "red"); m_Declawed = pt.get("declawed", false); } -std::string Cat::getType() const +std::string Cat::getSpecies() const { - return m_Type; + return m_Species; } -void Cat::setType(std::string value) +void Cat::setSpecies(std::string value) { - m_Type = value; + m_Species = value; } diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.h b/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.h index 4beb9e623982..2f4b0c10dea3 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.h +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Cat.h @@ -63,8 +63,8 @@ class Cat : public Animal, public Cat_allOf /// /// /// - std::string getType() const; - void setType(std::string value); + std::string getSpecies() const; + void setSpecies(std::string value); /// /// @@ -79,7 +79,7 @@ class Cat : public Animal, public Cat_allOf void setDeclawed(bool value); protected: - std::string m_Type = ""; + std::string m_Species = ""; std::string m_Color = "red"; bool m_Declawed = false; }; diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.cpp b/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.cpp index 92ddc11d3425..f4b4d038f632 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.cpp +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.cpp @@ -62,7 +62,7 @@ ptree Dog::toPropertyTree() const { ptree pt; ptree tmp_node; - pt.put("type", m_Type); + pt.put("species", m_Species); pt.put("color", m_Color); pt.put("breed", m_Breed); return pt; @@ -71,19 +71,19 @@ ptree Dog::toPropertyTree() const void Dog::fromPropertyTree(ptree const &pt) { ptree tmp_node; - m_Type = pt.get("type", ""); + m_Species = pt.get("species", ""); m_Color = pt.get("color", "red"); m_Breed = pt.get("breed", ""); } -std::string Dog::getType() const +std::string Dog::getSpecies() const { - return m_Type; + return m_Species; } -void Dog::setType(std::string value) +void Dog::setSpecies(std::string value) { - m_Type = value; + m_Species = value; } diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.h b/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.h index 97b4da916cfb..20bfc9255ab2 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.h +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/Dog.h @@ -63,8 +63,8 @@ class Dog : public Animal, public Dog_allOf /// /// /// - std::string getType() const; - void setType(std::string value); + std::string getSpecies() const; + void setSpecies(std::string value); /// /// @@ -79,7 +79,7 @@ class Dog : public Animal, public Dog_allOf void setBreed(std::string value); protected: - std::string m_Type = ""; + std::string m_Species = ""; std::string m_Color = "red"; std::string m_Breed = ""; }; diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Animal.java b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Animal.java index ab513c62751c..a8fec86392de 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Animal.java +++ b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/Animal.java @@ -28,28 +28,28 @@ public class Animal { - private String type; + private String species; private String color = "red"; /** - * Get type - * @return type + * Get species + * @return species **/ @NotNull - public String getType() { - return type; + public String getSpecies() { + return species; } /** - * Set type + * Set species **/ - public void setType(String type) { - this.type = type; + public void setSpecies(String species) { + this.species = species; } - public Animal type(String type) { - this.type = type; + public Animal species(String species) { + this.species = species; return this; } @@ -82,7 +82,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" species: ").append(toIndentedString(species)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml index c703a5bccf62..412a3fff8d0d 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml @@ -1510,15 +1510,15 @@ components: mapping: DOG: '#/components/schemas/Dog' CAT: '#/components/schemas/Cat' - propertyName: type + propertyName: species properties: - type: + species: type: string color: default: red type: string required: - - type + - species type: object AnimalFarm: items: diff --git a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Animal.java b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Animal.java index 2a751ddff64a..c3aacb31fa83 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Animal.java +++ b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/Animal.java @@ -10,7 +10,7 @@ public class Animal { - private String type; + private String species; private String color = "red"; /** @@ -23,29 +23,29 @@ public Animal() { /** * Create Animal. * - * @param type type + * @param species species * @param color color */ public Animal( - String type, + String species, String color ) { - this.type = type; + this.species = species; this.color = color; } /** - * Get type - * @return type + * Get species + * @return species */ - public String getType() { - return type; + public String getSpecies() { + return species; } - public void setType(String type) { - this.type = type; + public void setSpecies(String species) { + this.species = species; } /** @@ -68,7 +68,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" species: ").append(toIndentedString(species)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml index c703a5bccf62..412a3fff8d0d 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml @@ -1510,15 +1510,15 @@ components: mapping: DOG: '#/components/schemas/Dog' CAT: '#/components/schemas/Cat' - propertyName: type + propertyName: species properties: - type: + species: type: string color: default: red type: string required: - - type + - species type: object AnimalFarm: items: diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java index 2b6f5822dcc7..67af58e2a497 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Animal.java @@ -29,42 +29,42 @@ * Animal */ @JsonPropertyOrder({ - Animal.JSON_PROPERTY_TYPE, + Animal.JSON_PROPERTY_SPECIES, Animal.JSON_PROPERTY_COLOR }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "species", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Cat.class, name = "CAT"), @JsonSubTypes.Type(value = Dog.class, name = "DOG"), }) public class Animal { - public static final String JSON_PROPERTY_TYPE = "type"; - @JsonProperty(JSON_PROPERTY_TYPE) - private String type; + public static final String JSON_PROPERTY_SPECIES = "species"; + @JsonProperty(JSON_PROPERTY_SPECIES) + private String species; public static final String JSON_PROPERTY_COLOR = "color"; @JsonProperty(JSON_PROPERTY_COLOR) private String color = "red"; - public Animal type(String type) { - this.type = type; + public Animal species(String species) { + this.species = species; return this; } /** - * Get type - * @return type + * Get species + * @return species **/ - @JsonProperty(value = "type") + @JsonProperty(value = "species") @ApiModelProperty(required = true, value = "") @NotNull - public String getType() { - return type; + public String getSpecies() { + return species; } - public void setType(String type) { - this.type = type; + public void setSpecies(String species) { + this.species = species; } public Animal color(String color) { @@ -97,13 +97,13 @@ public boolean equals(Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.type, animal.type) && + return Objects.equals(this.species, animal.species) && Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return Objects.hash(type, color); + return Objects.hash(species, color); } @Override @@ -111,7 +111,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Animal {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" species: ").append(toIndentedString(species)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Animal.php b/samples/server/petstore/php-laravel/lib/app/Models/Animal.php index c5934c1593fd..cd76b6485a3d 100644 --- a/samples/server/petstore/php-laravel/lib/app/Models/Animal.php +++ b/samples/server/petstore/php-laravel/lib/app/Models/Animal.php @@ -9,8 +9,8 @@ */ class Animal { - /** @var string $type */ - public $type = ""; + /** @var string $species */ + public $species = ""; /** @var string $color */ public $color = 'red'; diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Cat.php b/samples/server/petstore/php-laravel/lib/app/Models/Cat.php index 3209d073e7cd..50e954c25393 100644 --- a/samples/server/petstore/php-laravel/lib/app/Models/Cat.php +++ b/samples/server/petstore/php-laravel/lib/app/Models/Cat.php @@ -9,8 +9,8 @@ */ class Cat { - /** @var string $type */ - public $type = ""; + /** @var string $species */ + public $species = ""; /** @var string $color */ public $color = 'red'; diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Dog.php b/samples/server/petstore/php-laravel/lib/app/Models/Dog.php index 93ce155f33dc..058d28c474b2 100644 --- a/samples/server/petstore/php-laravel/lib/app/Models/Dog.php +++ b/samples/server/petstore/php-laravel/lib/app/Models/Dog.php @@ -9,8 +9,8 @@ */ class Dog { - /** @var string $type */ - public $type = ""; + /** @var string $species */ + public $species = ""; /** @var string $color */ public $color = 'red'; From 3247451d991cb63114e74c79eedccd7c2768c8a9 Mon Sep 17 00:00:00 2001 From: Bernie Schelberg Date: Thu, 16 Mar 2023 14:51:06 +1000 Subject: [PATCH 6/6] Generated samples after merging latest 7.0.x --- .../Classes/OpenAPIs/APIs.swift | 10 ----- .../Classes/OpenAPIs/Configuration.swift | 4 -- .../OpenAPIs/URLSessionImplementations.swift | 37 ++++--------------- 3 files changed, 7 insertions(+), 44 deletions(-) diff --git a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/APIs.swift index 513c1222ada3..30b466c25a1e 100644 --- a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -5,14 +5,6 @@ // import Foundation - -// We reverted the change of PetstoreClientAPI to PetstoreClient introduced in https://github.com/OpenAPITools/openapi-generator/pull/9624 -// Because it was causing the following issue https://github.com/OpenAPITools/openapi-generator/issues/9953 -// If you are affected by this issue, please consider removing the following two lines, -// By setting the option removeMigrationProjectNameClass to true in the generator -@available(*, deprecated, renamed: "PetstoreClientAPI") -public typealias PetstoreClient = PetstoreClientAPI - open class PetstoreClientAPI { public static var basePath = "http://localhost" public static var customHeaders: [String: String] = [:] @@ -31,8 +23,6 @@ open class RequestBuilder { public let requiresAuthentication: Bool /// Optional block to obtain a reference to the request's progress instance when available. - /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. - /// If you need to get the request's progress in older OS versions, please use Alamofire http client. public var onProgressReady: ((Progress) -> Void)? required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) { diff --git a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Configuration.swift index 03789f4b4925..df53ee090108 100644 --- a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -8,10 +8,6 @@ import Foundation open class Configuration { - // This value is used to configure the date formatter that is used to serialize dates into JSON format. - // You must set it prior to encoding any dates, and it will only be read once. - @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") - public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" /// Configures the range of HTTP status codes that will result in a successful response /// /// If a HTTP status code is outside of this range the response will be interpreted as failed. diff --git a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 635c69cd6a8a..f04c90878cbb 100644 --- a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -52,7 +52,7 @@ open class URLSessionRequestBuilder: RequestBuilder { - intercept and handle errors like authorization - retry the request. */ - @available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client") + @available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client") public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) { @@ -92,10 +92,6 @@ open class URLSessionRequestBuilder: RequestBuilder { originalRequest.httpMethod = method.rawValue - headers.forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } @@ -145,32 +141,13 @@ open class URLSessionRequestBuilder: RequestBuilder { } let dataTask = urlSession.dataTask(with: request) { data, response, error in - - if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - - taskCompletionShouldRetry(data, response, error) { shouldRetry in - - if shouldRetry { - cleanupRequest() - self.execute(apiResponseQueue, completion) - } else { - apiResponseQueue.async { - self.processRequestResponse(urlRequest: request, data: data, response: response, error: error, completion: completion) - cleanupRequest() - } - } - } - } else { - apiResponseQueue.async { - self.processRequestResponse(urlRequest: request, data: data, response: response, error: error, completion: completion) - cleanupRequest() - } + apiResponseQueue.async { + self.processRequestResponse(urlRequest: request, data: data, response: response, error: error, completion: completion) + cleanupRequest() } } - if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { - onProgressReady?(dataTask.progress) - } + onProgressReady?(dataTask.progress) taskIdentifier = dataTask.taskIdentifier challengeHandlerStore[dataTask.taskIdentifier] = taskDidReceiveChallenge @@ -218,10 +195,10 @@ open class URLSessionRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders: [String: String] = [:] - for (key, value) in headers { + for (key, value) in PetstoreClientAPI.customHeaders { httpHeaders[key] = value } - for (key, value) in PetstoreClientAPI.customHeaders { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders