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 52e71fc22b79..730e9e4483ef 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 @@ -2301,7 +2301,7 @@ private boolean shouldBeImplicitHeader(CodegenParameter parameter) { @Override public void addImportsToOneOfInterface(List> imports) { if (jackson) { - for (String i : Arrays.asList("JsonSubTypes", "JsonTypeInfo")) { + for (String i : Arrays.asList("JsonSubTypes", "JsonTypeInfo", "JsonIgnoreProperties")) { Map oneImport = new HashMap<>(); oneImport.put("import", importMapping.get(i)); if (!imports.contains(oneImport)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 769d9942cd9d..ed6a4123aaa3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -1155,17 +1155,6 @@ public String toApiVarName(String name) { return apiVarName; } - @Override - public void addImportsToOneOfInterface(List> imports) { - for (String i : Arrays.asList("JsonSubTypes", "JsonTypeInfo", "JsonIgnoreProperties")) { - Map oneImport = new HashMap<>(); - oneImport.put("import", importMapping.get(i)); - if (!imports.contains(oneImport)) { - imports.add(oneImport); - } - } - } - @Override public List getSupportedVendorExtensions() { List extensions = super.getSupportedVendorExtensions(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaHelidonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaHelidonClientCodegen.java index 980f2051ade1..a5b09b285d45 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaHelidonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaHelidonClientCodegen.java @@ -21,7 +21,6 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -488,17 +487,6 @@ public String toApiVarName(String name) { return apiVarName; } - @Override - public void addImportsToOneOfInterface(List> imports) { - for (String i : Arrays.asList("JsonSubTypes", "JsonTypeInfo", "JsonIgnoreProperties")) { - Map oneImport = new HashMap<>(); - oneImport.put("import", importMapping.get(i)); - if (!imports.contains(oneImport)) { - imports.add(oneImport); - } - } - } - @Override public List getSupportedVendorExtensions() { List extensions = super.getSupportedVendorExtensions(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 1a4c07ef12e8..90c7fe39370b 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -5103,4 +5103,14 @@ public void testEnumUnknownDefaultCaseDeserializationNotSet_issue13241() throws .assertMethod("build") .doesNotHaveAnnotation("Deprecated"); } + + @Test + public void shouldAddJsonIgnorePropertiesImportWhenUsingOneOfWithinOneOf_issue18929() throws IOException { + final SpringCodegen codegen = new SpringCodegen(); + + final Map files = generateFiles(codegen, "src/test/resources/3_0/spring/issue_18929.yaml"); + + JavaFileAssert.assertThat(files.get("RequestTwoSchemaNestedOneOf.java")) + .hasImports("com.fasterxml.jackson.annotation.JsonIgnoreProperties"); + } } diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/issue_18929.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/issue_18929.yaml new file mode 100644 index 000000000000..d85bde11bf6d --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/spring/issue_18929.yaml @@ -0,0 +1,71 @@ +openapi: 3.0.3 +info: + title: oneOf within oneOf + version: 7.7.0-SNAPSHOT +paths: + /oneOf-within-oneOf-test: + post: + operationId: 'oneOfWithinOneOfTest' + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/RequestTwoSchema' + - $ref: '#/components/schemas/RequestOneSchema' + responses: + '201': + description: The request was successful and the resource has been created. + content: + application/json: + schema: + type: string +components: + schemas: + AbstractNestedSchema: + type: object + discriminator: + propertyName: type + mapping: + NESTED_ONE: '#/components/schemas/NestedOneSchema' + NESTED_TWO: '#/components/schemas/NestedTwoSchema' + required: + - type + properties: + type: + type: string + NestedOneSchema: + type: object + allOf: + - $ref: '#/components/schemas/AbstractNestedSchema' + AbstractRequestSchema: + type: object + discriminator: + propertyName: type + mapping: + REQUEST_ONE: '#/components/schemas/RequestOneSchema' + REQUEST_TWO: '#/components/schemas/RequestTwoSchema' + required: + - type + properties: + type: + type: string + RequestTwoSchema: + type: object + allOf: + - $ref: '#/components/schemas/AbstractRequestSchema' + required: + - nested + properties: + nested: + oneOf: + - $ref: '#/components/schemas/NestedTwoSchema' + - $ref: '#/components/schemas/NestedOneSchema' + RequestOneSchema: + type: object + allOf: + - $ref: '#/components/schemas/AbstractRequestSchema' + NestedTwoSchema: + type: object + allOf: + - $ref: '#/components/schemas/AbstractNestedSchema' diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml index ee2e1b442a12..74fdbd07ccb8 100644 --- a/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1142,6 +1142,27 @@ paths: application/json: schema: $ref: "#/components/schemas/ResponseObjectWithDifferentFieldNames" + /fake/one-of-within-one-of-park-persons: + post: + tags: + - PerkPerson + summary: Create a Park Person + operationId: createParkPerson + requestBody: + required: true + content: + 'application/json': + schema: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + responses: + 201: + description: Park Person created + content: + 'application/json': + schema: + type: string servers: - url: http://petstore.swagger.io:80/v2 components: @@ -2096,3 +2117,50 @@ components: type: object additionalProperties: type: string + OneOfWithinOneOfAbstractAnimal: + type: object + discriminator: + propertyName: type + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + required: + - type + properties: + type: + type: string + OneOfWithinOneOfCat: + type: object + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + AbstractCreateParkPerson: + type: object + discriminator: + propertyName: type + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + required: + - type + properties: + type: + type: string + CreateParkAnimalCarerPerson: + type: object + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + required: + - responsibleFor + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + CreateParkVisitorPerson: + type: object + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + OneOfWithinOneOfDog: + type: object + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' diff --git a/samples/client/petstore/spring-http-interface-reactive/.openapi-generator/FILES b/samples/client/petstore/spring-http-interface-reactive/.openapi-generator/FILES index f91496ca5b57..6ee097072f65 100644 --- a/samples/client/petstore/spring-http-interface-reactive/.openapi-generator/FILES +++ b/samples/client/petstore/spring-http-interface-reactive/.openapi-generator/FILES @@ -3,10 +3,12 @@ pom.xml src/main/java/org/openapitools/api/AnotherFakeApi.java src/main/java/org/openapitools/api/FakeApi.java src/main/java/org/openapitools/api/FakeClassnameTags123Api.java +src/main/java/org/openapitools/api/PerkPersonApi.java src/main/java/org/openapitools/api/PetApi.java src/main/java/org/openapitools/api/StoreApi.java src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/configuration/HttpInterfacesAbstractConfigurator.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -27,6 +29,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -44,6 +50,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PerkPersonApi.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PerkPersonApi.java new file mode 100644 index 000000000000..4cc92fa93028 --- /dev/null +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PerkPersonApi.java @@ -0,0 +1,43 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.7.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.CreateParkPersonRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.service.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import org.springframework.http.codec.multipart.Part; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface PerkPersonApi { + + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @HttpExchange( + method = "POST", + value = "/fake/one-of-within-one-of-park-persons", + accept = { "application/json" }, + contentType = "application/json" + ) + Mono> createParkPerson( + @RequestBody Mono createParkPersonRequest + ); + +} diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/configuration/HttpInterfacesAbstractConfigurator.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/configuration/HttpInterfacesAbstractConfigurator.java index 0d98bdb4fb56..b394910e2e62 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/configuration/HttpInterfacesAbstractConfigurator.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/configuration/HttpInterfacesAbstractConfigurator.java @@ -8,6 +8,7 @@ import org.openapitools.api.AnotherFakeApi; import org.openapitools.api.FakeApi; import org.openapitools.api.FakeClassnameTags123Api; +import org.openapitools.api.PerkPersonApi; import org.openapitools.api.PetApi; import org.openapitools.api.StoreApi; import org.openapitools.api.UserApi; @@ -43,6 +44,12 @@ FakeClassnameTags123Api fakeClassnameTags123HttpProxy() { return factory.createClient(FakeClassnameTags123Api.class); } + @Bean(name = "org.openapitools.configuration.HttpInterfacesAbstractConfigurator.perkPerson") + PerkPersonApi perkPersonHttpProxy() { + HttpServiceProxyFactory factory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient)).build(); + return factory.createClient(PerkPersonApi.class); + } + @Bean(name = "org.openapitools.configuration.HttpInterfacesAbstractConfigurator.pet") PetApi petHttpProxy() { HttpServiceProxyFactory factory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient)).build(); diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..7a22251306d0 --- /dev/null +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,104 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..ae791e2fa1ba --- /dev/null +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,106 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..bcee40f15021 --- /dev/null +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,32 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..59597fb701cb --- /dev/null +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,38 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..3812d98f203e --- /dev/null +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,80 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/spring-http-interface-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..6d6c24245e1e --- /dev/null +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,106 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/spring-http-interface-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..83e63aa2faf3 --- /dev/null +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,79 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/spring-http-interface-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..2a6c49581342 --- /dev/null +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,79 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/spring-http-interface/.openapi-generator/FILES b/samples/client/petstore/spring-http-interface/.openapi-generator/FILES index 69906eac967c..00eda2f44063 100644 --- a/samples/client/petstore/spring-http-interface/.openapi-generator/FILES +++ b/samples/client/petstore/spring-http-interface/.openapi-generator/FILES @@ -3,10 +3,12 @@ pom.xml src/main/java/org/openapitools/api/AnotherFakeApi.java src/main/java/org/openapitools/api/FakeApi.java src/main/java/org/openapitools/api/FakeClassnameTags123Api.java +src/main/java/org/openapitools/api/PerkPersonApi.java src/main/java/org/openapitools/api/PetApi.java src/main/java/org/openapitools/api/StoreApi.java src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/configuration/HttpInterfacesAbstractConfigurator.java +src/main/java/org/openapitools/model/AbstractCreateParkPersonDto.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyTypeDto.java src/main/java/org/openapitools/model/AdditionalPropertiesArrayDto.java src/main/java/org/openapitools/model/AdditionalPropertiesBooleanDto.java @@ -28,6 +30,10 @@ src/main/java/org/openapitools/model/ChildWithNullableDto.java src/main/java/org/openapitools/model/ClassModelDto.java src/main/java/org/openapitools/model/ClientDto.java src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonDto.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto.java +src/main/java/org/openapitools/model/CreateParkPersonRequestDto.java +src/main/java/org/openapitools/model/CreateParkVisitorPersonDto.java src/main/java/org/openapitools/model/DogDto.java src/main/java/org/openapitools/model/EnumArraysDto.java src/main/java/org/openapitools/model/EnumClassDto.java @@ -43,6 +49,9 @@ src/main/java/org/openapitools/model/Model200ResponseDto.java src/main/java/org/openapitools/model/NameDto.java src/main/java/org/openapitools/model/NullableMapPropertyDto.java src/main/java/org/openapitools/model/NumberOnlyDto.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimalDto.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCatDto.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDogDto.java src/main/java/org/openapitools/model/OrderDto.java src/main/java/org/openapitools/model/OuterCompositeDto.java src/main/java/org/openapitools/model/OuterEnumDto.java diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/api/PerkPersonApi.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/api/PerkPersonApi.java new file mode 100644 index 000000000000..8af66c02b6b9 --- /dev/null +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/api/PerkPersonApi.java @@ -0,0 +1,39 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.7.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.CreateParkPersonRequestDto; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.service.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface PerkPersonApi { + + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequestDto (required) + * @return Park Person created (status code 201) + */ + @HttpExchange( + method = "POST", + value = "/fake/one-of-within-one-of-park-persons", + accept = { "application/json" }, + contentType = "application/json" + ) + ResponseEntity createParkPerson( + @RequestBody CreateParkPersonRequestDto createParkPersonRequestDto + ); + +} diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/configuration/HttpInterfacesAbstractConfigurator.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/configuration/HttpInterfacesAbstractConfigurator.java index 0d98bdb4fb56..b394910e2e62 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/configuration/HttpInterfacesAbstractConfigurator.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/configuration/HttpInterfacesAbstractConfigurator.java @@ -8,6 +8,7 @@ import org.openapitools.api.AnotherFakeApi; import org.openapitools.api.FakeApi; import org.openapitools.api.FakeClassnameTags123Api; +import org.openapitools.api.PerkPersonApi; import org.openapitools.api.PetApi; import org.openapitools.api.StoreApi; import org.openapitools.api.UserApi; @@ -43,6 +44,12 @@ FakeClassnameTags123Api fakeClassnameTags123HttpProxy() { return factory.createClient(FakeClassnameTags123Api.class); } + @Bean(name = "org.openapitools.configuration.HttpInterfacesAbstractConfigurator.perkPerson") + PerkPersonApi perkPersonHttpProxy() { + HttpServiceProxyFactory factory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient)).build(); + return factory.createClient(PerkPersonApi.class); + } + @Bean(name = "org.openapitools.configuration.HttpInterfacesAbstractConfigurator.pet") PetApi petHttpProxy() { HttpServiceProxyFactory factory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient)).build(); diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/AbstractCreateParkPersonDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/AbstractCreateParkPersonDto.java new file mode 100644 index 000000000000..db797a9fd1d9 --- /dev/null +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/AbstractCreateParkPersonDto.java @@ -0,0 +1,98 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * AbstractCreateParkPersonDto + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPersonDto.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPersonDto.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPersonDto { + + private String type; + + public AbstractCreateParkPersonDto() { + super(); + } + + public AbstractCreateParkPersonDto type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPersonDto abstractCreateParkPerson = (AbstractCreateParkPersonDto) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPersonDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/spring-http-interface/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonDto.java new file mode 100644 index 000000000000..4babf292c9b0 --- /dev/null +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonDto.java @@ -0,0 +1,98 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.AbstractCreateParkPersonDto; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * CreateParkAnimalCarerPersonDto + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPersonDto extends AbstractCreateParkPersonDto implements CreateParkPersonRequestDto { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPersonDto() { + super(); + } + + public CreateParkAnimalCarerPersonDto responsibleFor(CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPersonDto type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPersonDto createParkAnimalCarerPerson = (CreateParkAnimalCarerPersonDto) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPersonDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/spring-http-interface/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto.java new file mode 100644 index 000000000000..2ba7a1fb78b6 --- /dev/null +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto.java @@ -0,0 +1,32 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CatDto.class, name = "CAT"), + @JsonSubTypes.Type(value = DogDto.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCatDto.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDogDto.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForDtoOneOfDto { + public String getType(); +} diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CreateParkPersonRequestDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CreateParkPersonRequestDto.java new file mode 100644 index 000000000000..db0b722ec2c4 --- /dev/null +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CreateParkPersonRequestDto.java @@ -0,0 +1,38 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.CreateParkAnimalCarerPersonDto; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto; +import org.openapitools.model.CreateParkVisitorPersonDto; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPersonDto.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPersonDto.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPersonDto.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPersonDto.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequestDto { + public String getType(); +} diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CreateParkVisitorPersonDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CreateParkVisitorPersonDto.java new file mode 100644 index 000000000000..e8c6cdcf06b7 --- /dev/null +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/CreateParkVisitorPersonDto.java @@ -0,0 +1,73 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.AbstractCreateParkPersonDto; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * CreateParkVisitorPersonDto + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPersonDto extends AbstractCreateParkPersonDto implements CreateParkPersonRequestDto { + + public CreateParkVisitorPersonDto() { + super(); + } + + + public CreateParkVisitorPersonDto type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPersonDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/spring-http-interface/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimalDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimalDto.java new file mode 100644 index 000000000000..c9a37baee4c0 --- /dev/null +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimalDto.java @@ -0,0 +1,100 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimalDto + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CatDto.class, name = "CAT"), + @JsonSubTypes.Type(value = DogDto.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCatDto.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDogDto.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimalDto { + + private String type; + + public OneOfWithinOneOfAbstractAnimalDto() { + super(); + } + + public OneOfWithinOneOfAbstractAnimalDto type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimalDto oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimalDto) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimalDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/spring-http-interface/src/main/java/org/openapitools/model/OneOfWithinOneOfCatDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/OneOfWithinOneOfCatDto.java new file mode 100644 index 000000000000..896460db1944 --- /dev/null +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/OneOfWithinOneOfCatDto.java @@ -0,0 +1,73 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimalDto; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * OneOfWithinOneOfCatDto + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCatDto extends OneOfWithinOneOfAbstractAnimalDto implements CreateParkAnimalCarerPersonResponsibleForDtoOneOfDto { + + public OneOfWithinOneOfCatDto() { + super(); + } + + + public OneOfWithinOneOfCatDto type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCatDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/spring-http-interface/src/main/java/org/openapitools/model/OneOfWithinOneOfDogDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/OneOfWithinOneOfDogDto.java new file mode 100644 index 000000000000..8f2c17617524 --- /dev/null +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/OneOfWithinOneOfDogDto.java @@ -0,0 +1,73 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimalDto; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.constraints.NotNull; + + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * OneOfWithinOneOfDogDto + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDogDto extends OneOfWithinOneOfAbstractAnimalDto implements CreateParkAnimalCarerPersonResponsibleForDtoOneOfDto { + + public OneOfWithinOneOfDogDto() { + super(); + } + + + public OneOfWithinOneOfDogDto type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDogDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/spring-cloud-oas3-fakeapi/.openapi-generator/FILES b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/.openapi-generator/FILES index e233021944ac..a0b33caa9c1d 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/.openapi-generator/FILES @@ -3,9 +3,11 @@ pom.xml src/main/java/org/openapitools/api/AnotherFakeApi.java src/main/java/org/openapitools/api/FakeApi.java src/main/java/org/openapitools/api/FakeClassnameTags123Api.java +src/main/java/org/openapitools/api/PerkPersonApi.java src/main/java/org/openapitools/api/PetApi.java src/main/java/org/openapitools/api/StoreApi.java src/main/java/org/openapitools/api/UserApi.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -26,6 +28,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -43,6 +49,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/PerkPersonApi.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/PerkPersonApi.java new file mode 100644 index 000000000000..03b1f1b30e2d --- /dev/null +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/PerkPersonApi.java @@ -0,0 +1,67 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.7.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.CreateParkPersonRequest; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +@Validated +@Tag(name = "PerkPerson", description = "the PerkPerson API") +public interface PerkPersonApi { + + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @Operation( + operationId = "createParkPerson", + summary = "Create a Park Person", + tags = { "PerkPerson" }, + responses = { + @ApiResponse(responseCode = "201", description = "Park Person created", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = String.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = "application/json" + ) + + ResponseEntity createParkPerson( + @Parameter(name = "CreateParkPersonRequest", description = "", required = true) @Valid @RequestBody CreateParkPersonRequest createParkPersonRequest + ); + +} diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..996ae17310f6 --- /dev/null +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,100 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @Schema(name = "type", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..a68d0ba4cdbb --- /dev/null +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,101 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @Schema(name = "responsibleFor", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..b2901ec0b6eb --- /dev/null +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,34 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..f41109f6d528 --- /dev/null +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,40 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..a0048523bc15 --- /dev/null +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,75 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..59741a2d5d39 --- /dev/null +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,102 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @Schema(name = "type", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..fdd5885820d4 --- /dev/null +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,74 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..df7e7dc8f6f7 --- /dev/null +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,74 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-delegate/.openapi-generator/FILES b/samples/openapi3/server/petstore/springboot-delegate/.openapi-generator/FILES index c875e2014289..b83aa39818bd 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/springboot-delegate/.openapi-generator/FILES @@ -18,6 +18,7 @@ src/main/java/org/openapitools/api/UserApiDelegate.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -38,6 +39,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -55,6 +60,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java index 8978e8e48071..ae08789a0dd4 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -42,13 +43,43 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Tag(name = "fake", description = "the fake API") +@Tag(name = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { default FakeApiDelegate getDelegate() { return new FakeApiDelegate() {}; } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @Operation( + operationId = "createParkPerson", + summary = "Create a Park Person", + tags = { "PerkPerson" }, + responses = { + @ApiResponse(responseCode = "201", description = "Park Person created", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = String.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createParkPerson( + @Parameter(name = "CreateParkPersonRequest", description = "", required = true) @Valid @RequestBody CreateParkPersonRequest createParkPersonRequest + ) { + return getDelegate().createParkPerson(createParkPersonRequest); + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java index fa9d7ba6ab86..8378f119f64c 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -3,6 +3,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -37,6 +38,18 @@ default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + * @see FakeApi#createParkPerson + */ + default ResponseEntity createParkPerson(CreateParkPersonRequest createParkPersonRequest) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..ec957621efcc --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,107 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @Schema(name = "type", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..346c49d418f7 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,109 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @Schema(name = "responsibleFor", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..b2901ec0b6eb --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,34 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..f41109f6d528 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,40 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..1d31575ac761 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..2a3bf9455f7c --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,109 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @Schema(name = "type", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..9c6aecb73574 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,81 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..08b7cabca6cb --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,81 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-delegate/src/main/resources/openapi.yaml b/samples/openapi3/server/petstore/springboot-delegate/src/main/resources/openapi.yaml index f26422f84ebf..45929d6ca2a9 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/resources/openapi.yaml +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2286,6 +2310,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForOneOf + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2421,6 +2493,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequest securitySchemes: petstore_auth: flows: diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/.openapi-generator/FILES b/samples/openapi3/server/petstore/springboot-implicitHeaders/.openapi-generator/FILES index 0f85b5e51c33..27d9d586e56d 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/.openapi-generator/FILES @@ -12,6 +12,7 @@ src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -32,6 +33,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -49,6 +54,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java index 73984a7f6ca5..1303082700f1 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -46,13 +47,44 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Tag(name = "fake", description = "the fake API") +@Tag(name = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @Operation( + operationId = "createParkPerson", + summary = "Create a Park Person", + tags = { "PerkPerson" }, + responses = { + @ApiResponse(responseCode = "201", description = "Park Person created", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = String.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createParkPerson( + @Parameter(name = "CreateParkPersonRequest", description = "", required = true) @Valid @RequestBody CreateParkPersonRequest createParkPersonRequest + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..ec957621efcc --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,107 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @Schema(name = "type", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..346c49d418f7 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,109 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @Schema(name = "responsibleFor", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..b2901ec0b6eb --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,34 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..f41109f6d528 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,40 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..1d31575ac761 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..2a3bf9455f7c --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,109 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @Schema(name = "type", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..9c6aecb73574 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,81 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..08b7cabca6cb --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,81 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-implicitHeaders/src/main/resources/openapi.yaml b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/resources/openapi.yaml index f26422f84ebf..45929d6ca2a9 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/resources/openapi.yaml +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2286,6 +2310,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForOneOf + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2421,6 +2493,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequest securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/.openapi-generator/FILES b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/.openapi-generator/FILES index eb1a4d69db4d..b783f64cdbd1 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/.openapi-generator/FILES +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/.openapi-generator/FILES @@ -7,6 +7,7 @@ src/main/java/org/openapitools/api/FakeClassnameTestApi.java src/main/java/org/openapitools/api/PetApi.java src/main/java/org/openapitools/api/StoreApi.java src/main/java/org/openapitools/api/UserApi.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -27,6 +28,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -44,6 +49,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/FakeApi.java index 86f8ae5f560c..19f47cd59150 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/api/FakeApi.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -46,9 +47,37 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Tag(name = "fake", description = "the fake API") +@Tag(name = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @Operation( + operationId = "createParkPerson", + summary = "Create a Park Person", + tags = { "PerkPerson" }, + responses = { + @ApiResponse(responseCode = "201", description = "Park Person created", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = String.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + ResponseEntity createParkPerson( + @Parameter(name = "CreateParkPersonRequest", description = "", required = true) @Valid @RequestBody CreateParkPersonRequest createParkPersonRequest + ) throws Exception; + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..ec957621efcc --- /dev/null +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,107 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @Schema(name = "type", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..346c49d418f7 --- /dev/null +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,109 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @Schema(name = "responsibleFor", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..b2901ec0b6eb --- /dev/null +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,34 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..f41109f6d528 --- /dev/null +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,40 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..1d31575ac761 --- /dev/null +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..2a3bf9455f7c --- /dev/null +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,109 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @Schema(name = "type", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..9c6aecb73574 --- /dev/null +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,81 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..08b7cabca6cb --- /dev/null +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,81 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-beanvalidation-no-nullable/.openapi-generator/FILES b/samples/server/petstore/springboot-beanvalidation-no-nullable/.openapi-generator/FILES index 95a549621f7f..4e24292aca6d 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/.openapi-generator/FILES @@ -12,6 +12,7 @@ src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/SpringFoxConfiguration.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -32,6 +33,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -49,6 +54,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java index a67ea4ee3e23..e049d2f10a1f 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -36,13 +37,44 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Api(value = "fake", description = "the fake API") +@Api(value = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @ApiOperation( + tags = { "PerkPerson" }, + value = "Create a Park Person", + nickname = "createParkPerson", + notes = "", + response = String.class + ) + @ApiResponses({ + @ApiResponse(code = 201, message = "Park Person created", response = String.class) + }) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createParkPerson( + @ApiParam(value = "", required = true) @Valid @RequestBody CreateParkPersonRequest createParkPersonRequest + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..4bebae6eaf72 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,107 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..996febc2eebe --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,109 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor = null; + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = responsibleFor; + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = responsibleFor; + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @ApiModelProperty(required = true, value = "") + @JsonProperty("responsibleFor") + public CreateParkAnimalCarerPersonResponsibleForOneOf getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..35b7933935e6 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,32 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..21feac85e376 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,40 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..ee7a1a309f87 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..28dd963b7861 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,109 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..2a7e7a0a4d2e --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,81 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..f58383d40082 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,81 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-beanvalidation-no-nullable/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/resources/openapi.yaml index f26422f84ebf..45929d6ca2a9 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2286,6 +2310,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForOneOf + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2421,6 +2493,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequest securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/springboot-beanvalidation/.openapi-generator/FILES b/samples/server/petstore/springboot-beanvalidation/.openapi-generator/FILES index 5e2378b3ee8c..251fb7d2b645 100644 --- a/samples/server/petstore/springboot-beanvalidation/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-beanvalidation/.openapi-generator/FILES @@ -12,6 +12,7 @@ src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/SpringFoxConfiguration.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -32,6 +33,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -49,6 +54,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java index a67ea4ee3e23..e049d2f10a1f 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -36,13 +37,44 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Api(value = "fake", description = "the fake API") +@Api(value = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @ApiOperation( + tags = { "PerkPerson" }, + value = "Create a Park Person", + nickname = "createParkPerson", + notes = "", + response = String.class + ) + @ApiResponses({ + @ApiResponse(code = 201, message = "Park Person created", response = String.class) + }) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createParkPerson( + @ApiParam(value = "", required = true) @Valid @RequestBody CreateParkPersonRequest createParkPersonRequest + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..7e7e1c4593ef --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,108 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..7bce648fee1d --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @ApiModelProperty(required = true, value = "") + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..a2e1289eb2c9 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,33 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..dea3d23d0cef --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..4db987a34bd0 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,83 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..f3e7c2e14be8 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..552391dc6934 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..bed451fc36e3 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-beanvalidation/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-beanvalidation/src/main/resources/openapi.yaml index f26422f84ebf..45929d6ca2a9 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-beanvalidation/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2286,6 +2310,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForOneOf + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2421,6 +2493,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequest securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/springboot-delegate-j8/.openapi-generator/FILES b/samples/server/petstore/springboot-delegate-j8/.openapi-generator/FILES index d568b26f5bef..dd03d1c1a78e 100644 --- a/samples/server/petstore/springboot-delegate-j8/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-delegate-j8/.openapi-generator/FILES @@ -18,6 +18,7 @@ src/main/java/org/openapitools/api/UserApiDelegate.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/SpringFoxConfiguration.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -38,6 +39,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -55,6 +60,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java index 56a32eb3f901..7857d53724df 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -32,13 +33,43 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Api(value = "fake", description = "the fake API") +@Api(value = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { default FakeApiDelegate getDelegate() { return new FakeApiDelegate() {}; } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @ApiOperation( + tags = { "PerkPerson" }, + value = "Create a Park Person", + nickname = "createParkPerson", + notes = "", + response = String.class + ) + @ApiResponses({ + @ApiResponse(code = 201, message = "Park Person created", response = String.class) + }) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createParkPerson( + @ApiParam(value = "", required = true) @Valid @RequestBody CreateParkPersonRequest createParkPersonRequest + ) { + return getDelegate().createParkPerson(createParkPersonRequest); + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java index fa9d7ba6ab86..8378f119f64c 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -3,6 +3,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -37,6 +38,18 @@ default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + * @see FakeApi#createParkPerson + */ + default ResponseEntity createParkPerson(CreateParkPersonRequest createParkPersonRequest) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..7e7e1c4593ef --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,108 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..7bce648fee1d --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @ApiModelProperty(required = true, value = "") + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..a2e1289eb2c9 --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,33 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..dea3d23d0cef --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..4db987a34bd0 --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,83 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..f3e7c2e14be8 --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..552391dc6934 --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..bed451fc36e3 --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-delegate-j8/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-delegate-j8/src/main/resources/openapi.yaml index f26422f84ebf..45929d6ca2a9 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-delegate-j8/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2286,6 +2310,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForOneOf + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2421,6 +2493,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequest securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/springboot-delegate/.openapi-generator/FILES b/samples/server/petstore/springboot-delegate/.openapi-generator/FILES index d568b26f5bef..dd03d1c1a78e 100644 --- a/samples/server/petstore/springboot-delegate/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-delegate/.openapi-generator/FILES @@ -18,6 +18,7 @@ src/main/java/org/openapitools/api/UserApiDelegate.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/SpringFoxConfiguration.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -38,6 +39,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -55,6 +60,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java index 56a32eb3f901..7857d53724df 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -32,13 +33,43 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Api(value = "fake", description = "the fake API") +@Api(value = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { default FakeApiDelegate getDelegate() { return new FakeApiDelegate() {}; } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @ApiOperation( + tags = { "PerkPerson" }, + value = "Create a Park Person", + nickname = "createParkPerson", + notes = "", + response = String.class + ) + @ApiResponses({ + @ApiResponse(code = 201, message = "Park Person created", response = String.class) + }) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createParkPerson( + @ApiParam(value = "", required = true) @Valid @RequestBody CreateParkPersonRequest createParkPersonRequest + ) { + return getDelegate().createParkPerson(createParkPersonRequest); + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java index fa9d7ba6ab86..8378f119f64c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -3,6 +3,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -37,6 +38,18 @@ default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + * @see FakeApi#createParkPerson + */ + default ResponseEntity createParkPerson(CreateParkPersonRequest createParkPersonRequest) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..3b01e8ba3f46 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,108 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters and all parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..848248388e7f --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters and all parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @ApiModelProperty(required = true, value = "") + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..a2e1289eb2c9 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,33 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..dea3d23d0cef --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..91533818d4e3 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,83 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters and all parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..eb29c091b04a --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters and all parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..bdd56dcf6d91 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters and all parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..7f9894b5a63e --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters and all parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-delegate/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-delegate/src/main/resources/openapi.yaml index f26422f84ebf..45929d6ca2a9 100644 --- a/samples/server/petstore/springboot-delegate/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-delegate/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2286,6 +2310,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForOneOf + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2421,6 +2493,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequest securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/springboot-implicitHeaders/.openapi-generator/FILES b/samples/server/petstore/springboot-implicitHeaders/.openapi-generator/FILES index 95a549621f7f..4e24292aca6d 100644 --- a/samples/server/petstore/springboot-implicitHeaders/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-implicitHeaders/.openapi-generator/FILES @@ -12,6 +12,7 @@ src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/SpringFoxConfiguration.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -32,6 +33,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -49,6 +54,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java index 6d2e6427711e..ff40df975910 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -36,13 +37,44 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Api(value = "fake", description = "the fake API") +@Api(value = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @ApiOperation( + tags = { "PerkPerson" }, + value = "Create a Park Person", + nickname = "createParkPerson", + notes = "", + response = String.class + ) + @ApiResponses({ + @ApiResponse(code = 201, message = "Park Person created", response = String.class) + }) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createParkPerson( + @ApiParam(value = "", required = true) @Valid @RequestBody CreateParkPersonRequest createParkPersonRequest + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..7e7e1c4593ef --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,108 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..7bce648fee1d --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @ApiModelProperty(required = true, value = "") + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..a2e1289eb2c9 --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,33 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..dea3d23d0cef --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..4db987a34bd0 --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,83 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..f3e7c2e14be8 --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..552391dc6934 --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..bed451fc36e3 --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-implicitHeaders/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-implicitHeaders/src/main/resources/openapi.yaml index f26422f84ebf..45929d6ca2a9 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2286,6 +2310,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForOneOf + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2421,6 +2493,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequest securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/.openapi-generator/FILES b/samples/server/petstore/springboot-reactive-noResponseEntity/.openapi-generator/FILES index 93297148e9b7..f6d3f56870f6 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/.openapi-generator/FILES @@ -17,6 +17,7 @@ src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/api/UserApiDelegate.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java src/main/java/org/openapitools/configuration/HomeController.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -37,6 +38,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -54,6 +59,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java index e8017795bb5f..34f542312174 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java @@ -9,6 +9,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -37,13 +38,45 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Api(value = "fake", description = "the fake API") +@Api(value = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { default FakeApiDelegate getDelegate() { return new FakeApiDelegate() {}; } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @ApiOperation( + tags = { "PerkPerson" }, + value = "Create a Park Person", + nickname = "createParkPerson", + notes = "", + response = String.class + ) + @ApiResponses({ + @ApiResponse(code = 201, message = "Park Person created", response = String.class) + }) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + @ResponseStatus(HttpStatus.CREATED) + + default Mono createParkPerson( + @ApiParam(value = "", required = true) @Valid @RequestBody Mono createParkPersonRequest, + @ApiIgnore final ServerWebExchange exchange + ) { + return getDelegate().createParkPerson(createParkPersonRequest, exchange); + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java index e77f8f8b875f..233ef63a543d 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -41,6 +42,21 @@ default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + * @see FakeApi#createParkPerson + */ + default Mono createParkPerson(Mono createParkPersonRequest, + ServerWebExchange exchange) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(createParkPersonRequest).then(Mono.empty()); + + } + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..7e7e1c4593ef --- /dev/null +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,108 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..7bce648fee1d --- /dev/null +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @ApiModelProperty(required = true, value = "") + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..a2e1289eb2c9 --- /dev/null +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,33 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..dea3d23d0cef --- /dev/null +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..4db987a34bd0 --- /dev/null +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,83 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..f3e7c2e14be8 --- /dev/null +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..552391dc6934 --- /dev/null +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..bed451fc36e3 --- /dev/null +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-reactive-noResponseEntity/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/resources/openapi.yaml index f26422f84ebf..45929d6ca2a9 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2286,6 +2310,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForOneOf + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2421,6 +2493,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequest securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/springboot-reactive/.openapi-generator/FILES b/samples/server/petstore/springboot-reactive/.openapi-generator/FILES index 93297148e9b7..f6d3f56870f6 100644 --- a/samples/server/petstore/springboot-reactive/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-reactive/.openapi-generator/FILES @@ -17,6 +17,7 @@ src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/api/UserApiDelegate.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java src/main/java/org/openapitools/configuration/HomeController.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -37,6 +38,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -54,6 +59,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java index 3e6c622c23ce..e76374597dd1 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java @@ -9,6 +9,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -37,13 +38,44 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Api(value = "fake", description = "the fake API") +@Api(value = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { default FakeApiDelegate getDelegate() { return new FakeApiDelegate() {}; } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @ApiOperation( + tags = { "PerkPerson" }, + value = "Create a Park Person", + nickname = "createParkPerson", + notes = "", + response = String.class + ) + @ApiResponses({ + @ApiResponse(code = 201, message = "Park Person created", response = String.class) + }) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default Mono> createParkPerson( + @ApiParam(value = "", required = true) @Valid @RequestBody Mono createParkPersonRequest, + @ApiIgnore final ServerWebExchange exchange + ) { + return getDelegate().createParkPerson(createParkPersonRequest, exchange); + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java index 34d5eeec078f..2ace2a4a3f74 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -42,6 +43,21 @@ default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + * @see FakeApi#createParkPerson + */ + default Mono> createParkPerson(Mono createParkPersonRequest, + ServerWebExchange exchange) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(createParkPersonRequest).then(Mono.empty()); + + } + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..7e7e1c4593ef --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,108 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..7bce648fee1d --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @ApiModelProperty(required = true, value = "") + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..a2e1289eb2c9 --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,33 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..dea3d23d0cef --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..4db987a34bd0 --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,83 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..f3e7c2e14be8 --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..552391dc6934 --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..bed451fc36e3 --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,82 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-reactive/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml index f26422f84ebf..45929d6ca2a9 100644 --- a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2286,6 +2310,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForOneOf + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2421,6 +2493,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequest securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/springboot-useoptional/.openapi-generator/FILES b/samples/server/petstore/springboot-useoptional/.openapi-generator/FILES index 95a549621f7f..4e24292aca6d 100644 --- a/samples/server/petstore/springboot-useoptional/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-useoptional/.openapi-generator/FILES @@ -12,6 +12,7 @@ src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/SpringFoxConfiguration.java +src/main/java/org/openapitools/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -32,6 +33,10 @@ src/main/java/org/openapitools/model/ChildWithNullable.java src/main/java/org/openapitools/model/ClassModel.java src/main/java/org/openapitools/model/Client.java src/main/java/org/openapitools/model/ContainerDefaultValue.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/model/Dog.java src/main/java/org/openapitools/model/EnumArrays.java src/main/java/org/openapitools/model/EnumClass.java @@ -49,6 +54,9 @@ src/main/java/org/openapitools/model/ModelReturn.java src/main/java/org/openapitools/model/Name.java src/main/java/org/openapitools/model/NullableMapProperty.java src/main/java/org/openapitools/model/NumberOnly.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/model/Order.java src/main/java/org/openapitools/model/OuterComposite.java src/main/java/org/openapitools/model/OuterEnum.java diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java index ccf26c1b4855..2ad9b3f420b7 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullable; import org.openapitools.model.Client; +import org.openapitools.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClass; import java.time.LocalDate; @@ -36,13 +37,44 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Api(value = "fake", description = "the fake API") +@Api(value = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @ApiOperation( + tags = { "PerkPerson" }, + value = "Create a Park Person", + nickname = "createParkPerson", + notes = "", + response = String.class + ) + @ApiResponses({ + @ApiResponse(code = 201, message = "Park Person created", response = String.class) + }) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createParkPerson( + @ApiParam(value = "", required = true) @Valid @RequestBody CreateParkPersonRequest createParkPersonRequest + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..5d7c4e8fe177 --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AbstractCreateParkPerson.java @@ -0,0 +1,166 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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 class Builder { + + private AbstractCreateParkPerson instance; + + public Builder() { + this(new AbstractCreateParkPerson()); + } + + protected Builder(AbstractCreateParkPerson instance) { + this.instance = instance; + } + + protected Builder copyOf(AbstractCreateParkPerson value) { + this.instance.setType(value.type); + return this; + } + + public AbstractCreateParkPerson.Builder type(String type) { + this.instance.type(type); + return this; + } + + /** + * returns a built AbstractCreateParkPerson instance. + * + * The builder is not reusable (NullPointerException) + */ + public AbstractCreateParkPerson 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 (except for the default values). + */ + public static AbstractCreateParkPerson.Builder builder() { + return new AbstractCreateParkPerson.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AbstractCreateParkPerson.Builder toBuilder() { + AbstractCreateParkPerson.Builder builder = new AbstractCreateParkPerson.Builder(); + return builder.copyOf(this); + } + +} + diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..6e859955104d --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,182 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @ApiModelProperty(required = true, value = "") + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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 class Builder extends AbstractCreateParkPerson.Builder { + + private CreateParkAnimalCarerPerson instance; + + public Builder() { + this(new CreateParkAnimalCarerPerson()); + } + + protected Builder(CreateParkAnimalCarerPerson instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(CreateParkAnimalCarerPerson value) { + super.copyOf(instance); + this.instance.setResponsibleFor(value.responsibleFor); + return this; + } + + public CreateParkAnimalCarerPerson.Builder responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.instance.responsibleFor(responsibleFor); + return this; + } + + public CreateParkAnimalCarerPerson.Builder responsibleFor(JsonNullable responsibleFor) { + this.instance.responsibleFor = responsibleFor; + return this; + } + + @Override + public CreateParkAnimalCarerPerson.Builder type(String type) { + this.instance.type(type); + return this; + } + + /** + * returns a built CreateParkAnimalCarerPerson instance. + * + * The builder is not reusable (NullPointerException) + */ + public CreateParkAnimalCarerPerson build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static CreateParkAnimalCarerPerson.Builder builder() { + return new CreateParkAnimalCarerPerson.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public CreateParkAnimalCarerPerson.Builder toBuilder() { + CreateParkAnimalCarerPerson.Builder builder = new CreateParkAnimalCarerPerson.Builder(); + return builder.copyOf(this); + } + +} + diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..a2e1289eb2c9 --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,33 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkPersonRequest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..dea3d23d0cef --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkPersonRequest.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.CreateParkAnimalCarerPerson; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..93b386ceab09 --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/CreateParkVisitorPerson.java @@ -0,0 +1,144 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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 class Builder extends AbstractCreateParkPerson.Builder { + + private CreateParkVisitorPerson instance; + + public Builder() { + this(new CreateParkVisitorPerson()); + } + + protected Builder(CreateParkVisitorPerson instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(CreateParkVisitorPerson value) { + super.copyOf(instance); + return this; + } + + @Override + public CreateParkVisitorPerson.Builder type(String type) { + this.instance.type(type); + return this; + } + + /** + * returns a built CreateParkVisitorPerson instance. + * + * The builder is not reusable (NullPointerException) + */ + public CreateParkVisitorPerson build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static CreateParkVisitorPerson.Builder builder() { + return new CreateParkVisitorPerson.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public CreateParkVisitorPerson.Builder toBuilder() { + CreateParkVisitorPerson.Builder builder = new CreateParkVisitorPerson.Builder(); + return builder.copyOf(this); + } + +} + diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..76a5a254d01e --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,168 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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 class Builder { + + private OneOfWithinOneOfAbstractAnimal instance; + + public Builder() { + this(new OneOfWithinOneOfAbstractAnimal()); + } + + protected Builder(OneOfWithinOneOfAbstractAnimal instance) { + this.instance = instance; + } + + protected Builder copyOf(OneOfWithinOneOfAbstractAnimal value) { + this.instance.setType(value.type); + return this; + } + + public OneOfWithinOneOfAbstractAnimal.Builder type(String type) { + this.instance.type(type); + return this; + } + + /** + * returns a built OneOfWithinOneOfAbstractAnimal instance. + * + * The builder is not reusable (NullPointerException) + */ + public OneOfWithinOneOfAbstractAnimal 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 (except for the default values). + */ + public static OneOfWithinOneOfAbstractAnimal.Builder builder() { + return new OneOfWithinOneOfAbstractAnimal.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public OneOfWithinOneOfAbstractAnimal.Builder toBuilder() { + OneOfWithinOneOfAbstractAnimal.Builder builder = new OneOfWithinOneOfAbstractAnimal.Builder(); + return builder.copyOf(this); + } + +} + diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..3672139f2fc0 --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OneOfWithinOneOfCat.java @@ -0,0 +1,143 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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 class Builder extends OneOfWithinOneOfAbstractAnimal.Builder { + + private OneOfWithinOneOfCat instance; + + public Builder() { + this(new OneOfWithinOneOfCat()); + } + + protected Builder(OneOfWithinOneOfCat instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(OneOfWithinOneOfCat value) { + super.copyOf(instance); + return this; + } + + @Override + public OneOfWithinOneOfCat.Builder type(String type) { + this.instance.type(type); + return this; + } + + /** + * returns a built OneOfWithinOneOfCat instance. + * + * The builder is not reusable (NullPointerException) + */ + public OneOfWithinOneOfCat build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static OneOfWithinOneOfCat.Builder builder() { + return new OneOfWithinOneOfCat.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public OneOfWithinOneOfCat.Builder toBuilder() { + OneOfWithinOneOfCat.Builder builder = new OneOfWithinOneOfCat.Builder(); + return builder.copyOf(this); + } + +} + diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..9a979a4a23c1 --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OneOfWithinOneOfDog.java @@ -0,0 +1,143 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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 class Builder extends OneOfWithinOneOfAbstractAnimal.Builder { + + private OneOfWithinOneOfDog instance; + + public Builder() { + this(new OneOfWithinOneOfDog()); + } + + protected Builder(OneOfWithinOneOfDog instance) { + super(instance); // the parent builder shares the same instance + this.instance = instance; + } + + protected Builder copyOf(OneOfWithinOneOfDog value) { + super.copyOf(instance); + return this; + } + + @Override + public OneOfWithinOneOfDog.Builder type(String type) { + this.instance.type(type); + return this; + } + + /** + * returns a built OneOfWithinOneOfDog instance. + * + * The builder is not reusable (NullPointerException) + */ + public OneOfWithinOneOfDog build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + super.build(); + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static OneOfWithinOneOfDog.Builder builder() { + return new OneOfWithinOneOfDog.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public OneOfWithinOneOfDog.Builder toBuilder() { + OneOfWithinOneOfDog.Builder builder = new OneOfWithinOneOfDog.Builder(); + return builder.copyOf(this); + } + +} + diff --git a/samples/server/petstore/springboot-useoptional/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-useoptional/src/main/resources/openapi.yaml index f26422f84ebf..45929d6ca2a9 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-useoptional/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2286,6 +2310,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForOneOf + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2421,6 +2493,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequest securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/springboot-virtualan/.openapi-generator/FILES b/samples/server/petstore/springboot-virtualan/.openapi-generator/FILES index 629a3cc7437b..07c976321469 100644 --- a/samples/server/petstore/springboot-virtualan/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-virtualan/.openapi-generator/FILES @@ -12,6 +12,7 @@ src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApi.java src/main/java/org/openapitools/virtualan/api/PetApi.java src/main/java/org/openapitools/virtualan/api/StoreApi.java src/main/java/org/openapitools/virtualan/api/UserApi.java +src/main/java/org/openapitools/virtualan/model/AbstractCreateParkPerson.java src/main/java/org/openapitools/virtualan/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/virtualan/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/virtualan/model/AdditionalPropertiesBoolean.java @@ -32,6 +33,10 @@ src/main/java/org/openapitools/virtualan/model/ChildWithNullable.java src/main/java/org/openapitools/virtualan/model/ClassModel.java src/main/java/org/openapitools/virtualan/model/Client.java src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java +src/main/java/org/openapitools/virtualan/model/CreateParkAnimalCarerPerson.java +src/main/java/org/openapitools/virtualan/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java +src/main/java/org/openapitools/virtualan/model/CreateParkPersonRequest.java +src/main/java/org/openapitools/virtualan/model/CreateParkVisitorPerson.java src/main/java/org/openapitools/virtualan/model/Dog.java src/main/java/org/openapitools/virtualan/model/EnumArrays.java src/main/java/org/openapitools/virtualan/model/EnumClass.java @@ -49,6 +54,9 @@ src/main/java/org/openapitools/virtualan/model/ModelReturn.java src/main/java/org/openapitools/virtualan/model/Name.java src/main/java/org/openapitools/virtualan/model/NullableMapProperty.java src/main/java/org/openapitools/virtualan/model/NumberOnly.java +src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfAbstractAnimal.java +src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfCat.java +src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfDog.java src/main/java/org/openapitools/virtualan/model/Order.java src/main/java/org/openapitools/virtualan/model/OuterComposite.java src/main/java/org/openapitools/virtualan/model/OuterEnum.java diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java index 5cf987785b81..76fb3297db11 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import org.openapitools.virtualan.model.ChildWithNullable; import org.openapitools.virtualan.model.Client; +import org.openapitools.virtualan.model.CreateParkPersonRequest; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.virtualan.model.FileSchemaTestClass; import java.time.LocalDate; @@ -48,7 +49,7 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Tag(name = "fake", description = "the fake API") +@Tag(name = "PerkPerson", description = "the PerkPerson API") @VirtualService public interface FakeApi { @@ -56,6 +57,38 @@ default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequest (required) + * @return Park Person created (status code 201) + */ + @ApiVirtual + @Operation( + operationId = "createParkPerson", + summary = "Create a Park Person", + tags = { "PerkPerson" }, + responses = { + @ApiResponse(responseCode = "201", description = "Park Person created", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = String.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createParkPerson( + @Parameter(name = "CreateParkPersonRequest", description = "", required = true) @Valid @RequestBody CreateParkPersonRequest createParkPersonRequest + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AbstractCreateParkPerson.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AbstractCreateParkPerson.java new file mode 100644 index 000000000000..fad0b830264d --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AbstractCreateParkPerson.java @@ -0,0 +1,107 @@ +package org.openapitools.virtualan.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPerson + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPerson { + + private String type; + + public AbstractCreateParkPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPerson(String type) { + this.type = type; + } + + public AbstractCreateParkPerson type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @Schema(name = "type", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPerson abstractCreateParkPerson = (AbstractCreateParkPerson) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPerson {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkAnimalCarerPerson.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkAnimalCarerPerson.java new file mode 100644 index 000000000000..4e77fc5ce6a1 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkAnimalCarerPerson.java @@ -0,0 +1,109 @@ +package org.openapitools.virtualan.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.virtualan.model.AbstractCreateParkPerson; +import org.openapitools.virtualan.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPerson(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPerson responsibleFor(CreateParkAnimalCarerPersonResponsibleForOneOf responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @Schema(name = "responsibleFor", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPerson createParkAnimalCarerPerson = (CreateParkAnimalCarerPerson) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java new file mode 100644 index 000000000000..e55e7a03ecde --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkAnimalCarerPersonResponsibleForOneOf.java @@ -0,0 +1,34 @@ +package org.openapitools.virtualan.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForOneOf { + public String getType(); +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkPersonRequest.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkPersonRequest.java new file mode 100644 index 000000000000..4f0d33e7d94d --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkPersonRequest.java @@ -0,0 +1,40 @@ +package org.openapitools.virtualan.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.virtualan.model.CreateParkAnimalCarerPerson; +import org.openapitools.virtualan.model.CreateParkAnimalCarerPersonResponsibleForOneOf; +import org.openapitools.virtualan.model.CreateParkVisitorPerson; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPerson.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPerson.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequest { + public String getType(); +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkVisitorPerson.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkVisitorPerson.java new file mode 100644 index 000000000000..3e4b2092739f --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/CreateParkVisitorPerson.java @@ -0,0 +1,82 @@ +package org.openapitools.virtualan.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.virtualan.model.AbstractCreateParkPerson; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPerson + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPerson extends AbstractCreateParkPerson implements CreateParkPersonRequest { + + public CreateParkVisitorPerson() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPerson(String type) { + super(type); + } + + + public CreateParkVisitorPerson type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPerson {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfAbstractAnimal.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfAbstractAnimal.java new file mode 100644 index 000000000000..5caaea30c0ae --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfAbstractAnimal.java @@ -0,0 +1,109 @@ +package org.openapitools.virtualan.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimal + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCat.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDog.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimal { + + private String type; + + public OneOfWithinOneOfAbstractAnimal() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimal(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimal type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @Schema(name = "type", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimal oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimal) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimal {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfCat.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfCat.java new file mode 100644 index 000000000000..616c6e82c406 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfCat.java @@ -0,0 +1,81 @@ +package org.openapitools.virtualan.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.virtualan.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCat + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCat extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfCat() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCat(String type) { + super(type); + } + + + public OneOfWithinOneOfCat type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfDog.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfDog.java new file mode 100644 index 000000000000..bdbf631d35ee --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OneOfWithinOneOfDog.java @@ -0,0 +1,81 @@ +package org.openapitools.virtualan.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.virtualan.model.OneOfWithinOneOfAbstractAnimal; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDog + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDog extends OneOfWithinOneOfAbstractAnimal implements CreateParkAnimalCarerPersonResponsibleForOneOf { + + public OneOfWithinOneOfDog() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDog(String type) { + super(type); + } + + + public OneOfWithinOneOfDog type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot-virtualan/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-virtualan/src/main/resources/openapi.yaml index f26422f84ebf..45929d6ca2a9 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-virtualan/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2286,6 +2310,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForOneOf + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2421,6 +2493,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequest securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/springboot/.openapi-generator/FILES b/samples/server/petstore/springboot/.openapi-generator/FILES index bee80ebd189f..8c8ef3879814 100644 --- a/samples/server/petstore/springboot/.openapi-generator/FILES +++ b/samples/server/petstore/springboot/.openapi-generator/FILES @@ -12,6 +12,7 @@ src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/SpringFoxConfiguration.java +src/main/java/org/openapitools/model/AbstractCreateParkPersonDto.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyTypeDto.java src/main/java/org/openapitools/model/AdditionalPropertiesArrayDto.java src/main/java/org/openapitools/model/AdditionalPropertiesBooleanDto.java @@ -33,6 +34,10 @@ src/main/java/org/openapitools/model/ChildWithNullableDto.java src/main/java/org/openapitools/model/ClassModelDto.java src/main/java/org/openapitools/model/ClientDto.java src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonDto.java +src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto.java +src/main/java/org/openapitools/model/CreateParkPersonRequestDto.java +src/main/java/org/openapitools/model/CreateParkVisitorPersonDto.java src/main/java/org/openapitools/model/DogDto.java src/main/java/org/openapitools/model/EnumArraysDto.java src/main/java/org/openapitools/model/EnumClassDto.java @@ -48,6 +53,9 @@ src/main/java/org/openapitools/model/Model200ResponseDto.java src/main/java/org/openapitools/model/NameDto.java src/main/java/org/openapitools/model/NullableMapPropertyDto.java src/main/java/org/openapitools/model/NumberOnlyDto.java +src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimalDto.java +src/main/java/org/openapitools/model/OneOfWithinOneOfCatDto.java +src/main/java/org/openapitools/model/OneOfWithinOneOfDogDto.java src/main/java/org/openapitools/model/OrderDto.java src/main/java/org/openapitools/model/OuterCompositeDto.java src/main/java/org/openapitools/model/OuterEnumDto.java diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java index 4a6f8687b959..84d340e6ccea 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java @@ -9,6 +9,7 @@ import java.math.BigDecimal; import org.openapitools.model.ChildWithNullableDto; import org.openapitools.model.ClientDto; +import org.openapitools.model.CreateParkPersonRequestDto; import org.springframework.format.annotation.DateTimeFormat; import org.openapitools.model.FileSchemaTestClassDto; import java.time.LocalDate; @@ -36,13 +37,44 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") @Validated -@Api(value = "fake", description = "the fake API") +@Api(value = "PerkPerson", description = "the PerkPerson API") public interface FakeApi { default Optional getRequest() { return Optional.empty(); } + /** + * POST /fake/one-of-within-one-of-park-persons : Create a Park Person + * + * @param createParkPersonRequestDto (required) + * @return Park Person created (status code 201) + */ + @ApiOperation( + tags = { "PerkPerson" }, + value = "Create a Park Person", + nickname = "createParkPerson", + notes = "", + response = String.class + ) + @ApiResponses({ + @ApiResponse(code = 201, message = "Park Person created", response = String.class) + }) + @RequestMapping( + method = RequestMethod.POST, + value = "/fake/one-of-within-one-of-park-persons", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity createParkPerson( + @ApiParam(value = "", required = true) @Valid @RequestBody CreateParkPersonRequestDto createParkPersonRequestDto + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + /** * POST /fake/create_xml_item : creates an XmlItem * this route creates an XmlItem diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/AbstractCreateParkPersonDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/AbstractCreateParkPersonDto.java new file mode 100644 index 000000000000..c78ddcd10586 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/AbstractCreateParkPersonDto.java @@ -0,0 +1,109 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * AbstractCreateParkPersonDto + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPersonDto.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPersonDto.class, name = "VISITOR") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class AbstractCreateParkPersonDto { + + private String type; + + public AbstractCreateParkPersonDto() { + super(); + } + + /** + * Constructor with only required parameters + */ + public AbstractCreateParkPersonDto(String type) { + this.type = type; + } + + public AbstractCreateParkPersonDto type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractCreateParkPersonDto abstractCreateParkPerson = (AbstractCreateParkPersonDto) o; + return Objects.equals(this.type, abstractCreateParkPerson.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AbstractCreateParkPersonDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonDto.java new file mode 100644 index 000000000000..d2c77563f404 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonDto.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPersonDto; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkAnimalCarerPersonDto + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkAnimalCarerPersonDto extends AbstractCreateParkPersonDto implements CreateParkPersonRequestDto { + + private JsonNullable responsibleFor = JsonNullable.undefined(); + + public CreateParkAnimalCarerPersonDto() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkAnimalCarerPersonDto(CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto responsibleFor, String type) { + super(type); + this.responsibleFor = JsonNullable.of(responsibleFor); + } + + public CreateParkAnimalCarerPersonDto responsibleFor(CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto responsibleFor) { + this.responsibleFor = JsonNullable.of(responsibleFor); + return this; + } + + /** + * Get responsibleFor + * @return responsibleFor + */ + @NotNull @Valid + @ApiModelProperty(required = true, value = "") + @JsonProperty("responsibleFor") + public JsonNullable getResponsibleFor() { + return responsibleFor; + } + + public void setResponsibleFor(JsonNullable responsibleFor) { + this.responsibleFor = responsibleFor; + } + + + public CreateParkAnimalCarerPersonDto type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateParkAnimalCarerPersonDto createParkAnimalCarerPerson = (CreateParkAnimalCarerPersonDto) o; + return Objects.equals(this.responsibleFor, createParkAnimalCarerPerson.responsibleFor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleFor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkAnimalCarerPersonDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" responsibleFor: ").append(toIndentedString(responsibleFor)).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/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto.java new file mode 100644 index 000000000000..ae54dcef6c4f --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto.java @@ -0,0 +1,33 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CatDto.class, name = "CAT"), + @JsonSubTypes.Type(value = DogDto.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCatDto.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDogDto.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkAnimalCarerPersonResponsibleForDtoOneOfDto { + public String getType(); +} diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkPersonRequestDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkPersonRequestDto.java new file mode 100644 index 000000000000..e277ee358a3e --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkPersonRequestDto.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.CreateParkAnimalCarerPersonDto; +import org.openapitools.model.CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto; +import org.openapitools.model.CreateParkVisitorPersonDto; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CreateParkAnimalCarerPersonDto.class, name = "ANIMAL_CARER"), + @JsonSubTypes.Type(value = CreateParkVisitorPersonDto.class, name = "VISITOR"), + @JsonSubTypes.Type(value = CreateParkAnimalCarerPersonDto.class, name = "CreateParkAnimalCarerPerson"), + @JsonSubTypes.Type(value = CreateParkVisitorPersonDto.class, name = "CreateParkVisitorPerson") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public interface CreateParkPersonRequestDto { + public String getType(); +} diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkVisitorPersonDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkVisitorPersonDto.java new file mode 100644 index 000000000000..3b3150bec620 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/CreateParkVisitorPersonDto.java @@ -0,0 +1,83 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.AbstractCreateParkPersonDto; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * CreateParkVisitorPersonDto + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class CreateParkVisitorPersonDto extends AbstractCreateParkPersonDto implements CreateParkPersonRequestDto { + + public CreateParkVisitorPersonDto() { + super(); + } + + /** + * Constructor with only required parameters + */ + public CreateParkVisitorPersonDto(String type) { + super(type); + } + + + public CreateParkVisitorPersonDto type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateParkVisitorPersonDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimalDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimalDto.java new file mode 100644 index 000000000000..e054dbdd9a23 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/OneOfWithinOneOfAbstractAnimalDto.java @@ -0,0 +1,111 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfAbstractAnimalDto + */ + +@JsonIgnoreProperties( + value = "type", // ignore manually set type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CatDto.class, name = "CAT"), + @JsonSubTypes.Type(value = DogDto.class, name = "NESTED_TWO"), + @JsonSubTypes.Type(value = OneOfWithinOneOfCatDto.class, name = "OneOfWithinOneOfCat"), + @JsonSubTypes.Type(value = OneOfWithinOneOfDogDto.class, name = "OneOfWithinOneOfDog") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfAbstractAnimalDto { + + private String type; + + public OneOfWithinOneOfAbstractAnimalDto() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfAbstractAnimalDto(String type) { + this.type = type; + } + + public OneOfWithinOneOfAbstractAnimalDto type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOfWithinOneOfAbstractAnimalDto oneOfWithinOneOfAbstractAnimal = (OneOfWithinOneOfAbstractAnimalDto) o; + return Objects.equals(this.type, oneOfWithinOneOfAbstractAnimal.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfAbstractAnimalDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).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/server/petstore/springboot/src/main/java/org/openapitools/model/OneOfWithinOneOfCatDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/OneOfWithinOneOfCatDto.java new file mode 100644 index 000000000000..a2fc0e8957cc --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/OneOfWithinOneOfCatDto.java @@ -0,0 +1,83 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimalDto; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfCatDto + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfCatDto extends OneOfWithinOneOfAbstractAnimalDto implements CreateParkAnimalCarerPersonResponsibleForDtoOneOfDto { + + public OneOfWithinOneOfCatDto() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfCatDto(String type) { + super(type); + } + + + public OneOfWithinOneOfCatDto type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfCatDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot/src/main/java/org/openapitools/model/OneOfWithinOneOfDogDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/OneOfWithinOneOfDogDto.java new file mode 100644 index 000000000000..504084dad11c --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/OneOfWithinOneOfDogDto.java @@ -0,0 +1,83 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OneOfWithinOneOfAbstractAnimalDto; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * OneOfWithinOneOfDogDto + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.7.0-SNAPSHOT") +public class OneOfWithinOneOfDogDto extends OneOfWithinOneOfAbstractAnimalDto implements CreateParkAnimalCarerPersonResponsibleForDtoOneOfDto { + + public OneOfWithinOneOfDogDto() { + super(); + } + + /** + * Constructor with only required parameters + */ + public OneOfWithinOneOfDogDto(String type) { + super(type); + } + + + public OneOfWithinOneOfDogDto type(String type) { + super.type(type); + return this; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOfWithinOneOfDogDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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/server/petstore/springboot/src/main/resources/openapi.yaml b/samples/server/petstore/springboot/src/main/resources/openapi.yaml index 8e4565fad645..12dc938eb3b6 100644 --- a/samples/server/petstore/springboot/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot/src/main/resources/openapi.yaml @@ -1284,6 +1284,30 @@ paths: - application/json x-tags: - tag: pet + /fake/one-of-within-one-of-park-persons: + post: + operationId: createParkPerson + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createParkPerson_request' + required: true + responses: + "201": + content: + application/json: + schema: + type: string + description: Park Person created + summary: Create a Park Person + tags: + - PerkPerson + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: PerkPerson components: requestBodies: UserArray: @@ -2274,6 +2298,54 @@ components: nullable: true type: object type: object + OneOfWithinOneOfAbstractAnimal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + NESTED_TWO: '#/components/schemas/Dog' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + OneOfWithinOneOfCat: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object + AbstractCreateParkPerson: + discriminator: + mapping: + VISITOR: '#/components/schemas/CreateParkVisitorPerson' + ANIMAL_CARER: '#/components/schemas/CreateParkAnimalCarerPerson' + propertyName: type + properties: + type: + type: string + required: + - type + type: object + CreateParkAnimalCarerPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + properties: + responsibleFor: + oneOf: + - $ref: '#/components/schemas/OneOfWithinOneOfDog' + - $ref: '#/components/schemas/OneOfWithinOneOfCat' + x-one-of-name: CreateParkAnimalCarerPersonResponsibleForDtoOneOfDto + required: + - responsibleFor + type: object + CreateParkVisitorPerson: + allOf: + - $ref: '#/components/schemas/AbstractCreateParkPerson' + type: object + OneOfWithinOneOfDog: + allOf: + - $ref: '#/components/schemas/OneOfWithinOneOfAbstractAnimal' + type: object updatePetWithForm_request: properties: name: @@ -2409,6 +2481,11 @@ components: required: - requiredFile type: object + createParkPerson_request: + oneOf: + - $ref: '#/components/schemas/CreateParkAnimalCarerPerson' + - $ref: '#/components/schemas/CreateParkVisitorPerson' + x-one-of-name: CreateParkPersonRequestDto securitySchemes: petstore_auth: flows: