diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java index 25f53be09fb8..15322f446969 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java @@ -989,17 +989,17 @@ hasChildren, isMap, isDeprecated, hasOnlyReadOnly, getExternalDocumentation(), g @Override public String toString() { final StringBuilder sb = new StringBuilder("CodegenModel{"); - sb.append("parent='").append(parent).append('\''); + sb.append("name='").append(name).append('\''); + sb.append(", parent='").append(parent).append('\''); sb.append(", parentSchema='").append(parentSchema).append('\''); sb.append(", interfaces=").append(interfaces); + sb.append(", interfaceModels=").append(interfaceModels!=null?interfaceModels.size():"[]"); sb.append(", allParents=").append(allParents); sb.append(", parentModel=").append(parentModel); - sb.append(", interfaceModels=").append(interfaceModels); - sb.append(", children=").append(children); + sb.append(", children=").append(children!=null?children.size():"[]"); sb.append(", anyOf=").append(anyOf); sb.append(", oneOf=").append(oneOf); sb.append(", allOf=").append(allOf); - sb.append(", name='").append(name).append('\''); sb.append(", classname='").append(classname).append('\''); sb.append(", title='").append(title).append('\''); sb.append(", description='").append(description).append('\''); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 81e09842ab53..488aad078285 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -3193,7 +3193,7 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch // FIXME: for now, we assume that the discriminator property is String discriminator.setPropertyType(typeMapping.get("string")); discriminator.setMapping(sourceDiscriminator.getMapping()); - List uniqueDescendants = new ArrayList(); + List uniqueDescendants = new ArrayList<>(); if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) { for (Entry e : sourceDiscriminator.getMapping().entrySet()) { String name; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index e5a0e4773155..4067c83c76b8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -32,9 +32,12 @@ import java.util.Arrays; import java.util.EnumSet; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; +import java.util.Set; import java.util.regex.Matcher; import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.Pair; @@ -884,9 +887,67 @@ public CodegenModel fromModel(String name, Schema model) { codegenModel.imports.remove("ApiModelProperty"); codegenModel.imports.remove("ApiModel"); } + return codegenModel; } + /** + * Analyse and post process all Models. + * Add parentVars to every Model which has a parent. This allows to generate + * fluent setter methods for inherited properties. + * @param objs the models map. + * @return the processed models map. + */ + @Override + public Map postProcessAllModels(Map objs) { + objs = super.postProcessAllModels(objs); + objs = super.updateAllModels(objs); + + for (ModelsMap modelsAttrs : objs.values()) { + for (ModelMap mo : modelsAttrs.getModels()) { + CodegenModel codegenModel = mo.getModel(); + Set inheritedImports = new HashSet<>(); + Map propertyHash = new HashMap<>(codegenModel.vars.size()); + for (final CodegenProperty property : codegenModel.vars) { + propertyHash.put(property.name, property); + } + CodegenModel parentCodegenModel = codegenModel.parentModel; + while (parentCodegenModel != null) { + for (final CodegenProperty property : parentCodegenModel.vars) { + // helper list of parentVars simplifies templating + if (!propertyHash.containsKey(property.name)) { + propertyHash.put(property.name, property); + final CodegenProperty parentVar = property.clone(); + parentVar.isInherited = true; + LOGGER.info("adding parent variable {}", property.name); + codegenModel.parentVars.add(parentVar); + Set imports = parentVar.getImports(true).stream().filter(Objects::nonNull).collect(Collectors.toSet()); + for (String imp: imports) { + // Avoid dupes + if (!codegenModel.getImports().contains(imp)) { + inheritedImports.add(imp); + codegenModel.getImports().add(imp); + } + } + } + } + parentCodegenModel = parentCodegenModel.getParentModel(); + } + // There must be a better way ... + for (String imp: inheritedImports) { + String qimp = importMapping().get(imp); + if (qimp != null) { + Map toAdd = new HashMap<>(); + toAdd.put("import", qimp); + modelsAttrs.getImports().add(toAdd); + } + } + } + } + return objs; + } + + /* * Add dynamic imports based on the parameters and vendor extensions of an operation. * The imports are expanded by the mustache {{import}} tag available to model and api diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java index e77bec480e13..556f696c7834 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java @@ -1,16 +1,17 @@ package org.openapitools.codegen.utils; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenModel; import org.openapitools.codegen.CodegenProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * This class holds data to add to `oneOf` members. Let's consider this example: * @@ -69,15 +70,19 @@ public void addFromInterfaceModel(CodegenModel cm, List> mod // Add all vars defined on cm // a "oneOf" model (cm) by default inherits all properties from its "interfaceModels", // but we only want to add properties defined on cm itself - List toAdd = new ArrayList(cm.vars); + List toAdd = new ArrayList<>(cm.vars); + // note that we can't just toAdd.removeAll(m.vars) for every interfaceModel, // as they might have different value of `hasMore` and thus are not equal - List omitAdding = new ArrayList(); + Set omitAdding = new HashSet<>(); if (cm.interfaceModels != null) { for (CodegenModel m : cm.interfaceModels) { for (CodegenProperty v : m.vars) { omitAdding.add(v.baseName); } + for (CodegenProperty v : m.allVars) { + omitAdding.add(v.baseName); + } } } for (CodegenProperty v : toAdd) { @@ -89,7 +94,7 @@ public void addFromInterfaceModel(CodegenModel cm, List> mod // Add all imports of cm for (Map importMap : modelsImports) { // we're ok with shallow clone here, because imports are strings only - additionalImports.add(new HashMap(importMap)); + additionalImports.add(new HashMap<>(importMap)); } } @@ -120,6 +125,7 @@ public void addToImplementor(CodegenConfig cc, CodegenModel implcm, List oneImport : additionalImports) { diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index 45990ffe202f..48e6d0faf879 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -164,6 +164,29 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} } {{! end feature: getter and setter }} {{/vars}} + {{#parentVars}} + + {{! begin feature: fluent setter methods for inherited properties }} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + super.{{setter}}({{name}}); + return this; + } + {{#isArray}} + + public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + super.add{{nameInCamelCase}}Item({{name}}Item); + return this; + } + {{/isArray}} + {{#isMap}} + + public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + super.put{{nameInCamelCase}}Item({{name}}Item); + return this; + } + {{/isMap}} + {{! end feature: fluent setter methods for inherited properties }} + {{/parentVars}} @Override public boolean equals(Object o) { @@ -178,23 +201,27 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} {{/-last}}{{/vars}}{{#parent}} && super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} return true;{{/hasVars}} - }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + } + {{#vendorExtensions.x-jackson-optional-nullable-helpers}} private static boolean equalsNullable(JsonNullable a, JsonNullable b) { return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + } + {{/vendorExtensions.x-jackson-optional-nullable-helpers}} @Override public int hashCode() { return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); - }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + } + {{#vendorExtensions.x-jackson-optional-nullable-helpers}} private static int hashCodeNullable(JsonNullable a) { if (a == null) { return 1; } return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + } + {{/vendorExtensions.x-jackson-optional-nullable-helpers}} @Override public String toString() { 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 cd7a9c95b6a2..de2b775456bd 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 @@ -987,6 +987,49 @@ public void oneOf_5381() throws IOException { assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/FooRefOrValue.java"), "public interface FooRefOrValue"); } + @Test + public void oneOf_allOf() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + String outputPath = output.getAbsolutePath().replace('\\', '/'); + OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml", null, new ParseOptions()).getOpenAPI(); + + SpringCodegen codegen = new SpringCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.setUseOneOfInterfaces(true); + + ClientOptInput input = new ClientOptInput(); + input.openAPI(openAPI); + input.config(codegen); + + DefaultGenerator generator = new DefaultGenerator(); + codegen.setHateoas(true); + generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true"); +// generator.setGeneratorPropertyDefault(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, "true"); + generator.setGeneratorPropertyDefault(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "false"); + + codegen.setUseOneOfInterfaces(true); + codegen.setLegacyDiscriminatorBehavior(false); + + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true"); + generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false"); + + generator.opts(input).generate(); + + assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/Foo.java"), "public class Foo extends Entity implements FooRefOrValue"); + assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/FooRef.java"), "public class FooRef extends EntityRef implements FooRefOrValue"); + assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/FooRefOrValue.java"), "public interface FooRefOrValue"); + // previous bugs + assertFileNotContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/BarRef.java"), "atTypesuper.hashCode"); + assertFileNotContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/BarRef.java"), "private String atBaseType"); + // imports for inherited properties + assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/PizzaSpeziale.java"), "import java.math.BigDecimal"); + } + @Test public void testTypeMappings() { final SpringCodegen codegen = new SpringCodegen(); diff --git a/modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml b/modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml index ec0120ca4f21..dc916b1ee21e 100644 --- a/modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml @@ -116,13 +116,15 @@ components: - $ref: '#/components/schemas/Entity' FooRef: type: object - discriminator: - propertyName: '@type' properties: foorefPropA: type: string allOf: - $ref: '#/components/schemas/EntityRef' + BarRef: + type: object + allOf: + - $ref: '#/components/schemas/EntityRef' Bar_Create: type: object properties: @@ -149,6 +151,32 @@ components: $ref: '#/components/schemas/FooRefOrValue' allOf: - $ref: '#/components/schemas/Entity' + BarRefOrValue: + type: object + oneOf: + - $ref: "#/components/schemas/Bar" + - $ref: "#/components/schemas/BarRef" + Pizza: + type: object + properties: + pizzaSize: + type: number + allOf: + - $ref: '#/components/schemas/Entity' + Pasta: + type: object + properties: + vendor: + type: string + allOf: + - $ref: '#/components/schemas/Entity' + PizzaSpeziale: + type: object + properties: + toppings: + type: string + allOf: + - $ref: '#/components/schemas/Pizza' requestBodies: Foo: diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java index 375c8ce6e448..7208cedbd0b5 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java index 7e195225a7e0..0e7e1b097362 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java index 2201d26277a1..155bff326518 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/.openapi-generator/FILES b/samples/openapi3/server/petstore/spring-boot-oneof/.openapi-generator/FILES index 422e07678a14..2b0612d53d7f 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/spring-boot-oneof/.openapi-generator/FILES @@ -11,12 +11,17 @@ src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/model/Addressable.java src/main/java/org/openapitools/model/Bar.java src/main/java/org/openapitools/model/BarCreate.java +src/main/java/org/openapitools/model/BarRef.java +src/main/java/org/openapitools/model/BarRefOrValue.java src/main/java/org/openapitools/model/Entity.java src/main/java/org/openapitools/model/EntityRef.java src/main/java/org/openapitools/model/Extensible.java src/main/java/org/openapitools/model/Foo.java src/main/java/org/openapitools/model/FooRef.java src/main/java/org/openapitools/model/FooRefOrValue.java +src/main/java/org/openapitools/model/Pasta.java +src/main/java/org/openapitools/model/Pizza.java +src/main/java/org/openapitools/model/PizzaSpeziale.java src/main/resources/application.properties src/main/resources/openapi.yaml src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java index 1efd29303f15..2ba1acefbf2a 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Bar.java @@ -25,7 +25,7 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen") -public class Bar extends Entity { +public class Bar extends Entity implements BarRefOrValue { @JsonProperty("id") private String id; @@ -115,6 +115,26 @@ public void setFoo(FooRefOrValue foo) { this.foo = foo; } + public Bar href(String href) { + super.setHref(href); + return this; + } + + public Bar atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public Bar atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public Bar atType(String atType) { + super.setAtType(atType); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java index 15a33a51b68a..365251e5d34d 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarCreate.java @@ -95,6 +95,31 @@ public void setFoo(FooRefOrValue foo) { this.foo = foo; } + public BarCreate href(String href) { + super.setHref(href); + return this; + } + + public BarCreate id(String id) { + super.setId(id); + return this; + } + + public BarCreate atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public BarCreate atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public BarCreate atType(String atType) { + super.setAtType(atType); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java new file mode 100644 index 000000000000..abae00509426 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.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.model.EntityRef; +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; + +/** + * BarRef + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public class BarRef extends EntityRef implements BarRefOrValue { + + public BarRef name(String name) { + super.setName(name); + return this; + } + + public BarRef atReferredType(String atReferredType) { + super.setAtReferredType(atReferredType); + return this; + } + + public BarRef href(String href) { + super.setHref(href); + return this; + } + + public BarRef id(String id) { + super.setId(id); + return this; + } + + public BarRef atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public BarRef atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public BarRef atType(String atType) { + super.setAtType(atType); + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BarRef {\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/spring-boot-oneof/src/main/java/org/openapitools/model/BarRefOrValue.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRefOrValue.java new file mode 100644 index 000000000000..151f8f044417 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRefOrValue.java @@ -0,0 +1,36 @@ +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.Bar; +import org.openapitools.model.BarRef; +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 = Bar.class, name = "Bar"), + @JsonSubTypes.Type(value = BarRef.class, name = "BarRef") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public interface BarRefOrValue { + public String getAtType(); +} diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java index 846a860f6998..b599931e03a1 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Entity.java @@ -12,6 +12,9 @@ import org.openapitools.model.BarCreate; import org.openapitools.model.Extensible; import org.openapitools.model.Foo; +import org.openapitools.model.Pasta; +import org.openapitools.model.Pizza; +import org.openapitools.model.PizzaSpeziale; import org.openapitools.jackson.nullable.JsonNullable; import java.time.OffsetDateTime; import javax.validation.Valid; @@ -34,7 +37,10 @@ @JsonSubTypes({ @JsonSubTypes.Type(value = Bar.class, name = "Bar"), @JsonSubTypes.Type(value = BarCreate.class, name = "Bar_Create"), - @JsonSubTypes.Type(value = Foo.class, name = "Foo") + @JsonSubTypes.Type(value = Foo.class, name = "Foo"), + @JsonSubTypes.Type(value = Pasta.class, name = "Pasta"), + @JsonSubTypes.Type(value = Pizza.class, name = "Pizza"), + @JsonSubTypes.Type(value = PizzaSpeziale.class, name = "PizzaSpeziale") }) @Generated(value = "org.openapitools.codegen.languages.SpringCodegen") diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java index 2c5e68a517f9..4e3ce69f39eb 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/EntityRef.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import org.openapitools.model.Addressable; +import org.openapitools.model.BarRef; import org.openapitools.model.Extensible; import org.openapitools.model.FooRef; import org.openapitools.jackson.nullable.JsonNullable; @@ -31,6 +32,7 @@ ) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true) @JsonSubTypes({ + @JsonSubTypes.Type(value = BarRef.class, name = "BarRef"), @JsonSubTypes.Type(value = FooRef.class, name = "FooRef") }) diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java index d73ec9a9d5fa..b0b6f53b1b16 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Foo.java @@ -32,21 +32,6 @@ public class Foo extends Entity implements FooRefOrValue { @JsonProperty("fooPropB") private String fooPropB; - @JsonProperty("href") - private String href; - - @JsonProperty("id") - private String id; - - @JsonProperty("@schemaLocation") - private String atSchemaLocation; - - @JsonProperty("@baseType") - private String atBaseType; - - @JsonProperty("@type") - private String atType; - public Foo fooPropA(String fooPropA) { this.fooPropA = fooPropA; return this; @@ -86,100 +71,30 @@ public void setFooPropB(String fooPropB) { } public Foo href(String href) { - this.href = href; + super.setHref(href); return this; } - /** - * Hyperlink reference - * @return href - */ - - @Schema(name = "href", description = "Hyperlink reference", required = false) - public String getHref() { - return href; - } - - public void setHref(String href) { - this.href = href; - } - public Foo id(String id) { - this.id = id; + super.setId(id); return this; } - /** - * unique identifier - * @return id - */ - - @Schema(name = "id", description = "unique identifier", required = false) - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - public Foo atSchemaLocation(String atSchemaLocation) { - this.atSchemaLocation = atSchemaLocation; + super.setAtSchemaLocation(atSchemaLocation); return this; } - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return atSchemaLocation - */ - - @Schema(name = "@schemaLocation", description = "A URI to a JSON-Schema file that defines additional attributes and relationships", required = false) - public String getAtSchemaLocation() { - return atSchemaLocation; - } - - public void setAtSchemaLocation(String atSchemaLocation) { - this.atSchemaLocation = atSchemaLocation; - } - public Foo atBaseType(String atBaseType) { - this.atBaseType = atBaseType; + super.setAtBaseType(atBaseType); return this; } - /** - * When sub-classing, this defines the super-class - * @return atBaseType - */ - - @Schema(name = "@baseType", description = "When sub-classing, this defines the super-class", required = false) - public String getAtBaseType() { - return atBaseType; - } - - public void setAtBaseType(String atBaseType) { - this.atBaseType = atBaseType; - } - public Foo atType(String atType) { - this.atType = atType; + super.setAtType(atType); return this; } - /** - * When sub-classing, this defines the sub-class Extensible name - * @return atType - */ - @NotNull - @Schema(name = "@type", description = "When sub-classing, this defines the sub-class Extensible name", required = true) - public String getAtType() { - return atType; - } - - public void setAtType(String atType) { - this.atType = atType; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -191,17 +106,12 @@ public boolean equals(Object o) { Foo foo = (Foo) o; return Objects.equals(this.fooPropA, foo.fooPropA) && Objects.equals(this.fooPropB, foo.fooPropB) && - Objects.equals(this.href, foo.href) && - Objects.equals(this.id, foo.id) && - Objects.equals(this.atSchemaLocation, foo.atSchemaLocation) && - Objects.equals(this.atBaseType, foo.atBaseType) && - Objects.equals(this.atType, foo.atType) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(fooPropA, fooPropB, href, id, atSchemaLocation, atBaseType, atType, super.hashCode()); + return Objects.hash(fooPropA, fooPropB, super.hashCode()); } @Override @@ -211,11 +121,6 @@ public String toString() { sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" fooPropA: ").append(toIndentedString(fooPropA)).append("\n"); sb.append(" fooPropB: ").append(toIndentedString(fooPropB)).append("\n"); - sb.append(" href: ").append(toIndentedString(href)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" atSchemaLocation: ").append(toIndentedString(atSchemaLocation)).append("\n"); - sb.append(" atBaseType: ").append(toIndentedString(atBaseType)).append("\n"); - sb.append(" atType: ").append(toIndentedString(atType)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java index 72c26b5de06f..5900228902d6 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/FooRef.java @@ -29,21 +29,6 @@ public class FooRef extends EntityRef implements FooRefOrValue { @JsonProperty("foorefPropA") private String foorefPropA; - @JsonProperty("href") - private String href; - - @JsonProperty("id") - private String id; - - @JsonProperty("@schemaLocation") - private String atSchemaLocation; - - @JsonProperty("@baseType") - private String atBaseType; - - @JsonProperty("@type") - private String atType; - public FooRef foorefPropA(String foorefPropA) { this.foorefPropA = foorefPropA; return this; @@ -63,101 +48,41 @@ public void setFoorefPropA(String foorefPropA) { this.foorefPropA = foorefPropA; } - public FooRef href(String href) { - this.href = href; + public FooRef name(String name) { + super.setName(name); return this; } - /** - * Hyperlink reference - * @return href - */ - - @Schema(name = "href", description = "Hyperlink reference", required = false) - public String getHref() { - return href; + public FooRef atReferredType(String atReferredType) { + super.setAtReferredType(atReferredType); + return this; } - public void setHref(String href) { - this.href = href; + public FooRef href(String href) { + super.setHref(href); + return this; } public FooRef id(String id) { - this.id = id; + super.setId(id); return this; } - /** - * unique identifier - * @return id - */ - - @Schema(name = "id", description = "unique identifier", required = false) - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - public FooRef atSchemaLocation(String atSchemaLocation) { - this.atSchemaLocation = atSchemaLocation; + super.setAtSchemaLocation(atSchemaLocation); return this; } - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return atSchemaLocation - */ - - @Schema(name = "@schemaLocation", description = "A URI to a JSON-Schema file that defines additional attributes and relationships", required = false) - public String getAtSchemaLocation() { - return atSchemaLocation; - } - - public void setAtSchemaLocation(String atSchemaLocation) { - this.atSchemaLocation = atSchemaLocation; - } - public FooRef atBaseType(String atBaseType) { - this.atBaseType = atBaseType; + super.setAtBaseType(atBaseType); return this; } - /** - * When sub-classing, this defines the super-class - * @return atBaseType - */ - - @Schema(name = "@baseType", description = "When sub-classing, this defines the super-class", required = false) - public String getAtBaseType() { - return atBaseType; - } - - public void setAtBaseType(String atBaseType) { - this.atBaseType = atBaseType; - } - public FooRef atType(String atType) { - this.atType = atType; + super.setAtType(atType); return this; } - /** - * When sub-classing, this defines the sub-class Extensible name - * @return atType - */ - @NotNull - @Schema(name = "@type", description = "When sub-classing, this defines the sub-class Extensible name", required = true) - public String getAtType() { - return atType; - } - - public void setAtType(String atType) { - this.atType = atType; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -168,17 +93,12 @@ public boolean equals(Object o) { } FooRef fooRef = (FooRef) o; return Objects.equals(this.foorefPropA, fooRef.foorefPropA) && - Objects.equals(this.href, fooRef.href) && - Objects.equals(this.id, fooRef.id) && - Objects.equals(this.atSchemaLocation, fooRef.atSchemaLocation) && - Objects.equals(this.atBaseType, fooRef.atBaseType) && - Objects.equals(this.atType, fooRef.atType) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(foorefPropA, href, id, atSchemaLocation, atBaseType, atType, super.hashCode()); + return Objects.hash(foorefPropA, super.hashCode()); } @Override @@ -187,11 +107,6 @@ public String toString() { sb.append("class FooRef {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" foorefPropA: ").append(toIndentedString(foorefPropA)).append("\n"); - sb.append(" href: ").append(toIndentedString(href)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" atSchemaLocation: ").append(toIndentedString(atSchemaLocation)).append("\n"); - sb.append(" atBaseType: ").append(toIndentedString(atBaseType)).append("\n"); - sb.append(" atType: ").append(toIndentedString(atType)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java new file mode 100644 index 000000000000..116c2687b84f --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pasta.java @@ -0,0 +1,115 @@ +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.Entity; +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; + +/** + * Pasta + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public class Pasta extends Entity { + + @JsonProperty("vendor") + private String vendor; + + public Pasta vendor(String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * @return vendor + */ + + @Schema(name = "vendor", required = false) + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public Pasta href(String href) { + super.setHref(href); + return this; + } + + public Pasta id(String id) { + super.setId(id); + return this; + } + + public Pasta atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public Pasta atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public Pasta atType(String atType) { + super.setAtType(atType); + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pasta pasta = (Pasta) o; + return Objects.equals(this.vendor, pasta.vendor) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(vendor, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pasta {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).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/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java new file mode 100644 index 000000000000..015b75a8053b --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Pizza.java @@ -0,0 +1,125 @@ +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 java.math.BigDecimal; +import org.openapitools.model.Entity; +import org.openapitools.model.PizzaSpeziale; +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; + +/** + * Pizza + */ + +@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 = PizzaSpeziale.class, name = "PizzaSpeziale") +}) + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public class Pizza extends Entity { + + @JsonProperty("pizzaSize") + private BigDecimal pizzaSize; + + public Pizza pizzaSize(BigDecimal pizzaSize) { + this.pizzaSize = pizzaSize; + return this; + } + + /** + * Get pizzaSize + * @return pizzaSize + */ + @Valid + @Schema(name = "pizzaSize", required = false) + public BigDecimal getPizzaSize() { + return pizzaSize; + } + + public void setPizzaSize(BigDecimal pizzaSize) { + this.pizzaSize = pizzaSize; + } + + public Pizza href(String href) { + super.setHref(href); + return this; + } + + public Pizza id(String id) { + super.setId(id); + return this; + } + + public Pizza atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public Pizza atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public Pizza atType(String atType) { + super.setAtType(atType); + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pizza pizza = (Pizza) o; + return Objects.equals(this.pizzaSize, pizza.pizzaSize) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(pizzaSize, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pizza {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" pizzaSize: ").append(toIndentedString(pizzaSize)).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/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java new file mode 100644 index 000000000000..6b50ea036458 --- /dev/null +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/PizzaSpeziale.java @@ -0,0 +1,121 @@ +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.Pizza; +import java.math.BigDecimal; +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; + +/** + * PizzaSpeziale + */ + + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") +public class PizzaSpeziale extends Pizza { + + @JsonProperty("toppings") + private String toppings; + + public PizzaSpeziale toppings(String toppings) { + this.toppings = toppings; + return this; + } + + /** + * Get toppings + * @return toppings + */ + + @Schema(name = "toppings", required = false) + public String getToppings() { + return toppings; + } + + public void setToppings(String toppings) { + this.toppings = toppings; + } + + public PizzaSpeziale pizzaSize(BigDecimal pizzaSize) { + super.setPizzaSize(pizzaSize); + return this; + } + + public PizzaSpeziale href(String href) { + super.setHref(href); + return this; + } + + public PizzaSpeziale id(String id) { + super.setId(id); + return this; + } + + public PizzaSpeziale atSchemaLocation(String atSchemaLocation) { + super.setAtSchemaLocation(atSchemaLocation); + return this; + } + + public PizzaSpeziale atBaseType(String atBaseType) { + super.setAtBaseType(atBaseType); + return this; + } + + public PizzaSpeziale atType(String atType) { + super.setAtType(atType); + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PizzaSpeziale pizzaSpeziale = (PizzaSpeziale) o; + return Objects.equals(this.toppings, pizzaSpeziale.toppings) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(toppings, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PizzaSpeziale {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" toppings: ").append(toIndentedString(toppings)).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/spring-boot-oneof/src/main/resources/openapi.yaml b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/resources/openapi.yaml index 462a9cb829c7..9ab9dccf5dfc 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/resources/openapi.yaml +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/resources/openapi.yaml @@ -166,12 +166,14 @@ components: FooRef: allOf: - $ref: '#/components/schemas/EntityRef' - discriminator: - propertyName: '@type' properties: foorefPropA: type: string type: object + BarRef: + allOf: + - $ref: '#/components/schemas/EntityRef' + type: object Bar_Create: allOf: - $ref: '#/components/schemas/Entity' @@ -203,3 +205,30 @@ components: required: - id type: object + BarRefOrValue: + oneOf: + - $ref: '#/components/schemas/Bar' + - $ref: '#/components/schemas/BarRef' + type: object + x-one-of-name: BarRefOrValue + Pizza: + allOf: + - $ref: '#/components/schemas/Entity' + properties: + pizzaSize: + type: number + type: object + Pasta: + allOf: + - $ref: '#/components/schemas/Entity' + properties: + vendor: + type: string + type: object + PizzaSpeziale: + allOf: + - $ref: '#/components/schemas/Pizza' + properties: + toppings: + type: string + type: object diff --git a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java index 3302e7f30ca0..a5ffffc075a7 100644 --- a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java @@ -88,6 +88,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java index 3cb2a5dd4a32..f8b09521a77f 100644 --- a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java @@ -57,6 +57,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java index f03703acc48a..472111e924cf 100644 --- a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java @@ -48,6 +48,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java index 375c8ce6e448..7208cedbd0b5 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java index 7e195225a7e0..0e7e1b097362 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java index 2201d26277a1..155bff326518 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java index 375c8ce6e448..7208cedbd0b5 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java index 7e195225a7e0..0e7e1b097362 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java index 2201d26277a1..155bff326518 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java index 375c8ce6e448..7208cedbd0b5 100644 --- a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java index 7e195225a7e0..0e7e1b097362 100644 --- a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java index 2201d26277a1..155bff326518 100644 --- a/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java index 375c8ce6e448..7208cedbd0b5 100644 --- a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java index 7e195225a7e0..0e7e1b097362 100644 --- a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java +++ b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java index 2201d26277a1..155bff326518 100644 --- a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java +++ b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/BigCat.java index 375c8ce6e448..7208cedbd0b5 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Cat.java index 7e195225a7e0..0e7e1b097362 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Dog.java index 2201d26277a1..155bff326518 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java index 48ef9800a85c..b706f55e4689 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/BigCat.java @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java index dcb4bbe9aec8..a58043f8dff3 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Cat.java @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java index b445b1b20647..431235fb04c1 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Dog.java @@ -49,6 +49,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Cat.java index c512b2f15914..b6e782282f28 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Cat.java @@ -50,6 +50,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Cat.java index c512b2f15914..b6e782282f28 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Cat.java @@ -50,6 +50,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Cat.java index c512b2f15914..b6e782282f28 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Cat.java @@ -50,6 +50,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Cat.java index c512b2f15914..b6e782282f28 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Cat.java @@ -50,6 +50,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCat.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCat.java index d9bf8904dc81..0512603faa29 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCat.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Cat.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Cat.java index e9f0eadb4b3e..4c523da550b3 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Cat.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Dog.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Dog.java index 555bc9c9ac72..d123f91d3f5f 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Dog.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCat.java index 12019bba5e82..8d0b1135ec4f 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCat.java @@ -90,6 +90,21 @@ public void setKind(KindEnum kind) { this.kind = kind; } + public BigCat declawed(Boolean declawed) { + super.setDeclawed(declawed); + return this; + } + + public BigCat className(String className) { + super.setClassName(className); + return this; + } + + public BigCat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java index 2bf0cfd302c2..d5cfa8b05521 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java @@ -59,6 +59,16 @@ public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + public Cat className(String className) { + super.setClassName(className); + return this; + } + + public Cat color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java index ae6abe025998..0b15720dbd08 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java @@ -50,6 +50,16 @@ public void setBreed(String breed) { this.breed = breed; } + public Dog className(String className) { + super.setClassName(className); + return this; + } + + public Dog color(String color) { + super.setColor(color); + return this; + } + @Override public boolean equals(Object o) { if (this == o) {