diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index fef3a3824cb7..d7785f838d6d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -1359,20 +1359,20 @@ public String toDefaultValue(CodegenProperty cp, Schema schema) { return String.format(Locale.ROOT, "new %s<>()", instantiationTypes().getOrDefault("map", "HashMap")); - } else if (ModelUtils.isIntegerSchema(schema)) { + } else if (ModelUtils.isIntegerSchema(schema) || cp.isInteger || cp.isLong) { if (schema.getDefault() != null) { - if (SchemaTypeUtil.INTEGER64_FORMAT.equals(schema.getFormat())) { + if (SchemaTypeUtil.INTEGER64_FORMAT.equals(schema.getFormat()) || cp.isLong) { return schema.getDefault().toString() + "l"; } else { return schema.getDefault().toString(); } } return null; - } else if (ModelUtils.isNumberSchema(schema)) { + } else if (ModelUtils.isNumberSchema(schema) || cp.isFloat || cp.isDouble) { if (schema.getDefault() != null) { - if (SchemaTypeUtil.FLOAT_FORMAT.equals(schema.getFormat())) { + if (SchemaTypeUtil.FLOAT_FORMAT.equals(schema.getFormat()) || cp.isFloat) { return schema.getDefault().toString() + "f"; - } else if (SchemaTypeUtil.DOUBLE_FORMAT.equals(schema.getFormat())) { + } else if (SchemaTypeUtil.DOUBLE_FORMAT.equals(schema.getFormat()) || cp.isDouble) { return schema.getDefault().toString() + "d"; } else { return "new BigDecimal(\"" + schema.getDefault().toString() + "\")"; diff --git a/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 13642c02fb6e..8f758bf5f5f5 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -2240,3 +2240,39 @@ components: deprecated: true items: $ref: '#/components/schemas/Bar' + LongId: + description: "Id as long" + type: integer + format: int64 + Weight: + description: "Weight as float" + format: float + type: number + Height: + description: "Height as double" + format: double + type: number + AllOfRefToLong: + description: "Object with allOf ref to long" + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/LongId' + default: 10 + AllOfRefToFloat: + description: "Object with allOf ref to float" + type: object + properties: + weight: + allOf: + - $ref: '#/components/schemas/Weight' + default: 7.89 + AllOfRefToDouble: + description: "Object with allOf ref to double" + type: object + properties: + height: + allOf: + - $ref: '#/components/schemas/Height' + default: 32.1 \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml index 4d44d00b329e..6297de4f95d6 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml @@ -2830,3 +2830,39 @@ components: [ "h3", "Header 3" ], [ "h4", "Header 4" ] ] + LongId: + description: "Id as long" + type: integer + format: int64 + Weight: + description: "Weight as float" + format: float + type: number + Height: + description: "Height as double" + format: double + type: number + AllOfRefToLong: + description: "Object with allOf ref to long" + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/LongId' + default: 10 + AllOfRefToFloat: + description: "Object with allOf ref to float" + type: object + properties: + weight: + allOf: + - $ref: '#/components/schemas/Weight' + default: 7.89 + AllOfRefToDouble: + description: "Object with allOf ref to double" + type: object + properties: + height: + allOf: + - $ref: '#/components/schemas/Height' + default: 32.1 \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 40cb91d8c70c..6b8bbc75b1df 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -2231,3 +2231,39 @@ components: deprecated: true items: $ref: '#/components/schemas/Bar' + LongId: + description: "Id as long" + type: integer + format: int64 + Weight: + description: "Weight as float" + format: float + type: number + Height: + description: "Height as double" + format: double + type: number + AllOfRefToLong: + description: "Object with allOf ref to long" + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/LongId' + default: 10 + AllOfRefToFloat: + description: "Object with allOf ref to float" + type: object + properties: + weight: + allOf: + - $ref: '#/components/schemas/Weight' + default: 7.89 + AllOfRefToDouble: + description: "Object with allOf ref to double" + type: object + properties: + height: + allOf: + - $ref: '#/components/schemas/Height' + default: 32.1 \ No newline at end of file diff --git a/samples/client/petstore/java/jersey3/.openapi-generator/FILES b/samples/client/petstore/java/jersey3/.openapi-generator/FILES index fe5eb6cb1934..9f4a901fd959 100644 --- a/samples/client/petstore/java/jersey3/.openapi-generator/FILES +++ b/samples/client/petstore/java/jersey3/.openapi-generator/FILES @@ -6,6 +6,9 @@ api/openapi.yaml build.gradle build.sbt docs/AdditionalPropertiesClass.md +docs/AllOfRefToDouble.md +docs/AllOfRefToFloat.md +docs/AllOfRefToLong.md docs/Animal.md docs/AnotherFakeApi.md docs/Apple.md @@ -125,6 +128,9 @@ src/main/java/org/openapitools/client/auth/OAuth.java src/main/java/org/openapitools/client/auth/OAuthFlow.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +src/main/java/org/openapitools/client/model/AllOfRefToLong.java src/main/java/org/openapitools/client/model/Animal.java src/main/java/org/openapitools/client/model/Apple.java src/main/java/org/openapitools/client/model/AppleReq.java @@ -199,3 +205,6 @@ src/main/java/org/openapitools/client/model/TriangleInterface.java src/main/java/org/openapitools/client/model/User.java src/main/java/org/openapitools/client/model/Whale.java src/main/java/org/openapitools/client/model/Zebra.java +src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java +src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java +src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java diff --git a/samples/client/petstore/java/jersey3/README.md b/samples/client/petstore/java/jersey3/README.md index 9c44af63d73e..6ba9214491d4 100644 --- a/samples/client/petstore/java/jersey3/README.md +++ b/samples/client/petstore/java/jersey3/README.md @@ -163,6 +163,9 @@ Class | Method | HTTP request | Description ## Documentation for Models - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AllOfRefToDouble](docs/AllOfRefToDouble.md) + - [AllOfRefToFloat](docs/AllOfRefToFloat.md) + - [AllOfRefToLong](docs/AllOfRefToLong.md) - [Animal](docs/Animal.md) - [Apple](docs/Apple.md) - [AppleReq](docs/AppleReq.md) diff --git a/samples/client/petstore/java/jersey3/api/openapi.yaml b/samples/client/petstore/java/jersey3/api/openapi.yaml index 8c93de27ddf6..724ee694f1f2 100644 --- a/samples/client/petstore/java/jersey3/api/openapi.yaml +++ b/samples/client/petstore/java/jersey3/api/openapi.yaml @@ -2293,6 +2293,42 @@ components: $ref: "#/components/schemas/Bar" type: array type: object + LongId: + description: Id as long + format: int64 + type: integer + Weight: + description: Weight as float + format: float + type: number + Height: + description: Height as double + format: double + type: number + AllOfRefToLong: + description: Object with allOf ref to long + properties: + id: + allOf: + - $ref: "#/components/schemas/LongId" + default: 10 + type: object + AllOfRefToFloat: + description: Object with allOf ref to float + properties: + weight: + allOf: + - $ref: "#/components/schemas/Weight" + default: 7.89 + type: object + AllOfRefToDouble: + description: Object with allOf ref to double + properties: + height: + allOf: + - $ref: "#/components/schemas/Height" + default: 32.1 + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/java/jersey3/docs/AllOfRefToDouble.md b/samples/client/petstore/java/jersey3/docs/AllOfRefToDouble.md new file mode 100644 index 000000000000..516584f74348 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/AllOfRefToDouble.md @@ -0,0 +1,14 @@ + + +# AllOfRefToDouble + +Object with allOf ref to double + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**height** | **Double** | Height as double | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/AllOfRefToFloat.md b/samples/client/petstore/java/jersey3/docs/AllOfRefToFloat.md new file mode 100644 index 000000000000..9a60af8a2ea4 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/AllOfRefToFloat.md @@ -0,0 +1,14 @@ + + +# AllOfRefToFloat + +Object with allOf ref to float + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**weight** | **Float** | Weight as float | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/docs/AllOfRefToLong.md b/samples/client/petstore/java/jersey3/docs/AllOfRefToLong.md new file mode 100644 index 000000000000..0f32d49b0857 --- /dev/null +++ b/samples/client/petstore/java/jersey3/docs/AllOfRefToLong.md @@ -0,0 +1,14 @@ + + +# AllOfRefToLong + +Object with allOf ref to long + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Id as long | [optional] | + + + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java new file mode 100644 index 000000000000..a331cc88cb5d --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -0,0 +1,109 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +import org.openapitools.client.JSON; + + +/** + * Object with allOf ref to double + */ +@JsonPropertyOrder({ + AllOfRefToDouble.JSON_PROPERTY_HEIGHT +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToDouble { + public static final String JSON_PROPERTY_HEIGHT = "height"; + @jakarta.annotation.Nullable + private Double height = 32.1d; + + public AllOfRefToDouble() { + } + + public AllOfRefToDouble height(@jakarta.annotation.Nullable Double height) { + this.height = height; + return this; + } + + /** + * Height as double + * @return height + */ + @jakarta.annotation.Nullable + + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Double getHeight() { + return height; + } + + + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHeight(@jakarta.annotation.Nullable Double height) { + this.height = height; + } + + + /** + * Return true if this AllOfRefToDouble object is equal to o. + */ + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToDouble {\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java new file mode 100644 index 000000000000..f18fcfad030e --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -0,0 +1,109 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +import org.openapitools.client.JSON; + + +/** + * Object with allOf ref to float + */ +@JsonPropertyOrder({ + AllOfRefToFloat.JSON_PROPERTY_WEIGHT +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToFloat { + public static final String JSON_PROPERTY_WEIGHT = "weight"; + @jakarta.annotation.Nullable + private Float weight = 7.89f; + + public AllOfRefToFloat() { + } + + public AllOfRefToFloat weight(@jakarta.annotation.Nullable Float weight) { + this.weight = weight; + return this; + } + + /** + * Weight as float + * @return weight + */ + @jakarta.annotation.Nullable + + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getWeight() { + return weight; + } + + + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWeight(@jakarta.annotation.Nullable Float weight) { + this.weight = weight; + } + + + /** + * Return true if this AllOfRefToFloat object is equal to o. + */ + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToFloat {\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java new file mode 100644 index 000000000000..0643ac479f32 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -0,0 +1,109 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +import org.openapitools.client.JSON; + + +/** + * Object with allOf ref to long + */ +@JsonPropertyOrder({ + AllOfRefToLong.JSON_PROPERTY_ID +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToLong { + public static final String JSON_PROPERTY_ID = "id"; + @jakarta.annotation.Nullable + private Long id = 10l; + + public AllOfRefToLong() { + } + + public AllOfRefToLong id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Id as long + * @return id + */ + @jakarta.annotation.Nullable + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + /** + * Return true if this AllOfRefToLong object is equal to o. + */ + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToLong {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java new file mode 100644 index 000000000000..4149d4844f0e --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToDouble + */ +public class AllOfRefToDoubleTest { + private final AllOfRefToDouble model = new AllOfRefToDouble(); + + /** + * Model tests for AllOfRefToDouble + */ + @Test + public void testAllOfRefToDouble() { + // TODO: test AllOfRefToDouble + } + + /** + * Test the property 'height' + */ + @Test + public void heightTest() { + // TODO: test height + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java new file mode 100644 index 000000000000..15e258444fbe --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToFloat + */ +public class AllOfRefToFloatTest { + private final AllOfRefToFloat model = new AllOfRefToFloat(); + + /** + * Model tests for AllOfRefToFloat + */ + @Test + public void testAllOfRefToFloat() { + // TODO: test AllOfRefToFloat + } + + /** + * Test the property 'weight' + */ + @Test + public void weightTest() { + // TODO: test weight + } + +} diff --git a/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java new file mode 100644 index 000000000000..81aaed0411b0 --- /dev/null +++ b/samples/client/petstore/java/jersey3/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToLong + */ +public class AllOfRefToLongTest { + private final AllOfRefToLong model = new AllOfRefToLong(); + + /** + * Model tests for AllOfRefToLong + */ + @Test + public void testAllOfRefToLong() { + // TODO: test AllOfRefToLong + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + +} diff --git a/samples/client/petstore/java/native-async/.openapi-generator/FILES b/samples/client/petstore/java/native-async/.openapi-generator/FILES index ee4301dd5706..3d9426f77dd6 100644 --- a/samples/client/petstore/java/native-async/.openapi-generator/FILES +++ b/samples/client/petstore/java/native-async/.openapi-generator/FILES @@ -6,6 +6,9 @@ api/openapi.yaml build.gradle build.sbt docs/AdditionalPropertiesClass.md +docs/AllOfRefToDouble.md +docs/AllOfRefToFloat.md +docs/AllOfRefToLong.md docs/Animal.md docs/AnotherFakeApi.md docs/Apple.md @@ -116,6 +119,9 @@ src/main/java/org/openapitools/client/api/StoreApi.java src/main/java/org/openapitools/client/api/UserApi.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +src/main/java/org/openapitools/client/model/AllOfRefToLong.java src/main/java/org/openapitools/client/model/Animal.java src/main/java/org/openapitools/client/model/Apple.java src/main/java/org/openapitools/client/model/AppleReq.java @@ -190,3 +196,6 @@ src/main/java/org/openapitools/client/model/TriangleInterface.java src/main/java/org/openapitools/client/model/User.java src/main/java/org/openapitools/client/model/Whale.java src/main/java/org/openapitools/client/model/Zebra.java +src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java +src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java +src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java diff --git a/samples/client/petstore/java/native-async/README.md b/samples/client/petstore/java/native-async/README.md index 8b4f37b420c5..3879c691e648 100644 --- a/samples/client/petstore/java/native-async/README.md +++ b/samples/client/petstore/java/native-async/README.md @@ -201,6 +201,9 @@ Class | Method | HTTP request | Description ## Documentation for Models - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AllOfRefToDouble](docs/AllOfRefToDouble.md) + - [AllOfRefToFloat](docs/AllOfRefToFloat.md) + - [AllOfRefToLong](docs/AllOfRefToLong.md) - [Animal](docs/Animal.md) - [Apple](docs/Apple.md) - [AppleReq](docs/AppleReq.md) diff --git a/samples/client/petstore/java/native-async/api/openapi.yaml b/samples/client/petstore/java/native-async/api/openapi.yaml index 6e7a8abdbf5c..679fbdda6ba6 100644 --- a/samples/client/petstore/java/native-async/api/openapi.yaml +++ b/samples/client/petstore/java/native-async/api/openapi.yaml @@ -2295,6 +2295,42 @@ components: $ref: "#/components/schemas/Bar" type: array type: object + LongId: + description: Id as long + format: int64 + type: integer + Weight: + description: Weight as float + format: float + type: number + Height: + description: Height as double + format: double + type: number + AllOfRefToLong: + description: Object with allOf ref to long + properties: + id: + allOf: + - $ref: "#/components/schemas/LongId" + default: 10 + type: object + AllOfRefToFloat: + description: Object with allOf ref to float + properties: + weight: + allOf: + - $ref: "#/components/schemas/Weight" + default: 7.89 + type: object + AllOfRefToDouble: + description: Object with allOf ref to double + properties: + height: + allOf: + - $ref: "#/components/schemas/Height" + default: 32.1 + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/java/native-async/docs/AllOfRefToDouble.md b/samples/client/petstore/java/native-async/docs/AllOfRefToDouble.md new file mode 100644 index 000000000000..516584f74348 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AllOfRefToDouble.md @@ -0,0 +1,14 @@ + + +# AllOfRefToDouble + +Object with allOf ref to double + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**height** | **Double** | Height as double | [optional] | + + + diff --git a/samples/client/petstore/java/native-async/docs/AllOfRefToFloat.md b/samples/client/petstore/java/native-async/docs/AllOfRefToFloat.md new file mode 100644 index 000000000000..9a60af8a2ea4 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AllOfRefToFloat.md @@ -0,0 +1,14 @@ + + +# AllOfRefToFloat + +Object with allOf ref to float + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**weight** | **Float** | Weight as float | [optional] | + + + diff --git a/samples/client/petstore/java/native-async/docs/AllOfRefToLong.md b/samples/client/petstore/java/native-async/docs/AllOfRefToLong.md new file mode 100644 index 000000000000..0f32d49b0857 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AllOfRefToLong.md @@ -0,0 +1,14 @@ + + +# AllOfRefToLong + +Object with allOf ref to long + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Id as long | [optional] | + + + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java new file mode 100644 index 000000000000..8f76c656ce45 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -0,0 +1,152 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * Object with allOf ref to double + */ +@JsonPropertyOrder({ + AllOfRefToDouble.JSON_PROPERTY_HEIGHT +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToDouble { + public static final String JSON_PROPERTY_HEIGHT = "height"; + @javax.annotation.Nullable + private Double height = 32.1d; + + public AllOfRefToDouble() { + } + + public AllOfRefToDouble height(@javax.annotation.Nullable Double height) { + this.height = height; + return this; + } + + /** + * Height as double + * @return height + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getHeight() { + return height; + } + + + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHeight(@javax.annotation.Nullable Double height) { + this.height = height; + } + + + /** + * Return true if this AllOfRefToDouble object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfRefToDouble allOfRefToDouble = (AllOfRefToDouble) o; + return Objects.equals(this.height, allOfRefToDouble.height); + } + + @Override + public int hashCode() { + return Objects.hash(height); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToDouble {\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `height` to the URL query string + if (getHeight() != null) { + joiner.add(String.format(Locale.ROOT, "%sheight%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getHeight())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java new file mode 100644 index 000000000000..3de28addb010 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -0,0 +1,152 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * Object with allOf ref to float + */ +@JsonPropertyOrder({ + AllOfRefToFloat.JSON_PROPERTY_WEIGHT +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToFloat { + public static final String JSON_PROPERTY_WEIGHT = "weight"; + @javax.annotation.Nullable + private Float weight = 7.89f; + + public AllOfRefToFloat() { + } + + public AllOfRefToFloat weight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + return this; + } + + /** + * Weight as float + * @return weight + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Float getWeight() { + return weight; + } + + + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWeight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + } + + + /** + * Return true if this AllOfRefToFloat object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfRefToFloat allOfRefToFloat = (AllOfRefToFloat) o; + return Objects.equals(this.weight, allOfRefToFloat.weight); + } + + @Override + public int hashCode() { + return Objects.hash(weight); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToFloat {\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `weight` to the URL query string + if (getWeight() != null) { + joiner.add(String.format(Locale.ROOT, "%sweight%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getWeight())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AllOfRefToLong.java new file mode 100644 index 000000000000..f324fd9874f5 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -0,0 +1,152 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * Object with allOf ref to long + */ +@JsonPropertyOrder({ + AllOfRefToLong.JSON_PROPERTY_ID +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToLong { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id = 10l; + + public AllOfRefToLong() { + } + + public AllOfRefToLong id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Id as long + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + /** + * Return true if this AllOfRefToLong object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfRefToLong allOfRefToLong = (AllOfRefToLong) o; + return Objects.equals(this.id, allOfRefToLong.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToLong {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java new file mode 100644 index 000000000000..0af1c3ccd6ec --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToDouble + */ +class AllOfRefToDoubleTest { + private final AllOfRefToDouble model = new AllOfRefToDouble(); + + /** + * Model tests for AllOfRefToDouble + */ + @Test + void testAllOfRefToDouble() { + // TODO: test AllOfRefToDouble + } + + /** + * Test the property 'height' + */ + @Test + void heightTest() { + // TODO: test height + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java new file mode 100644 index 000000000000..e69f5bc83898 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToFloat + */ +class AllOfRefToFloatTest { + private final AllOfRefToFloat model = new AllOfRefToFloat(); + + /** + * Model tests for AllOfRefToFloat + */ + @Test + void testAllOfRefToFloat() { + // TODO: test AllOfRefToFloat + } + + /** + * Test the property 'weight' + */ + @Test + void weightTest() { + // TODO: test weight + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java new file mode 100644 index 000000000000..3b88f41337f2 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToLong + */ +class AllOfRefToLongTest { + private final AllOfRefToLong model = new AllOfRefToLong(); + + /** + * Model tests for AllOfRefToLong + */ + @Test + void testAllOfRefToLong() { + // TODO: test AllOfRefToLong + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + +} diff --git a/samples/client/petstore/java/native/.openapi-generator/FILES b/samples/client/petstore/java/native/.openapi-generator/FILES index ee4301dd5706..3d9426f77dd6 100644 --- a/samples/client/petstore/java/native/.openapi-generator/FILES +++ b/samples/client/petstore/java/native/.openapi-generator/FILES @@ -6,6 +6,9 @@ api/openapi.yaml build.gradle build.sbt docs/AdditionalPropertiesClass.md +docs/AllOfRefToDouble.md +docs/AllOfRefToFloat.md +docs/AllOfRefToLong.md docs/Animal.md docs/AnotherFakeApi.md docs/Apple.md @@ -116,6 +119,9 @@ src/main/java/org/openapitools/client/api/StoreApi.java src/main/java/org/openapitools/client/api/UserApi.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +src/main/java/org/openapitools/client/model/AllOfRefToLong.java src/main/java/org/openapitools/client/model/Animal.java src/main/java/org/openapitools/client/model/Apple.java src/main/java/org/openapitools/client/model/AppleReq.java @@ -190,3 +196,6 @@ src/main/java/org/openapitools/client/model/TriangleInterface.java src/main/java/org/openapitools/client/model/User.java src/main/java/org/openapitools/client/model/Whale.java src/main/java/org/openapitools/client/model/Zebra.java +src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java +src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java +src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java diff --git a/samples/client/petstore/java/native/README.md b/samples/client/petstore/java/native/README.md index 94edbd695df7..4f03685d20ce 100644 --- a/samples/client/petstore/java/native/README.md +++ b/samples/client/petstore/java/native/README.md @@ -200,6 +200,9 @@ Class | Method | HTTP request | Description ## Documentation for Models - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AllOfRefToDouble](docs/AllOfRefToDouble.md) + - [AllOfRefToFloat](docs/AllOfRefToFloat.md) + - [AllOfRefToLong](docs/AllOfRefToLong.md) - [Animal](docs/Animal.md) - [Apple](docs/Apple.md) - [AppleReq](docs/AppleReq.md) diff --git a/samples/client/petstore/java/native/api/openapi.yaml b/samples/client/petstore/java/native/api/openapi.yaml index 6e7a8abdbf5c..679fbdda6ba6 100644 --- a/samples/client/petstore/java/native/api/openapi.yaml +++ b/samples/client/petstore/java/native/api/openapi.yaml @@ -2295,6 +2295,42 @@ components: $ref: "#/components/schemas/Bar" type: array type: object + LongId: + description: Id as long + format: int64 + type: integer + Weight: + description: Weight as float + format: float + type: number + Height: + description: Height as double + format: double + type: number + AllOfRefToLong: + description: Object with allOf ref to long + properties: + id: + allOf: + - $ref: "#/components/schemas/LongId" + default: 10 + type: object + AllOfRefToFloat: + description: Object with allOf ref to float + properties: + weight: + allOf: + - $ref: "#/components/schemas/Weight" + default: 7.89 + type: object + AllOfRefToDouble: + description: Object with allOf ref to double + properties: + height: + allOf: + - $ref: "#/components/schemas/Height" + default: 32.1 + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/java/native/docs/AllOfRefToDouble.md b/samples/client/petstore/java/native/docs/AllOfRefToDouble.md new file mode 100644 index 000000000000..516584f74348 --- /dev/null +++ b/samples/client/petstore/java/native/docs/AllOfRefToDouble.md @@ -0,0 +1,14 @@ + + +# AllOfRefToDouble + +Object with allOf ref to double + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**height** | **Double** | Height as double | [optional] | + + + diff --git a/samples/client/petstore/java/native/docs/AllOfRefToFloat.md b/samples/client/petstore/java/native/docs/AllOfRefToFloat.md new file mode 100644 index 000000000000..9a60af8a2ea4 --- /dev/null +++ b/samples/client/petstore/java/native/docs/AllOfRefToFloat.md @@ -0,0 +1,14 @@ + + +# AllOfRefToFloat + +Object with allOf ref to float + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**weight** | **Float** | Weight as float | [optional] | + + + diff --git a/samples/client/petstore/java/native/docs/AllOfRefToLong.md b/samples/client/petstore/java/native/docs/AllOfRefToLong.md new file mode 100644 index 000000000000..0f32d49b0857 --- /dev/null +++ b/samples/client/petstore/java/native/docs/AllOfRefToLong.md @@ -0,0 +1,14 @@ + + +# AllOfRefToLong + +Object with allOf ref to long + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Id as long | [optional] | + + + diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java new file mode 100644 index 000000000000..a55c7bd2e102 --- /dev/null +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -0,0 +1,201 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * Object with allOf ref to double + */ +@JsonPropertyOrder({ + AllOfRefToDouble.JSON_PROPERTY_HEIGHT +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToDouble { + public static final String JSON_PROPERTY_HEIGHT = "height"; + @javax.annotation.Nullable + private Double height = 32.1d; + + public AllOfRefToDouble() { + } + + public AllOfRefToDouble height(@javax.annotation.Nullable Double height) { + this.height = height; + return this; + } + + /** + * Height as double + * @return height + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getHeight() { + return height; + } + + + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHeight(@javax.annotation.Nullable Double height) { + this.height = height; + } + + + /** + * Return true if this AllOfRefToDouble object is equal to o. + */ + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToDouble {\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `height` to the URL query string + if (getHeight() != null) { + joiner.add(String.format(Locale.ROOT, "%sheight%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getHeight())))); + } + + return joiner.toString(); + } + + public static class Builder { + + private AllOfRefToDouble instance; + + public Builder() { + this(new AllOfRefToDouble()); + } + + protected Builder(AllOfRefToDouble instance) { + this.instance = instance; + } + + public AllOfRefToDouble.Builder height(Double height) { + this.instance.height = height; + return this; + } + + + /** + * returns a built AllOfRefToDouble instance. + * + * The builder is not reusable. + */ + public AllOfRefToDouble build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static AllOfRefToDouble.Builder builder() { + return new AllOfRefToDouble.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AllOfRefToDouble.Builder toBuilder() { + return new AllOfRefToDouble.Builder() + .height(getHeight()); + } + +} + diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java new file mode 100644 index 000000000000..a265f77f8562 --- /dev/null +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -0,0 +1,201 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * Object with allOf ref to float + */ +@JsonPropertyOrder({ + AllOfRefToFloat.JSON_PROPERTY_WEIGHT +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToFloat { + public static final String JSON_PROPERTY_WEIGHT = "weight"; + @javax.annotation.Nullable + private Float weight = 7.89f; + + public AllOfRefToFloat() { + } + + public AllOfRefToFloat weight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + return this; + } + + /** + * Weight as float + * @return weight + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Float getWeight() { + return weight; + } + + + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWeight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + } + + + /** + * Return true if this AllOfRefToFloat object is equal to o. + */ + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToFloat {\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `weight` to the URL query string + if (getWeight() != null) { + joiner.add(String.format(Locale.ROOT, "%sweight%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getWeight())))); + } + + return joiner.toString(); + } + + public static class Builder { + + private AllOfRefToFloat instance; + + public Builder() { + this(new AllOfRefToFloat()); + } + + protected Builder(AllOfRefToFloat instance) { + this.instance = instance; + } + + public AllOfRefToFloat.Builder weight(Float weight) { + this.instance.weight = weight; + return this; + } + + + /** + * returns a built AllOfRefToFloat instance. + * + * The builder is not reusable. + */ + public AllOfRefToFloat build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static AllOfRefToFloat.Builder builder() { + return new AllOfRefToFloat.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AllOfRefToFloat.Builder toBuilder() { + return new AllOfRefToFloat.Builder() + .weight(getWeight()); + } + +} + diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AllOfRefToLong.java new file mode 100644 index 000000000000..70084a56cfa6 --- /dev/null +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -0,0 +1,201 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * Object with allOf ref to long + */ +@JsonPropertyOrder({ + AllOfRefToLong.JSON_PROPERTY_ID +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToLong { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id = 10l; + + public AllOfRefToLong() { + } + + public AllOfRefToLong id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Id as long + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + /** + * Return true if this AllOfRefToLong object is equal to o. + */ + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToLong {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `id` to the URL query string + if (getId() != null) { + joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId())))); + } + + return joiner.toString(); + } + + public static class Builder { + + private AllOfRefToLong instance; + + public Builder() { + this(new AllOfRefToLong()); + } + + protected Builder(AllOfRefToLong instance) { + this.instance = instance; + } + + public AllOfRefToLong.Builder id(Long id) { + this.instance.id = id; + return this; + } + + + /** + * returns a built AllOfRefToLong instance. + * + * The builder is not reusable. + */ + public AllOfRefToLong build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static AllOfRefToLong.Builder builder() { + return new AllOfRefToLong.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AllOfRefToLong.Builder toBuilder() { + return new AllOfRefToLong.Builder() + .id(getId()); + } + +} + diff --git a/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java new file mode 100644 index 000000000000..0af1c3ccd6ec --- /dev/null +++ b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToDouble + */ +class AllOfRefToDoubleTest { + private final AllOfRefToDouble model = new AllOfRefToDouble(); + + /** + * Model tests for AllOfRefToDouble + */ + @Test + void testAllOfRefToDouble() { + // TODO: test AllOfRefToDouble + } + + /** + * Test the property 'height' + */ + @Test + void heightTest() { + // TODO: test height + } + +} diff --git a/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java new file mode 100644 index 000000000000..e69f5bc83898 --- /dev/null +++ b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToFloat + */ +class AllOfRefToFloatTest { + private final AllOfRefToFloat model = new AllOfRefToFloat(); + + /** + * Model tests for AllOfRefToFloat + */ + @Test + void testAllOfRefToFloat() { + // TODO: test AllOfRefToFloat + } + + /** + * Test the property 'weight' + */ + @Test + void weightTest() { + // TODO: test weight + } + +} diff --git a/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java new file mode 100644 index 000000000000..3b88f41337f2 --- /dev/null +++ b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToLong + */ +class AllOfRefToLongTest { + private final AllOfRefToLong model = new AllOfRefToLong(); + + /** + * Model tests for AllOfRefToLong + */ + @Test + void testAllOfRefToLong() { + // TODO: test AllOfRefToLong + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + +} diff --git a/samples/client/petstore/java/okhttp-gson/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-gson/.openapi-generator/FILES index 25b82e9f3dd7..9de4894ad1e8 100644 --- a/samples/client/petstore/java/okhttp-gson/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-gson/.openapi-generator/FILES @@ -11,6 +11,9 @@ docs/AllOfModelArrayAnyOfAllOfAttributes.md docs/AllOfModelArrayAnyOfAllOfAttributesC.md docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md +docs/AllOfRefToDouble.md +docs/AllOfRefToFloat.md +docs/AllOfRefToLong.md docs/Animal.md docs/AnotherFakeApi.md docs/Apple.md @@ -161,6 +164,9 @@ src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes. src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java +src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +src/main/java/org/openapitools/client/model/AllOfRefToLong.java src/main/java/org/openapitools/client/model/Animal.java src/main/java/org/openapitools/client/model/Apple.java src/main/java/org/openapitools/client/model/AppleReq.java diff --git a/samples/client/petstore/java/okhttp-gson/README.md b/samples/client/petstore/java/okhttp-gson/README.md index 8200fdc9554c..3adb198b5741 100644 --- a/samples/client/petstore/java/okhttp-gson/README.md +++ b/samples/client/petstore/java/okhttp-gson/README.md @@ -177,6 +177,9 @@ Class | Method | HTTP request | Description - [AllOfModelArrayAnyOfAllOfAttributesC](docs/AllOfModelArrayAnyOfAllOfAttributesC.md) - [AllOfModelArrayAnyOfAllOfLinkListColumn1](docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md) - [AllOfModelArrayAnyOfAllOfLinkListColumn1Value](docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md) + - [AllOfRefToDouble](docs/AllOfRefToDouble.md) + - [AllOfRefToFloat](docs/AllOfRefToFloat.md) + - [AllOfRefToLong](docs/AllOfRefToLong.md) - [Animal](docs/Animal.md) - [Apple](docs/Apple.md) - [AppleReq](docs/AppleReq.md) diff --git a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml index f21b84165a85..c089cb10c4f9 100644 --- a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml +++ b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml @@ -2941,6 +2941,42 @@ components: type: array type: array type: object + LongId: + description: Id as long + format: int64 + type: integer + Weight: + description: Weight as float + format: float + type: number + Height: + description: Height as double + format: double + type: number + AllOfRefToLong: + description: Object with allOf ref to long + properties: + id: + allOf: + - $ref: "#/components/schemas/LongId" + default: 10 + type: object + AllOfRefToFloat: + description: Object with allOf ref to float + properties: + weight: + allOf: + - $ref: "#/components/schemas/Weight" + default: 7.89 + type: object + AllOfRefToDouble: + description: Object with allOf ref to double + properties: + height: + allOf: + - $ref: "#/components/schemas/Height" + default: 32.1 + type: object _foo_get_default_response: example: string: diff --git a/samples/client/petstore/java/okhttp-gson/docs/AllOfRefToDouble.md b/samples/client/petstore/java/okhttp-gson/docs/AllOfRefToDouble.md new file mode 100644 index 000000000000..516584f74348 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/AllOfRefToDouble.md @@ -0,0 +1,14 @@ + + +# AllOfRefToDouble + +Object with allOf ref to double + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**height** | **Double** | Height as double | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/AllOfRefToFloat.md b/samples/client/petstore/java/okhttp-gson/docs/AllOfRefToFloat.md new file mode 100644 index 000000000000..9a60af8a2ea4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/AllOfRefToFloat.md @@ -0,0 +1,14 @@ + + +# AllOfRefToFloat + +Object with allOf ref to float + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**weight** | **Float** | Weight as float | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/AllOfRefToLong.md b/samples/client/petstore/java/okhttp-gson/docs/AllOfRefToLong.md new file mode 100644 index 000000000000..0f32d49b0857 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/AllOfRefToLong.md @@ -0,0 +1,14 @@ + + +# AllOfRefToLong + +Object with allOf ref to long + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Id as long | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java index 206faee941f3..5aaa5ac339df 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java @@ -250,6 +250,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributesC.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1Value.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfRefToDouble.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfRefToFloat.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfRefToLong.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Apple.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AppleReq.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayAnyOf.CustomTypeAdapterFactory()); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java new file mode 100644 index 000000000000..c403d8859019 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -0,0 +1,285 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to double + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToDouble { + public static final String SERIALIZED_NAME_HEIGHT = "height"; + @SerializedName(SERIALIZED_NAME_HEIGHT) + @javax.annotation.Nullable + private Double height = 32.1d; + + public AllOfRefToDouble() { + } + + public AllOfRefToDouble height(@javax.annotation.Nullable Double height) { + this.height = height; + return this; + } + + /** + * Height as double + * @return height + */ + @javax.annotation.Nullable + public Double getHeight() { + return height; + } + + public void setHeight(@javax.annotation.Nullable Double height) { + this.height = height; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToDouble instance itself + */ + public AllOfRefToDouble putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfRefToDouble allOfRefToDouble = (AllOfRefToDouble) o; + return Objects.equals(this.height, allOfRefToDouble.height)&& + Objects.equals(this.additionalProperties, allOfRefToDouble.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(height, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToDouble {\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("height")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfRefToDouble + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllOfRefToDouble.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in AllOfRefToDouble is not found in the empty JSON string", AllOfRefToDouble.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfRefToDouble.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfRefToDouble' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllOfRefToDouble.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfRefToDouble value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AllOfRefToDouble read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AllOfRefToDouble instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllOfRefToDouble given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllOfRefToDouble + * @throws IOException if the JSON string is invalid with respect to AllOfRefToDouble + */ + public static AllOfRefToDouble fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllOfRefToDouble.class); + } + + /** + * Convert an instance of AllOfRefToDouble to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java new file mode 100644 index 000000000000..52a5ac0d93d4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -0,0 +1,285 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to float + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToFloat { + public static final String SERIALIZED_NAME_WEIGHT = "weight"; + @SerializedName(SERIALIZED_NAME_WEIGHT) + @javax.annotation.Nullable + private Float weight = 7.89f; + + public AllOfRefToFloat() { + } + + public AllOfRefToFloat weight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + return this; + } + + /** + * Weight as float + * @return weight + */ + @javax.annotation.Nullable + public Float getWeight() { + return weight; + } + + public void setWeight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToFloat instance itself + */ + public AllOfRefToFloat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfRefToFloat allOfRefToFloat = (AllOfRefToFloat) o; + return Objects.equals(this.weight, allOfRefToFloat.weight)&& + Objects.equals(this.additionalProperties, allOfRefToFloat.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(weight, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToFloat {\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("weight")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfRefToFloat + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllOfRefToFloat.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in AllOfRefToFloat is not found in the empty JSON string", AllOfRefToFloat.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfRefToFloat.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfRefToFloat' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllOfRefToFloat.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfRefToFloat value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AllOfRefToFloat read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AllOfRefToFloat instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllOfRefToFloat given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllOfRefToFloat + * @throws IOException if the JSON string is invalid with respect to AllOfRefToFloat + */ + public static AllOfRefToFloat fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllOfRefToFloat.class); + } + + /** + * Convert an instance of AllOfRefToFloat to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfRefToLong.java new file mode 100644 index 000000000000..c069c5346c1d --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -0,0 +1,285 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to long + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToLong { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id = 10l; + + public AllOfRefToLong() { + } + + public AllOfRefToLong id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Id as long + * @return id + */ + @javax.annotation.Nullable + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToLong instance itself + */ + public AllOfRefToLong putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfRefToLong allOfRefToLong = (AllOfRefToLong) o; + return Objects.equals(this.id, allOfRefToLong.id)&& + Objects.equals(this.additionalProperties, allOfRefToLong.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToLong {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfRefToLong + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllOfRefToLong.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in AllOfRefToLong is not found in the empty JSON string", AllOfRefToLong.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfRefToLong.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfRefToLong' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllOfRefToLong.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfRefToLong value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AllOfRefToLong read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AllOfRefToLong instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllOfRefToLong given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllOfRefToLong + * @throws IOException if the JSON string is invalid with respect to AllOfRefToLong + */ + public static AllOfRefToLong fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllOfRefToLong.class); + } + + /** + * Convert an instance of AllOfRefToLong to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java new file mode 100644 index 000000000000..c791ef21de5c --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToDouble + */ +public class AllOfRefToDoubleTest { + private final AllOfRefToDouble model = new AllOfRefToDouble(); + + /** + * Model tests for AllOfRefToDouble + */ + @Test + public void testAllOfRefToDouble() { + // TODO: test AllOfRefToDouble + } + + /** + * Test the property 'height' + */ + @Test + public void heightTest() { + // TODO: test height + } + +} diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java new file mode 100644 index 000000000000..54100e38f933 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToFloat + */ +public class AllOfRefToFloatTest { + private final AllOfRefToFloat model = new AllOfRefToFloat(); + + /** + * Model tests for AllOfRefToFloat + */ + @Test + public void testAllOfRefToFloat() { + // TODO: test AllOfRefToFloat + } + + /** + * Test the property 'weight' + */ + @Test + public void weightTest() { + // TODO: test weight + } + +} diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java new file mode 100644 index 000000000000..07edad5bf926 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToLong + */ +public class AllOfRefToLongTest { + private final AllOfRefToLong model = new AllOfRefToLong(); + + /** + * Model tests for AllOfRefToLong + */ + @Test + public void testAllOfRefToLong() { + // TODO: test AllOfRefToLong + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES b/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES index fe5eb6cb1934..9f4a901fd959 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES @@ -6,6 +6,9 @@ api/openapi.yaml build.gradle build.sbt docs/AdditionalPropertiesClass.md +docs/AllOfRefToDouble.md +docs/AllOfRefToFloat.md +docs/AllOfRefToLong.md docs/Animal.md docs/AnotherFakeApi.md docs/Apple.md @@ -125,6 +128,9 @@ src/main/java/org/openapitools/client/auth/OAuth.java src/main/java/org/openapitools/client/auth/OAuthFlow.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +src/main/java/org/openapitools/client/model/AllOfRefToLong.java src/main/java/org/openapitools/client/model/Animal.java src/main/java/org/openapitools/client/model/Apple.java src/main/java/org/openapitools/client/model/AppleReq.java @@ -199,3 +205,6 @@ src/main/java/org/openapitools/client/model/TriangleInterface.java src/main/java/org/openapitools/client/model/User.java src/main/java/org/openapitools/client/model/Whale.java src/main/java/org/openapitools/client/model/Zebra.java +src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java +src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java +src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/README.md b/samples/openapi3/client/petstore/java/jersey2-java8/README.md index 14f9a428c4d3..2ea03ec635a8 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/README.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/README.md @@ -188,6 +188,9 @@ Class | Method | HTTP request | Description ## Documentation for Models - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AllOfRefToDouble](docs/AllOfRefToDouble.md) + - [AllOfRefToFloat](docs/AllOfRefToFloat.md) + - [AllOfRefToLong](docs/AllOfRefToLong.md) - [Animal](docs/Animal.md) - [Apple](docs/Apple.md) - [AppleReq](docs/AppleReq.md) diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml b/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml index 8c93de27ddf6..724ee694f1f2 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml +++ b/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml @@ -2293,6 +2293,42 @@ components: $ref: "#/components/schemas/Bar" type: array type: object + LongId: + description: Id as long + format: int64 + type: integer + Weight: + description: Weight as float + format: float + type: number + Height: + description: Height as double + format: double + type: number + AllOfRefToLong: + description: Object with allOf ref to long + properties: + id: + allOf: + - $ref: "#/components/schemas/LongId" + default: 10 + type: object + AllOfRefToFloat: + description: Object with allOf ref to float + properties: + weight: + allOf: + - $ref: "#/components/schemas/Weight" + default: 7.89 + type: object + AllOfRefToDouble: + description: Object with allOf ref to double + properties: + height: + allOf: + - $ref: "#/components/schemas/Height" + default: 32.1 + type: object _foo_get_default_response: example: string: diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AllOfRefToDouble.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AllOfRefToDouble.md new file mode 100644 index 000000000000..516584f74348 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AllOfRefToDouble.md @@ -0,0 +1,14 @@ + + +# AllOfRefToDouble + +Object with allOf ref to double + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**height** | **Double** | Height as double | [optional] | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AllOfRefToFloat.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AllOfRefToFloat.md new file mode 100644 index 000000000000..9a60af8a2ea4 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AllOfRefToFloat.md @@ -0,0 +1,14 @@ + + +# AllOfRefToFloat + +Object with allOf ref to float + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**weight** | **Float** | Weight as float | [optional] | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AllOfRefToLong.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AllOfRefToLong.md new file mode 100644 index 000000000000..0f32d49b0857 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AllOfRefToLong.md @@ -0,0 +1,14 @@ + + +# AllOfRefToLong + +Object with allOf ref to long + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Id as long | [optional] | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java new file mode 100644 index 000000000000..9c00fc0bfb9c --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Object with allOf ref to double + */ +@JsonPropertyOrder({ + AllOfRefToDouble.JSON_PROPERTY_HEIGHT +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToDouble { + public static final String JSON_PROPERTY_HEIGHT = "height"; + @javax.annotation.Nullable + private Double height = 32.1d; + + public AllOfRefToDouble() { + } + + public AllOfRefToDouble height(@javax.annotation.Nullable Double height) { + this.height = height; + return this; + } + + /** + * Height as double + * @return height + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Double getHeight() { + return height; + } + + + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHeight(@javax.annotation.Nullable Double height) { + this.height = height; + } + + + /** + * Return true if this AllOfRefToDouble object is equal to o. + */ + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToDouble {\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java new file mode 100644 index 000000000000..12e2925dc216 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Object with allOf ref to float + */ +@JsonPropertyOrder({ + AllOfRefToFloat.JSON_PROPERTY_WEIGHT +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToFloat { + public static final String JSON_PROPERTY_WEIGHT = "weight"; + @javax.annotation.Nullable + private Float weight = 7.89f; + + public AllOfRefToFloat() { + } + + public AllOfRefToFloat weight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + return this; + } + + /** + * Weight as float + * @return weight + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getWeight() { + return weight; + } + + + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWeight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + } + + + /** + * Return true if this AllOfRefToFloat object is equal to o. + */ + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToFloat {\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AllOfRefToLong.java new file mode 100644 index 000000000000..16064b174941 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.openapitools.client.JSON; + + +/** + * Object with allOf ref to long + */ +@JsonPropertyOrder({ + AllOfRefToLong.JSON_PROPERTY_ID +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") +public class AllOfRefToLong { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private Long id = 10l; + + public AllOfRefToLong() { + } + + public AllOfRefToLong id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Id as long + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + /** + * Return true if this AllOfRefToLong object is equal to o. + */ + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToLong {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java new file mode 100644 index 000000000000..4149d4844f0e --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToDouble + */ +public class AllOfRefToDoubleTest { + private final AllOfRefToDouble model = new AllOfRefToDouble(); + + /** + * Model tests for AllOfRefToDouble + */ + @Test + public void testAllOfRefToDouble() { + // TODO: test AllOfRefToDouble + } + + /** + * Test the property 'height' + */ + @Test + public void heightTest() { + // TODO: test height + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java new file mode 100644 index 000000000000..15e258444fbe --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToFloat + */ +public class AllOfRefToFloatTest { + private final AllOfRefToFloat model = new AllOfRefToFloat(); + + /** + * Model tests for AllOfRefToFloat + */ + @Test + public void testAllOfRefToFloat() { + // TODO: test AllOfRefToFloat + } + + /** + * Test the property 'weight' + */ + @Test + public void weightTest() { + // TODO: test weight + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java new file mode 100644 index 000000000000..81aaed0411b0 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToLong + */ +public class AllOfRefToLongTest { + private final AllOfRefToLong model = new AllOfRefToLong(); + + /** + * Model tests for AllOfRefToLong + */ + @Test + public void testAllOfRefToLong() { + // TODO: test AllOfRefToLong + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + +}