diff --git a/bin/configs/jaxrs-spec-swagger-annotations.yaml b/bin/configs/jaxrs-spec-swagger-annotations.yaml new file mode 100644 index 000000000000..32b94175c667 --- /dev/null +++ b/bin/configs/jaxrs-spec-swagger-annotations.yaml @@ -0,0 +1,11 @@ +generatorName: jaxrs-spec +outputDir: samples/server/petstore/jaxrs-spec-swagger-annotations +inputSpec: modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/spec +additionalProperties: + artifactId: jaxrs-spec-petstore-server + serializableModel: "true" + hideGenerationTimestamp: "true" + implicitHeadersRegex: (api_key|enum_header_string) + generateBuilders: "true" + useSwaggerAnnotations: "true" diff --git a/bin/configs/jaxrs-spec-swagger-v3-annotations-jakarta.yaml b/bin/configs/jaxrs-spec-swagger-v3-annotations-jakarta.yaml new file mode 100644 index 000000000000..45176fa3384f --- /dev/null +++ b/bin/configs/jaxrs-spec-swagger-v3-annotations-jakarta.yaml @@ -0,0 +1,12 @@ +generatorName: jaxrs-spec +outputDir: samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta +inputSpec: modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/spec +additionalProperties: + artifactId: jaxrs-spec-petstore-server-jakarta-swagger-v3 + serializableModel: "true" + hideGenerationTimestamp: "true" + implicitHeadersRegex: (api_key|enum_header_string) + generateBuilders: "true" + useSwaggerV3Annotations: "true" + useJakartaEe: "true" diff --git a/bin/configs/jaxrs-spec-swagger-v3-annotations.yaml b/bin/configs/jaxrs-spec-swagger-v3-annotations.yaml new file mode 100644 index 000000000000..903753fa5e2f --- /dev/null +++ b/bin/configs/jaxrs-spec-swagger-v3-annotations.yaml @@ -0,0 +1,11 @@ +generatorName: jaxrs-spec +outputDir: samples/server/petstore/jaxrs-spec-swagger-v3-annotations +inputSpec: modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/spec +additionalProperties: + artifactId: jaxrs-spec-petstore-server + serializableModel: "true" + hideGenerationTimestamp: "true" + implicitHeadersRegex: (api_key|enum_header_string) + generateBuilders: "true" + useSwaggerV3Annotations: "true" diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index e630a4f9348c..02f6b177827e 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -84,6 +84,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useMutiny|Whether to use Smallrye Mutiny instead of CompletionStage for asynchronous computation. Only valid when library is set to quarkus.| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useSwaggerAnnotations|Whether to generate Swagger annotations.| |true| +|useSwaggerV3Annotations|Whether to generate Swagger v3 (OpenAPI v3) annotations.| |false| |useTags|use tags for creating interface and controller classnames| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 39cb1f9eb168..03c2d043bf78 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -85,6 +85,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useMutiny|Whether to use Smallrye Mutiny instead of CompletionStage for asynchronous computation. Only valid when library is set to quarkus.| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |useSwaggerAnnotations|Whether to generate Swagger annotations.| |true| +|useSwaggerV3Annotations|Whether to generate Swagger v3 (OpenAPI v3) annotations.| |false| |useTags|use tags for creating interface and controller classnames| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index b6bd537f7645..3a9d43e8cb27 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -42,6 +42,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { public static final String GENERATE_POM = "generatePom"; public static final String USE_SWAGGER_ANNOTATIONS = "useSwaggerAnnotations"; public static final String USE_MICROPROFILE_OPENAPI_ANNOTATIONS = "useMicroProfileOpenAPIAnnotations"; + public static final String USE_SWAGGER_V3_ANNOTATIONS = "useSwaggerV3Annotations"; public static final String USE_MUTINY = "useMutiny"; public static final String OPEN_API_SPEC_FILE_LOCATION = "openApiSpecFileLocation"; public static final String GENERATE_JSON_CREATOR = "generateJsonCreator"; @@ -57,6 +58,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { private boolean returnJbossResponse = false; private boolean generatePom = true; private boolean useSwaggerAnnotations = true; + private boolean useSwaggerV3Annotations = false; private boolean useMicroProfileOpenAPIAnnotations = false; private boolean useMutiny = false; @@ -133,6 +135,7 @@ public JavaJAXRSSpecServerCodegen() { cliOptions.add(CliOption.newBoolean(RETURN_RESPONSE, "Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.").defaultValue(String.valueOf(returnResponse))); cliOptions.add(CliOption.newBoolean(RETURN_JBOSS_RESPONSE, "Whether generate API interface should return `org.jboss.resteasy.reactive.RestResponse` instead of a deserialized entity. This flag cannot be combined with `returnResponse` flag. It requires the flag `interfaceOnly` and `useJakartaEE` set to true, because `org.jboss.resteasy.reactive.RestResponse` was introduced in Quarkus 2.x").defaultValue(String.valueOf(returnJbossResponse))); cliOptions.add(CliOption.newBoolean(USE_SWAGGER_ANNOTATIONS, "Whether to generate Swagger annotations.", useSwaggerAnnotations)); + cliOptions.add(CliOption.newBoolean(USE_SWAGGER_V3_ANNOTATIONS, "Whether to generate Swagger v3 (OpenAPI v3) annotations.", useSwaggerV3Annotations)); cliOptions.add(CliOption.newBoolean(USE_MICROPROFILE_OPENAPI_ANNOTATIONS, "Whether to generate Microprofile OpenAPI annotations. Only valid when library is set to quarkus.", useMicroProfileOpenAPIAnnotations)); cliOptions.add(CliOption.newString(OPEN_API_SPEC_FILE_LOCATION, "Location where the file containing the spec will be generated in the output folder. No file generated when set to null or empty string.")); cliOptions.add(CliOption.newBoolean(SUPPORT_ASYNC, "Wrap responses in CompletionStage type, allowing asynchronous computation (requires JAX-RS 2.1).", supportAsync)); @@ -149,14 +152,28 @@ public void processOpts() { convertPropertyToBooleanAndWriteBack(RETURN_JBOSS_RESPONSE, value -> returnJbossResponse = value); convertPropertyToBooleanAndWriteBack(SUPPORT_ASYNC, this::setSupportAsync); if (QUARKUS_LIBRARY.equals(library) || THORNTAIL_LIBRARY.equals(library) || HELIDON_LIBRARY.equals(library) || OPEN_LIBERTY_LIBRARY.equals(library) || KUMULUZEE_LIBRARY.equals(library)) { + // disable Swagger v2 annotations in library modes; MicroProfile or Swagger v3 may be used instead useSwaggerAnnotations = false; } else { convertPropertyToBooleanAndWriteBack(USE_SWAGGER_ANNOTATIONS, value -> useSwaggerAnnotations = value); } + // Swagger v3 can be used regardless of library + convertPropertyToBooleanAndWriteBack(USE_SWAGGER_V3_ANNOTATIONS, value -> useSwaggerV3Annotations = value); + // prefer v3 when requested + if (useSwaggerV3Annotations) { + useSwaggerAnnotations = false; + } if (KUMULUZEE_LIBRARY.equals(library)) { super.setSourceFolder("src/main/java"); } + if (useSwaggerAnnotations && useSwaggerV3Annotations) { + throw new IllegalArgumentException("Flags 'useSwaggerAnnotations' (v2) and 'useSwaggerV3Annotations' (v3) are mutually exclusive. Please enable only one."); + } + if (useSwaggerV3Annotations && useMicroProfileOpenAPIAnnotations) { + throw new IllegalArgumentException("Flags 'useSwaggerV3Annotations' and 'useMicroProfileOpenAPIAnnotations' are mutually exclusive. Please enable only one."); + } + if (QUARKUS_LIBRARY.equals(library)) { convertPropertyToBooleanAndWriteBack(USE_MICROPROFILE_OPENAPI_ANNOTATIONS, value -> useMicroProfileOpenAPIAnnotations = value); } @@ -184,6 +201,11 @@ public void processOpts() { super.processOpts(); + // expose flags to templates + additionalProperties.put(USE_SWAGGER_ANNOTATIONS, useSwaggerAnnotations); + additionalProperties.put(USE_SWAGGER_V3_ANNOTATIONS, useSwaggerV3Annotations); + additionalProperties.put(USE_MICROPROFILE_OPENAPI_ANNOTATIONS, useMicroProfileOpenAPIAnnotations); + supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen supportingFiles.add(new SupportingFile("README.mustache", "", "README.md") .doNotOverwrite()); diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/api.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/api.mustache index 7ffec7157546..4370b0d337c3 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/api.mustache @@ -9,6 +9,12 @@ import {{javaxPackage}}.ws.rs.core.Response; {{#useSwaggerAnnotations}} import io.swagger.annotations.*; {{/useSwaggerAnnotations}} +{{#useSwaggerV3Annotations}} +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; +{{/useSwaggerV3Annotations}} {{#supportAsync}} import java.util.concurrent.CompletionStage; import java.util.concurrent.CompletableFuture; @@ -27,7 +33,8 @@ import {{javaxPackage}}.validation.Valid;{{/useBeanValidation}} @Path("{{commonPath}}") {{/interfaceOnly}} {{#useSwaggerAnnotations}} -@Api(description = "the {{{baseName}}} API"){{/useSwaggerAnnotations}}{{#hasConsumes}} +@Api(description = "the {{{baseName}}} API"){{/useSwaggerAnnotations}}{{#useSwaggerV3Annotations}} +@Tag(name = "{{{baseName}}}"){{/useSwaggerV3Annotations}}{{#hasConsumes}} @Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}} @Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}} {{>generatedAnnotation}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/apiInterface.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/apiInterface.mustache index 61e3a89e941e..a35022d650cd 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/apiInterface.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/apiInterface.mustache @@ -26,5 +26,8 @@ }) {{/implicitHeadersParams.0}} @ApiResponses(value = { {{#responses}} - @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#returnContainer}}, responseContainer = "{{{.}}}"{{/returnContainer}}){{^-last}},{{/-last}}{{/responses}} }){{/useSwaggerAnnotations}} + @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#returnContainer}}, responseContainer = "{{{.}}}"{{/returnContainer}}){{^-last}},{{/-last}}{{/responses}} }){{/useSwaggerAnnotations}}{{#useSwaggerV3Annotations}} + @Operation(summary = "{{{summary}}}", description = "{{{notes}}}") + @ApiResponses(value = { {{#responses}} + @ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"){{^-last}},{{/-last}}{{/responses}} }){{/useSwaggerV3Annotations}} {{#supportAsync}}{{>returnAsyncTypeInterface}}{{/supportAsync}}{{^supportAsync}}{{#returnResponse}}Response{{/returnResponse}}{{^returnResponse}}{{>returnTypeInterface}}{{/returnResponse}}{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}); diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/apiMethod.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/apiMethod.mustache index 4cf0201c7a3a..6ab8cf1b00a2 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/apiMethod.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/apiMethod.mustache @@ -17,7 +17,11 @@ {{/implicitHeadersParams.0}} @ApiResponses(value = { {{#responses}} @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}} - }){{/useSwaggerAnnotations}} + }){{/useSwaggerAnnotations}}{{#useSwaggerV3Annotations}} + @Operation(summary = "{{{summary}}}", description = "{{{notes}}}") + @ApiResponses(value = { {{#responses}} + @ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"){{^-last}},{{/-last}}{{/responses}} + }){{/useSwaggerV3Annotations}} public {{#supportAsync}}CompletionStage<{{/supportAsync}}Response{{#supportAsync}}>{{/supportAsync}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>cookieParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}) { return {{#supportAsync}}CompletableFuture.supplyAsync(() -> {{/supportAsync}}Response.ok().entity("magic!").build(){{#supportAsync}}){{/supportAsync}}; } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache index 4827abaf35b0..c1c7eb97682b 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/api.mustache @@ -14,6 +14,12 @@ import org.jboss.resteasy.annotations.GZIP; {{#useSwaggerAnnotations}} import io.swagger.annotations.*; {{/useSwaggerAnnotations}} +{{#useSwaggerV3Annotations}} +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; +{{/useSwaggerV3Annotations}} {{#supportAsync}} {{#useMutiny}} @@ -96,7 +102,8 @@ import {{javaxPackage}}.validation.Valid;{{/useBeanValidation}} openIdConnectUrl = "{{openIdConnectUrl}}" ){{^-last}}, {{/-last}}{{/isOpenId}}{{/authMethods}} }){{/hasAuthMethods}}{{/useMicroProfileOpenAPIAnnotations}}{{#useSwaggerAnnotations}} -@Api(description = "the {{{baseName}}} API"){{/useSwaggerAnnotations}} +@Api(description = "the {{{baseName}}} API"){{/useSwaggerAnnotations}}{{#useSwaggerV3Annotations}} +@Tag(name = "{{{baseName}}}"){{/useSwaggerV3Annotations}} @Path("{{commonPath}}"){{#hasConsumes}} @Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}} @Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiInterface.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiInterface.mustache index 1eaefce90796..730d8141a18c 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiInterface.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiInterface.mustache @@ -19,7 +19,10 @@ }) {{/implicitHeadersParams.0}} @ApiResponses(value = { {{#responses}} - @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#returnContainer}}, responseContainer = "{{{.}}}"{{/returnContainer}}){{^-last}},{{/-last}}{{/responses}} }){{/useSwaggerAnnotations}}{{#useMicroProfileOpenAPIAnnotations}} + @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#returnContainer}}, responseContainer = "{{{.}}}"{{/returnContainer}}){{^-last}},{{/-last}}{{/responses}} }){{/useSwaggerAnnotations}}{{#useSwaggerV3Annotations}} + @Operation(summary = "{{{summary}}}", description = "{{{notes}}}") + @ApiResponses(value = { {{#responses}} + @ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"){{^-last}},{{/-last}}{{/responses}} }){{/useSwaggerV3Annotations}}{{#useMicroProfileOpenAPIAnnotations}} {{#hasAuthMethods}}@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value = { {{#authMethods}}{{#isOAuth}}@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement( name = "{{name}}", diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache index b5e8067ea8b5..40790c7fab92 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/apiMethod.mustache @@ -20,7 +20,11 @@ {{/implicitHeadersParams.0}} @ApiResponses(value = { {{#responses}} @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}} - }){{/useSwaggerAnnotations}}{{#useMicroProfileOpenAPIAnnotations}} + }){{/useSwaggerAnnotations}}{{#useSwaggerV3Annotations}} + @Operation(summary = "{{{summary}}}", description = "{{{notes}}}") + @ApiResponses(value = { {{#responses}} + @ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"){{^-last}},{{/-last}}{{/responses}} + }){{/useSwaggerV3Annotations}}{{#useMicroProfileOpenAPIAnnotations}} {{#hasAuthMethods}}@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirements(value={ {{#authMethods}}{{#isOAuth}}@org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "{{name}}", scopes = { {{#scopes}} "{{scope}}"{{^-last}},{{/-last}} {{/scopes}} }){{^-last}},{{/-last}}{{/isOAuth}}{{^isOAuth}} @org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement(name = "{{name}}"){{^-last}},{{/-last}}{{/isOAuth}} {{/authMethods}} }){{/hasAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache index 006ca151cf64..96bf9f82cbe9 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/libraries/quarkus/pom.mustache @@ -44,6 +44,9 @@ {{#useSwaggerAnnotations}} 1.6.10 {{/useSwaggerAnnotations}} +{{#useSwaggerV3Annotations}} + 2.2.21 +{{/useSwaggerV3Annotations}} {{#useMutiny}} 1.2.1 {{/useMutiny}} @@ -118,6 +121,14 @@ provided {{/useSwaggerAnnotations}} +{{#useSwaggerV3Annotations}} + + io.swagger.core.v3 + swagger-annotations + ${io.swagger.v3.annotations.version} + provided + +{{/useSwaggerV3Annotations}} {{#useMutiny}} io.smallrye diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache index 10194c793212..419f8b37ba03 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache @@ -1,6 +1,9 @@ {{#useSwaggerAnnotations}} import io.swagger.annotations.*; {{/useSwaggerAnnotations}} +{{#useSwaggerV3Annotations}} +import io.swagger.v3.oas.annotations.media.Schema; +{{/useSwaggerV3Annotations}} import java.util.Objects; {{#jackson}} import com.fasterxml.jackson.annotation.JsonProperty; @@ -21,7 +24,8 @@ import {{javaxPackage}}.xml.bind.annotation.XmlEnumValue; {{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{#description}}/** * {{.}} **/{{/description}} -{{#useSwaggerAnnotations}}{{#description}}@ApiModel(description = "{{{.}}}"){{/description}}{{/useSwaggerAnnotations}}{{#useMicroProfileOpenAPIAnnotations}} +{{#useSwaggerAnnotations}}{{#description}}@ApiModel(description = "{{{.}}}"){{/description}}{{/useSwaggerAnnotations}}{{#useSwaggerV3Annotations}} +@Schema({{#title}}title="{{{.}}}", {{/title}}{{#description}}description="{{{.}}}"{{/description}}{{^description}}description=""{{/description}}){{/useSwaggerV3Annotations}}{{#useMicroProfileOpenAPIAnnotations}} @org.eclipse.microprofile.openapi.annotations.media.Schema({{#title}}title="{{{.}}}", {{/title}}{{#description}}description="{{{.}}}"{{/description}}{{^description}}description=""{{/description}}){{/useMicroProfileOpenAPIAnnotations}} {{#jackson}}@JsonTypeName("{{name}}"){{/jackson}} {{>generatedAnnotation}}{{>additionalModelTypeAnnotations}}{{>xmlPojoAnnotation}} @@ -109,7 +113,8 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens @XmlElement(name="{{baseName}}"{{#required}}, required = {{required}}{{/required}}) {{/withXml}} {{#vendorExtensions.x-extra-annotation}}{{{vendorExtensions.x-extra-annotation}}}{{/vendorExtensions.x-extra-annotation}}{{#useSwaggerAnnotations}} - @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}"){{/useSwaggerAnnotations}}{{#useMicroProfileOpenAPIAnnotations}} + @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}"){{/useSwaggerAnnotations}}{{#useSwaggerV3Annotations}} + @Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}description = "{{{description}}}"){{/useSwaggerV3Annotations}}{{#useMicroProfileOpenAPIAnnotations}} @org.eclipse.microprofile.openapi.annotations.media.Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}description = "{{{description}}}"){{/useMicroProfileOpenAPIAnnotations}} {{#jackson}}@JsonProperty({{#required}}required = {{required}}, value = {{/required}}"{{baseName}}"){{/jackson}} {{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}}public {{>beanValidatedType}} {{getter}}() { diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache index cedf3b089601..82ee806bb1a7 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache @@ -120,6 +120,14 @@ 1.5.3 {{/useSwaggerAnnotations}} + {{#useSwaggerV3Annotations}} + + io.swagger.core.v3 + swagger-annotations + provided + ${io.swagger.v3.annotations.version} + + {{/useSwaggerV3Annotations}} com.google.code.findbugs @@ -202,5 +210,8 @@ {{#openApiNullable}} 0.2.8 {{/openApiNullable}} +{{#useSwaggerV3Annotations}} + 2.2.21 +{{/useSwaggerV3Annotations}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java index 52a281b12375..2e9e2e2153d2 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecServerCodegenTest.java @@ -1044,6 +1044,49 @@ public void generateSpecInterfaceWithJBossResponse() throws Exception { "resteasy-reactive"); } + @Test + public void generateSpecInterfaceWithSwaggerV3Annotations() throws Exception { + final File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + + final OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/petstore.yaml", null, new ParseOptions()).getOpenAPI(); + + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(INTERFACE_ONLY, true); // only interfaces + codegen.additionalProperties().put(USE_TAGS, true); // split by tags + codegen.additionalProperties().put(USE_SWAGGER_V3_ANNOTATIONS, true); // enable Swagger v3 annotations + // keep default library (spec), do NOT enable MicroProfile + + final ClientOptInput input = new ClientOptInput() + .openAPI(openAPI) + .config(codegen); + + final DefaultGenerator generator = new DefaultGenerator(); + final List files = generator.opts(input).generate(); + + // Then the java files are compilable + validateJavaSourceFiles(files); + + // And the generated interfaces contain Swagger v3 annotations and imports + TestUtils.ensureContainsFile(files, output, "src/gen/java/org/openapitools/api/PetApi.java"); + assertFileContains(output.toPath().resolve("src/gen/java/org/openapitools/api/PetApi.java"), + "import io.swagger.v3.oas.annotations.*;", + "import io.swagger.v3.oas.annotations.media.*;", + "import io.swagger.v3.oas.annotations.responses.*;", + "import io.swagger.v3.oas.annotations.tags.Tag;", + "@Tag(name = \"Pet\")"); + // Ensure MicroProfile annotations are NOT present + TestUtils.assertFileNotContains(output.toPath().resolve("src/gen/java/org/openapitools/api/PetApi.java"), + "org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition"); + + // And pom declares io.swagger.core.v3 swagger-annotations dependency and property + assertFileContains(output.toPath().resolve("pom.xml"), + "io.swagger.core.v3", + "swagger-annotations", + ""); + } + @Test public void generateSpecInterfaceWithMutinyAndJBossResponse() throws Exception { final File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/.openapi-generator-ignore b/samples/server/petstore/jaxrs-spec-swagger-annotations/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/.openapi-generator/FILES b/samples/server/petstore/jaxrs-spec-swagger-annotations/.openapi-generator/FILES new file mode 100644 index 000000000000..7155b1df8e89 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/.openapi-generator/FILES @@ -0,0 +1,65 @@ +README.md +pom.xml +src/gen/java/org/openapitools/api/AnotherFakeApi.java +src/gen/java/org/openapitools/api/FakeApi.java +src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +src/gen/java/org/openapitools/api/FooApi.java +src/gen/java/org/openapitools/api/PetApi.java +src/gen/java/org/openapitools/api/RestApplication.java +src/gen/java/org/openapitools/api/RestResourceRoot.java +src/gen/java/org/openapitools/api/StoreApi.java +src/gen/java/org/openapitools/api/UserApi.java +src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +src/gen/java/org/openapitools/model/AllOfWithSingleRef.java +src/gen/java/org/openapitools/model/Animal.java +src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java +src/gen/java/org/openapitools/model/ArrayTest.java +src/gen/java/org/openapitools/model/Capitalization.java +src/gen/java/org/openapitools/model/Cat.java +src/gen/java/org/openapitools/model/Category.java +src/gen/java/org/openapitools/model/ChildWithNullable.java +src/gen/java/org/openapitools/model/ClassModel.java +src/gen/java/org/openapitools/model/Client.java +src/gen/java/org/openapitools/model/DeprecatedObject.java +src/gen/java/org/openapitools/model/Dog.java +src/gen/java/org/openapitools/model/EnumArrays.java +src/gen/java/org/openapitools/model/EnumClass.java +src/gen/java/org/openapitools/model/EnumTest.java +src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java +src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java +src/gen/java/org/openapitools/model/FileSchemaTestClass.java +src/gen/java/org/openapitools/model/Foo.java +src/gen/java/org/openapitools/model/FooGetDefaultResponse.java +src/gen/java/org/openapitools/model/FormatTest.java +src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +src/gen/java/org/openapitools/model/HealthCheckResult.java +src/gen/java/org/openapitools/model/IntegerEnum.java +src/gen/java/org/openapitools/model/MapTest.java +src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/gen/java/org/openapitools/model/Model200Response.java +src/gen/java/org/openapitools/model/ModelApiResponse.java +src/gen/java/org/openapitools/model/ModelFile.java +src/gen/java/org/openapitools/model/ModelList.java +src/gen/java/org/openapitools/model/ModelReturn.java +src/gen/java/org/openapitools/model/Name.java +src/gen/java/org/openapitools/model/NullableClass.java +src/gen/java/org/openapitools/model/NumberOnly.java +src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java +src/gen/java/org/openapitools/model/Order.java +src/gen/java/org/openapitools/model/OuterComposite.java +src/gen/java/org/openapitools/model/OuterEnum.java +src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java +src/gen/java/org/openapitools/model/OuterEnumInteger.java +src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java +src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java +src/gen/java/org/openapitools/model/ParentWithNullable.java +src/gen/java/org/openapitools/model/Pet.java +src/gen/java/org/openapitools/model/ReadOnlyFirst.java +src/gen/java/org/openapitools/model/SingleRefType.java +src/gen/java/org/openapitools/model/SpecialModelName.java +src/gen/java/org/openapitools/model/StringEnum.java +src/gen/java/org/openapitools/model/Tag.java +src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java +src/gen/java/org/openapitools/model/User.java +src/main/openapi/openapi.yaml diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/.openapi-generator/VERSION b/samples/server/petstore/jaxrs-spec-swagger-annotations/.openapi-generator/VERSION new file mode 100644 index 000000000000..2fb556b60635 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.18.0-SNAPSHOT diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/README.md b/samples/server/petstore/jaxrs-spec-swagger-annotations/README.md new file mode 100644 index 000000000000..da90cb71c166 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/README.md @@ -0,0 +1,27 @@ +# JAX-RS server with OpenAPI + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. + +This is an example of building a OpenAPI-enabled JAX-RS server. +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + + +The JAX-RS implementation needs to be provided by the application server you are deploying on. + +To run the server from the command line, you can use maven to provision and start a TomEE Server. +Please execute the following: + +``` +mvn -Dtomee-embedded-plugin.http=80 package org.apache.tomee.maven:tomee-embedded-maven-plugin:7.0.5:run +``` + +You can then call your server endpoints under: + +``` +http://localhost:80/v2/ +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/pom.xml b/samples/server/petstore/jaxrs-spec-swagger-annotations/pom.xml new file mode 100644 index 000000000000..e47648ca286f --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/pom.xml @@ -0,0 +1,145 @@ + + 4.0.0 + org.openapitools + jaxrs-spec-petstore-server + war + jaxrs-spec-petstore-server + 1.0.0 + + + + src/main/java + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + false + + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + + + + jakarta.ws.rs + jakarta.ws.rs-api + ${jakarta.ws.rs-version} + provided + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson-version} + + + joda-time + joda-time + ${joda-version} + + + javax.annotation + javax.annotation-api + ${javax.annotation-api-version} + + + io.swagger + swagger-annotations + provided + 1.5.3 + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + junit + junit + ${junit-version} + test + + + org.testng + testng + 6.8.8 + test + + + junit + junit + + + snakeyaml + org.yaml + + + bsh + org.beanshell + + + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + + 1.8 + ${java.version} + ${java.version} + UTF-8 + 2.19.2 + 4.13.2 + 2.10.13 + 1.3.2 + 2.0.2 + 2.1.6 + 0.2.8 + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/AnotherFakeApi.java new file mode 100644 index 000000000000..cde152161b64 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -0,0 +1,34 @@ +package org.openapitools.api; + +import org.openapitools.model.Client; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/another-fake/dummy") +@Api(description = "the another-fake API") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class AnotherFakeApi { + + @PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) + public Response call123testSpecialTags(@Valid @NotNull Client client) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/FakeApi.java new file mode 100644 index 000000000000..ba98d6a77189 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/FakeApi.java @@ -0,0 +1,323 @@ +package org.openapitools.api; + +import java.math.BigDecimal; +import org.openapitools.model.ChildWithNullable; +import org.openapitools.model.Client; +import java.util.Date; +import org.openapitools.model.EnumClass; +import org.openapitools.model.FakeBigDecimalMap200Response; +import org.openapitools.model.FakeTestsDefaultsDefaultResponse; +import java.io.File; +import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; +import org.joda.time.LocalDate; +import java.util.Map; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.OuterComposite; +import org.openapitools.model.OuterObjectWithEnumProperty; +import org.openapitools.model.Pet; +import org.openapitools.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.model.User; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/fake") +@Api(description = "the fake API") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeApi { + + @GET + @Path("/BigDecimalMap") + @Produces({ "*/*" }) + @ApiOperation(value = "", notes = "for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys", response = FakeBigDecimalMap200Response.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = FakeBigDecimalMap200Response.class) + }) + public Response fakeBigDecimalMap() { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/health") + @Produces({ "application/json" }) + @ApiOperation(value = "Health check endpoint", notes = "", response = HealthCheckResult.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "The instance started successfully", response = HealthCheckResult.class) + }) + public Response fakeHealthGet() { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/http-signature-test") + @Consumes({ "application/json", "application/xml" }) + @ApiOperation(value = "test http signature authentication", notes = "", response = Void.class, authorizations = { + + @Authorization(value = "http_signature_test") + }, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "The instance started successfully", response = Void.class) + }) + public Response fakeHttpSignatureTest(@Valid @NotNull Pet pet,@QueryParam("query_1") @ApiParam("query parameter") String query1,@HeaderParam("header_1") @ApiParam("header parameter") String header1) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/boolean") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) + }) + public Response fakeOuterBooleanSerialize(@Valid Boolean body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/composite") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) + }) + public Response fakeOuterCompositeSerialize(@Valid OuterComposite outerComposite) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/number") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) + }) + public Response fakeOuterNumberSerialize(@Valid BigDecimal body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/string") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) + }) + public Response fakeOuterStringSerialize(@Valid String body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/property/enum-int") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @ApiOperation(value = "", notes = "Test serialization of enum (int) properties with examples", response = OuterObjectWithEnumProperty.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output enum (int)", response = OuterObjectWithEnumProperty.class) + }) + public Response fakePropertyEnumIntegerSerialize(@Valid @NotNull OuterObjectWithEnumProperty outerObjectWithEnumProperty) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/tests/defaults") + @Produces({ "application/json" }) + @ApiOperation(value = "test enum default in request body", notes = "", response = FakeTestsDefaultsDefaultResponse.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "response", response = FakeTestsDefaultsDefaultResponse.class) + }) + public Response fakeTestsDefaults() { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/additionalProperties-reference") + @Consumes({ "application/json" }) + @ApiOperation(value = "test referenced additionalProperties", notes = "", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response testAdditionalPropertiesReference(@Valid @NotNull Map requestBody) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/body-with-binary") + @Consumes({ "image/png" }) + @ApiOperation(value = "", notes = "For this test, the body has to be a binary file.", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Success", response = Void.class) + }) + public Response testBodyWithBinary(@Valid File body) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/body-with-file-schema") + @Consumes({ "application/json" }) + @ApiOperation(value = "", notes = "For this test, the body for this request must reference a schema named `File`.", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Success", response = Void.class) + }) + public Response testBodyWithFileSchema(@Valid @NotNull FileSchemaTestClass fileSchemaTestClass) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/body-with-query-params") + @Consumes({ "application/json" }) + @ApiOperation(value = "", notes = "", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Success", response = Void.class) + }) + public Response testBodyWithQueryParams(@QueryParam("query") @NotNull String query,@Valid @NotNull User user) { + return Response.ok().entity("magic!").build(); + } + + @PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) + public Response testClientModel(@Valid @NotNull Client client) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Consumes({ "application/x-www-form-urlencoded" }) + @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { + + @Authorization(value = "http_basic_test") + }, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) + }) + public Response testEndpointParameters(@FormParam(value = "number") BigDecimal number,@FormParam(value = "double") Double _double,@FormParam(value = "pattern_without_delimiter") String patternWithoutDelimiter,@FormParam(value = "byte") byte[] _byte,@FormParam(value = "integer") Integer integer,@FormParam(value = "int32") Integer int32,@FormParam(value = "int64") Long int64,@FormParam(value = "float") Float _float,@FormParam(value = "string") String string, @FormParam(value = "binary") InputStream binaryInputStream,@FormParam(value = "date") LocalDate date,@FormParam(value = "dateTime") Date dateTime,@FormParam(value = "password") String password,@FormParam(value = "callback") String paramCallback) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Consumes({ "application/x-www-form-urlencoded" }) + @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake" }) + @io.swagger.annotations.ApiImplicitParams({ + @io.swagger.annotations.ApiImplicitParam(name = "enum_header_string", value = "Header parameter enum test (string)", dataType = "String", paramType = "header") + }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid request", response = Void.class), + @ApiResponse(code = 404, message = "Not found", response = Void.class) + }) + public Response testEnumParameters(@HeaderParam("enum_header_string_array") @ApiParam("Header parameter enum test (string array)") List enumHeaderStringArray,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@QueryParam("enum_query_model_array") List enumQueryModelArray,@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) { + return Response.ok().entity("magic!").build(); + } + + @DELETE + @ApiOperation(value = "Fake endpoint to test group parameters (optional)", notes = "Fake endpoint to test group parameters (optional)", response = Void.class, authorizations = { + + @Authorization(value = "bearer_test") + }, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Something wrong", response = Void.class) + }) + public Response testGroupParameters(@QueryParam("required_string_group") @NotNull @ApiParam("Required String in group parameters") Integer requiredStringGroup,@HeaderParam("required_boolean_group") @NotNull @ApiParam("Required Boolean in group parameters") Boolean requiredBooleanGroup,@QueryParam("required_int64_group") @NotNull @ApiParam("Required Integer in group parameters") Long requiredInt64Group,@QueryParam("string_group") @ApiParam("String in group parameters") Integer stringGroup,@HeaderParam("boolean_group") @ApiParam("Boolean in group parameters") Boolean booleanGroup,@QueryParam("int64_group") @ApiParam("Integer in group parameters") Long int64Group) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/inline-additionalProperties") + @Consumes({ "application/json" }) + @ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response testInlineAdditionalProperties(@Valid @NotNull Map requestBody) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/inline-freeform-additionalProperties") + @Consumes({ "application/json" }) + @ApiOperation(value = "test inline free-form additionalProperties", notes = "", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response testInlineFreeformAdditionalProperties(@Valid @NotNull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/jsonFormData") + @Consumes({ "application/x-www-form-urlencoded" }) + @ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response testJsonFormData(@FormParam(value = "param") String param,@FormParam(value = "param2") String param2) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/nullable") + @Consumes({ "application/json" }) + @ApiOperation(value = "test nullable parent property", notes = "", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response testNullable(@Valid @NotNull ChildWithNullable childWithNullable) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/test-query-parameters") + @ApiOperation(value = "", notes = "To test the collection format in query parameters", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Success", response = Void.class) + }) + public Response testQueryParameterCollectionFormat(@QueryParam("pipe") @NotNull List pipe,@QueryParam("ioutil") @NotNull List ioutil,@QueryParam("http") @NotNull List http,@QueryParam("url") @NotNull List url,@QueryParam("context") @NotNull List context,@QueryParam("allowEmpty") @NotNull String allowEmpty,@QueryParam("language") Map language) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/stringMap-reference") + @Consumes({ "application/json" }) + @ApiOperation(value = "test referenced string map", notes = "", response = Void.class, tags={ "fake" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response testStringMapReference(@Valid @NotNull Map requestBody) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/{petId}/uploadImageWithRequiredFile") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @ApiOperation(value = "uploads an image (required)", notes = "", response = ModelApiResponse.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") }) + }, tags={ "pet" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) + }) + public Response uploadFileWithRequiredFile(@PathParam("petId") @ApiParam("ID of pet to update") Long petId, @FormParam(value = "requiredFile") InputStream requiredFileInputStream,@FormParam(value = "additionalMetadata") String additionalMetadata) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java new file mode 100644 index 000000000000..a8e0baa1eeac --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -0,0 +1,37 @@ +package org.openapitools.api; + +import org.openapitools.model.Client; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/fake_classname_test") +@Api(description = "the fake_classname_test API") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeClassnameTestApi { + + @PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", response = Client.class, authorizations = { + + @Authorization(value = "api_key_query") + }, tags={ "fake_classname_tags 123#$%^" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) + }) + public Response testClassname(@Valid @NotNull Client client) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/FooApi.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/FooApi.java new file mode 100644 index 000000000000..f87b42860258 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/FooApi.java @@ -0,0 +1,33 @@ +package org.openapitools.api; + +import org.openapitools.model.FooGetDefaultResponse; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/foo") +@Api(description = "the foo API") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FooApi { + + @GET + @Produces({ "application/json" }) + @ApiOperation(value = "", notes = "", response = FooGetDefaultResponse.class, tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "response", response = FooGetDefaultResponse.class) + }) + public Response fooGet() { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/PetApi.java new file mode 100644 index 000000000000..abdc90eb7238 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/PetApi.java @@ -0,0 +1,156 @@ +package org.openapitools.api; + +import java.io.File; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.Pet; +import java.util.Set; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/pet") +@Api(description = "the pet API") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class PetApi { + + @POST + @Consumes({ "application/json", "application/xml" }) + @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") }) + }, tags={ "pet" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful operation", response = Void.class), + @ApiResponse(code = 405, message = "Invalid input", response = Void.class) + }) + public Response addPet(@Valid @NotNull Pet pet) { + return Response.ok().entity("magic!").build(); + } + + @DELETE + @Path("/{petId}") + @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") }) + }, tags={ "pet" }) + @io.swagger.annotations.ApiImplicitParams({ + @io.swagger.annotations.ApiImplicitParam(name = "api_key", value = "", dataType = "String", paramType = "header") + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful operation", response = Void.class), + @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) + }) + public Response deletePet(@PathParam("petId") @ApiParam("Pet id to delete") Long petId) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/findByStatus") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") }) + }, tags={ "pet" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + @ApiResponse(code = 400, message = "Invalid status value", response = Void.class) + }) + public Response findPetsByStatus(@QueryParam("status") @NotNull @ApiParam("Status values that need to be considered for filter") List status) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/findByTags") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "Set", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") }) + }, tags={ "pet" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "Set"), + @ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) + }) + public Response findPetsByTags(@QueryParam("tags") @NotNull @ApiParam("Tags to filter by") Set tags) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/{petId}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { + + @Authorization(value = "api_key") + }, tags={ "pet" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Pet not found", response = Void.class) + }) + public Response getPetById(@PathParam("petId") @ApiParam("ID of pet to return") Long petId) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Consumes({ "application/json", "application/xml" }) + @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") }) + }, tags={ "pet" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful operation", response = Void.class), + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Pet not found", response = Void.class), + @ApiResponse(code = 405, message = "Validation exception", response = Void.class) + }) + public Response updatePet(@Valid @NotNull Pet pet) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") }) + }, tags={ "pet" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful operation", response = Void.class), + @ApiResponse(code = 405, message = "Invalid input", response = Void.class) + }) + public Response updatePetWithForm(@PathParam("petId") @ApiParam("ID of pet that needs to be updated") Long petId,@FormParam(value = "name") String name,@FormParam(value = "status") String status) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") }) + }, tags={ "pet" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) + }) + public Response uploadFile(@PathParam("petId") @ApiParam("ID of pet to update") Long petId,@FormParam(value = "additionalMetadata") String additionalMetadata, @FormParam(value = "file") InputStream _fileInputStream) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/RestApplication.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/RestApplication.java new file mode 100644 index 000000000000..7df2d0fe3334 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/RestApplication.java @@ -0,0 +1,9 @@ +package org.openapitools.api; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath(RestResourceRoot.APPLICATION_PATH) +public class RestApplication extends Application { + +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/RestResourceRoot.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/RestResourceRoot.java new file mode 100644 index 000000000000..96ba6c8d8e40 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/RestResourceRoot.java @@ -0,0 +1,5 @@ +package org.openapitools.api; + +public class RestResourceRoot { + public static final String APPLICATION_PATH = "/v2"; +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/StoreApi.java new file mode 100644 index 000000000000..c608d6327bbd --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/StoreApi.java @@ -0,0 +1,75 @@ +package org.openapitools.api; + +import java.util.Map; +import org.openapitools.model.Order; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/store") +@Api(description = "the store API") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class StoreApi { + + @DELETE + @Path("/order/{order_id}") + @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store" }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Order not found", response = Void.class) + }) + public Response deleteOrder(@PathParam("order_id") @ApiParam("ID of the order that needs to be deleted") String orderId) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/inventory") + @Produces({ "application/json" }) + @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { + + @Authorization(value = "api_key") + }, tags={ "store" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") + }) + public Response getInventory() { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/order/{order_id}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions", response = Order.class, tags={ "store" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Order not found", response = Void.class) + }) + public Response getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) @ApiParam("ID of pet that needs to be fetched") Long orderId) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/order") + @Consumes({ "application/json" }) + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid Order", response = Void.class) + }) + public Response placeOrder(@Valid @NotNull Order order) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/UserApi.java new file mode 100644 index 000000000000..e3de784b06ab --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/api/UserApi.java @@ -0,0 +1,114 @@ +package org.openapitools.api; + +import java.util.Date; +import org.openapitools.model.User; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/user") +@Api(description = "the user API") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class UserApi { + + @POST + @Consumes({ "application/json" }) + @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response createUser(@Valid @NotNull User user) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/createWithArray") + @Consumes({ "application/json" }) + @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response createUsersWithArrayInput(@Valid @NotNull List<@Valid User> user) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/createWithList") + @Consumes({ "application/json" }) + @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response createUsersWithListInput(@Valid @NotNull List<@Valid User> user) { + return Response.ok().entity("magic!").build(); + } + + @DELETE + @Path("/{username}") + @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user" }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) + }) + public Response deleteUser(@PathParam("username") @ApiParam("The name that needs to be deleted") String username) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/{username}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = User.class), + @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) + }) + public Response getUserByName(@PathParam("username") @ApiParam("The name that needs to be fetched. Use user1 for testing.") String username) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/login") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = String.class), + @ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) + }) + public Response loginUser(@QueryParam("username") @NotNull @ApiParam("The user name for login") String username,@QueryParam("password") @NotNull @ApiParam("The password for login in clear text") String password) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/logout") + @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) + }) + public Response logoutUser() { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/{username}") + @Consumes({ "application/json" }) + @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user" }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) + }) + public Response updateUser(@PathParam("username") @ApiParam("name that need to be deleted") String username,@Valid @NotNull User user) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..4e865a95de22 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -0,0 +1,180 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("AdditionalPropertiesClass") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class AdditionalPropertiesClass implements Serializable { + private @Valid Map mapProperty = new HashMap<>(); + private @Valid Map> mapOfMapProperty = new HashMap<>(); + + protected AdditionalPropertiesClass(AdditionalPropertiesClassBuilder b) { + this.mapProperty = b.mapProperty; + this.mapOfMapProperty = b.mapOfMapProperty; + } + + public AdditionalPropertiesClass() { + } + + /** + **/ + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("map_property") + public Map getMapProperty() { + return mapProperty; + } + + @JsonProperty("map_property") + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<>(); + } + + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + public AdditionalPropertiesClass removeMapPropertyItem(String key) { + if (this.mapProperty != null) { + this.mapProperty.remove(key); + } + + return this; + } + /** + **/ + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("map_of_map_property") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + @JsonProperty("map_of_map_property") + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<>(); + } + + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + public AdditionalPropertiesClass removeMapOfMapPropertyItem(String key) { + if (this.mapOfMapProperty != null) { + this.mapOfMapProperty.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static AdditionalPropertiesClassBuilder builder() { + return new AdditionalPropertiesClassBuilderImpl(); + } + + private static final class AdditionalPropertiesClassBuilderImpl extends AdditionalPropertiesClassBuilder { + + @Override + protected AdditionalPropertiesClassBuilderImpl self() { + return this; + } + + @Override + public AdditionalPropertiesClass build() { + return new AdditionalPropertiesClass(this); + } + } + + public static abstract class AdditionalPropertiesClassBuilder> { + private Map mapProperty = new HashMap<>(); + private Map> mapOfMapProperty = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return self(); + } + public B mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java new file mode 100644 index 000000000000..901f8e365ee3 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java @@ -0,0 +1,147 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.SingleRefType; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("AllOfWithSingleRef") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class AllOfWithSingleRef implements Serializable { + private String username; + private SingleRefType singleRefType; + + protected AllOfWithSingleRef(AllOfWithSingleRefBuilder b) { + this.username = b.username; + this.singleRefType = b.singleRefType; + } + + public AllOfWithSingleRef() { + } + + /** + **/ + public AllOfWithSingleRef username(String username) { + this.username = username; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonProperty("username") + public void setUsername(String username) { + this.username = username; + } + + /** + **/ + public AllOfWithSingleRef singleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("SingleRefType") + public SingleRefType getSingleRefType() { + return singleRefType; + } + + @JsonProperty("SingleRefType") + public void setSingleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfWithSingleRef allOfWithSingleRef = (AllOfWithSingleRef) o; + return Objects.equals(this.username, allOfWithSingleRef.username) && + Objects.equals(this.singleRefType, allOfWithSingleRef.singleRefType); + } + + @Override + public int hashCode() { + return Objects.hash(username, singleRefType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfWithSingleRef {\n"); + + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" singleRefType: ").append(toIndentedString(singleRefType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static AllOfWithSingleRefBuilder builder() { + return new AllOfWithSingleRefBuilderImpl(); + } + + private static final class AllOfWithSingleRefBuilderImpl extends AllOfWithSingleRefBuilder { + + @Override + protected AllOfWithSingleRefBuilderImpl self() { + return this; + } + + @Override + public AllOfWithSingleRef build() { + return new AllOfWithSingleRef(this); + } + } + + public static abstract class AllOfWithSingleRefBuilder> { + private String username; + private SingleRefType singleRefType; + protected abstract B self(); + + public abstract C build(); + + public B username(String username) { + this.username = username; + return self(); + } + public B singleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Animal.java new file mode 100644 index 000000000000..4935b594ef3f --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Animal.java @@ -0,0 +1,161 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) + + +@JsonTypeName("Animal") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Animal implements Serializable { + private String className; + private String color = "red"; + + protected Animal(AnimalBuilder b) { + this.className = b.className; + this.color = b.color; + } + + public Animal() { + } + + @JsonCreator + public Animal( + @JsonProperty(required = true, value = "className") String className + ) { + this.className = className; + } + + /** + **/ + public Animal className(String className) { + this.className = className; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty(required = true, value = "className") + @NotNull public String getClassName() { + return className; + } + + @JsonProperty(required = true, value = "className") + public void setClassName(String className) { + this.className = className; + } + + /** + **/ + public Animal color(String color) { + this.color = color; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("color") + public String getColor() { + return color; + } + + @JsonProperty("color") + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static AnimalBuilder builder() { + return new AnimalBuilderImpl(); + } + + private static final class AnimalBuilderImpl extends AnimalBuilder { + + @Override + protected AnimalBuilderImpl self() { + return this; + } + + @Override + public Animal build() { + return new Animal(this); + } + } + + public static abstract class AnimalBuilder> { + private String className; + private String color = "red"; + protected abstract B self(); + + public abstract C build(); + + public B className(String className) { + this.className = className; + return self(); + } + public B color(String color) { + this.color = color; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..c1f45b4595ce --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,138 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("ArrayOfArrayOfNumberOnly") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ArrayOfArrayOfNumberOnly implements Serializable { + private @Valid List> arrayArrayNumber = new ArrayList<>(); + + protected ArrayOfArrayOfNumberOnly(ArrayOfArrayOfNumberOnlyBuilder b) { + this.arrayArrayNumber = b.arrayArrayNumber; + } + + public ArrayOfArrayOfNumberOnly() { + } + + /** + **/ + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("ArrayArrayNumber") + @Valid public List<@Valid List<@Valid BigDecimal>> getArrayArrayNumber() { + return arrayArrayNumber; + } + + @JsonProperty("ArrayArrayNumber") + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList<>(); + } + + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + public ArrayOfArrayOfNumberOnly removeArrayArrayNumberItem(List arrayArrayNumberItem) { + if (arrayArrayNumberItem != null && this.arrayArrayNumber != null) { + this.arrayArrayNumber.remove(arrayArrayNumberItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ArrayOfArrayOfNumberOnlyBuilder builder() { + return new ArrayOfArrayOfNumberOnlyBuilderImpl(); + } + + private static final class ArrayOfArrayOfNumberOnlyBuilderImpl extends ArrayOfArrayOfNumberOnlyBuilder { + + @Override + protected ArrayOfArrayOfNumberOnlyBuilderImpl self() { + return this; + } + + @Override + public ArrayOfArrayOfNumberOnly build() { + return new ArrayOfArrayOfNumberOnly(this); + } + } + + public static abstract class ArrayOfArrayOfNumberOnlyBuilder> { + private List> arrayArrayNumber = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..1d7b078afbfa --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -0,0 +1,138 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("ArrayOfNumberOnly") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ArrayOfNumberOnly implements Serializable { + private @Valid List arrayNumber = new ArrayList<>(); + + protected ArrayOfNumberOnly(ArrayOfNumberOnlyBuilder b) { + this.arrayNumber = b.arrayNumber; + } + + public ArrayOfNumberOnly() { + } + + /** + **/ + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("ArrayNumber") + @Valid public List<@Valid BigDecimal> getArrayNumber() { + return arrayNumber; + } + + @JsonProperty("ArrayNumber") + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList<>(); + } + + this.arrayNumber.add(arrayNumberItem); + return this; + } + + public ArrayOfNumberOnly removeArrayNumberItem(BigDecimal arrayNumberItem) { + if (arrayNumberItem != null && this.arrayNumber != null) { + this.arrayNumber.remove(arrayNumberItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ArrayOfNumberOnlyBuilder builder() { + return new ArrayOfNumberOnlyBuilderImpl(); + } + + private static final class ArrayOfNumberOnlyBuilderImpl extends ArrayOfNumberOnlyBuilder { + + @Override + protected ArrayOfNumberOnlyBuilderImpl self() { + return this; + } + + @Override + public ArrayOfNumberOnly build() { + return new ArrayOfNumberOnly(this); + } + } + + public static abstract class ArrayOfNumberOnlyBuilder> { + private List arrayNumber = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ArrayTest.java new file mode 100644 index 000000000000..11b01ca0f861 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ArrayTest.java @@ -0,0 +1,226 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.ReadOnlyFirst; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("ArrayTest") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ArrayTest implements Serializable { + private @Valid List arrayOfString = new ArrayList<>(); + private @Valid List> arrayArrayOfInteger = new ArrayList<>(); + private @Valid List> arrayArrayOfModel = new ArrayList<>(); + + protected ArrayTest(ArrayTestBuilder b) { + this.arrayOfString = b.arrayOfString; + this.arrayArrayOfInteger = b.arrayArrayOfInteger; + this.arrayArrayOfModel = b.arrayArrayOfModel; + } + + public ArrayTest() { + } + + /** + **/ + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_of_string") + @Size(min=0,max=3)public List getArrayOfString() { + return arrayOfString; + } + + @JsonProperty("array_of_string") + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList<>(); + } + + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + public ArrayTest removeArrayOfStringItem(String arrayOfStringItem) { + if (arrayOfStringItem != null && this.arrayOfString != null) { + this.arrayOfString.remove(arrayOfStringItem); + } + + return this; + } + /** + **/ + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_array_of_integer") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + @JsonProperty("array_array_of_integer") + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList<>(); + } + + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + public ArrayTest removeArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (arrayArrayOfIntegerItem != null && this.arrayArrayOfInteger != null) { + this.arrayArrayOfInteger.remove(arrayArrayOfIntegerItem); + } + + return this; + } + /** + **/ + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_array_of_model") + @Valid public List<@Valid List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + @JsonProperty("array_array_of_model") + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + public ArrayTest addArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList<>(); + } + + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + public ArrayTest removeArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) { + if (arrayArrayOfModelItem != null && this.arrayArrayOfModel != null) { + this.arrayArrayOfModel.remove(arrayArrayOfModelItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ArrayTestBuilder builder() { + return new ArrayTestBuilderImpl(); + } + + private static final class ArrayTestBuilderImpl extends ArrayTestBuilder { + + @Override + protected ArrayTestBuilderImpl self() { + return this; + } + + @Override + public ArrayTest build() { + return new ArrayTest(this); + } + } + + public static abstract class ArrayTestBuilder> { + private List arrayOfString = new ArrayList<>(); + private List> arrayArrayOfInteger = new ArrayList<>(); + private List> arrayArrayOfModel = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return self(); + } + public B arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return self(); + } + public B arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Capitalization.java new file mode 100644 index 000000000000..439b51450364 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Capitalization.java @@ -0,0 +1,259 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("Capitalization") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Capitalization implements Serializable { + private String smallCamel; + private String capitalCamel; + private String smallSnake; + private String capitalSnake; + private String scAETHFlowPoints; + private String ATT_NAME; + + protected Capitalization(CapitalizationBuilder b) { + this.smallCamel = b.smallCamel; + this.capitalCamel = b.capitalCamel; + this.smallSnake = b.smallSnake; + this.capitalSnake = b.capitalSnake; + this.scAETHFlowPoints = b.scAETHFlowPoints; + this.ATT_NAME = b.ATT_NAME; + } + + public Capitalization() { + } + + /** + **/ + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("smallCamel") + public String getSmallCamel() { + return smallCamel; + } + + @JsonProperty("smallCamel") + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + /** + **/ + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("CapitalCamel") + public String getCapitalCamel() { + return capitalCamel; + } + + @JsonProperty("CapitalCamel") + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + /** + **/ + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("small_Snake") + public String getSmallSnake() { + return smallSnake; + } + + @JsonProperty("small_Snake") + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + /** + **/ + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("Capital_Snake") + public String getCapitalSnake() { + return capitalSnake; + } + + @JsonProperty("Capital_Snake") + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + /** + **/ + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("SCA_ETH_Flow_Points") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + @JsonProperty("SCA_ETH_Flow_Points") + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + /** + * Name of the pet + **/ + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + + @ApiModelProperty(value = "Name of the pet ") + @JsonProperty("ATT_NAME") + public String getATTNAME() { + return ATT_NAME; + } + + @JsonProperty("ATT_NAME") + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static CapitalizationBuilder builder() { + return new CapitalizationBuilderImpl(); + } + + private static final class CapitalizationBuilderImpl extends CapitalizationBuilder { + + @Override + protected CapitalizationBuilderImpl self() { + return this; + } + + @Override + public Capitalization build() { + return new Capitalization(this); + } + } + + public static abstract class CapitalizationBuilder> { + private String smallCamel; + private String capitalCamel; + private String smallSnake; + private String capitalSnake; + private String scAETHFlowPoints; + private String ATT_NAME; + protected abstract B self(); + + public abstract C build(); + + public B smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return self(); + } + public B capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return self(); + } + public B smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return self(); + } + public B capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return self(); + } + public B scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return self(); + } + public B ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Cat.java new file mode 100644 index 000000000000..d33ce82f9f6e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Cat.java @@ -0,0 +1,127 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.Animal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("Cat") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Cat extends Animal implements Serializable { + private Boolean declawed; + + protected Cat(CatBuilder b) { + super(b); + this.declawed = b.declawed; + } + + public Cat() { + } + + @JsonCreator + public Cat( + @JsonProperty(required = true, value = "className") String className + ) { + super( + className + ); + } + + /** + **/ + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("declawed") + public Boolean getDeclawed() { + return declawed; + } + + @JsonProperty("declawed") + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static CatBuilder builder() { + return new CatBuilderImpl(); + } + + private static final class CatBuilderImpl extends CatBuilder { + + @Override + protected CatBuilderImpl self() { + return this; + } + + @Override + public Cat build() { + return new Cat(this); + } + } + + public static abstract class CatBuilder> extends AnimalBuilder { + private Boolean declawed; + + public B declawed(Boolean declawed) { + this.declawed = declawed; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Category.java new file mode 100644 index 000000000000..67d73b9eacf0 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Category.java @@ -0,0 +1,153 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("Category") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Category implements Serializable { + private Long id; + private String name = "default-name"; + + protected Category(CategoryBuilder b) { + this.id = b.id; + this.name = b.name; + } + + public Category() { + } + + @JsonCreator + public Category( + @JsonProperty(required = true, value = "name") String name + ) { + this.name = name; + } + + /** + **/ + public Category id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Category name(String name) { + this.name = name; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty(required = true, value = "name") + @NotNull public String getName() { + return name; + } + + @JsonProperty(required = true, value = "name") + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static CategoryBuilder builder() { + return new CategoryBuilderImpl(); + } + + private static final class CategoryBuilderImpl extends CategoryBuilder { + + @Override + protected CategoryBuilderImpl self() { + return this; + } + + @Override + public Category build() { + return new Category(this); + } + } + + public static abstract class CategoryBuilder> { + private Long id; + private String name = "default-name"; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B name(String name) { + this.name = name; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ChildWithNullable.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ChildWithNullable.java new file mode 100644 index 000000000000..f5685b1765c9 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ChildWithNullable.java @@ -0,0 +1,119 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import org.openapitools.model.ParentWithNullable; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("ChildWithNullable") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ChildWithNullable extends ParentWithNullable implements Serializable { + private String otherProperty; + + protected ChildWithNullable(ChildWithNullableBuilder b) { + super(b); + this.otherProperty = b.otherProperty; + } + + public ChildWithNullable() { + } + + /** + **/ + public ChildWithNullable otherProperty(String otherProperty) { + this.otherProperty = otherProperty; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("otherProperty") + public String getOtherProperty() { + return otherProperty; + } + + @JsonProperty("otherProperty") + public void setOtherProperty(String otherProperty) { + this.otherProperty = otherProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChildWithNullable childWithNullable = (ChildWithNullable) o; + return Objects.equals(this.otherProperty, childWithNullable.otherProperty) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(otherProperty, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChildWithNullable {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" otherProperty: ").append(toIndentedString(otherProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ChildWithNullableBuilder builder() { + return new ChildWithNullableBuilderImpl(); + } + + private static final class ChildWithNullableBuilderImpl extends ChildWithNullableBuilder { + + @Override + protected ChildWithNullableBuilderImpl self() { + return this; + } + + @Override + public ChildWithNullable build() { + return new ChildWithNullable(this); + } + } + + public static abstract class ChildWithNullableBuilder> extends ParentWithNullableBuilder { + private String otherProperty; + + public B otherProperty(String otherProperty) { + this.otherProperty = otherProperty; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ClassModel.java new file mode 100644 index 000000000000..b57f15a6247f --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ClassModel.java @@ -0,0 +1,120 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing model with \"_class\" property + **/ +@ApiModel(description = "Model for testing model with \"_class\" property") +@JsonTypeName("ClassModel") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ClassModel implements Serializable { + private String propertyClass; + + protected ClassModel(ClassModelBuilder b) { + this.propertyClass = b.propertyClass; + } + + public ClassModel() { + } + + /** + **/ + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("_class") + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty("_class") + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ClassModelBuilder builder() { + return new ClassModelBuilderImpl(); + } + + private static final class ClassModelBuilderImpl extends ClassModelBuilder { + + @Override + protected ClassModelBuilderImpl self() { + return this; + } + + @Override + public ClassModel build() { + return new ClassModel(this); + } + } + + public static abstract class ClassModelBuilder> { + private String propertyClass; + protected abstract B self(); + + public abstract C build(); + + public B propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Client.java new file mode 100644 index 000000000000..87dadd60504b --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Client.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("Client") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Client implements Serializable { + private String client; + + protected Client(ClientBuilder b) { + this.client = b.client; + } + + public Client() { + } + + /** + **/ + public Client client(String client) { + this.client = client; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("client") + public String getClient() { + return client; + } + + @JsonProperty("client") + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ClientBuilder builder() { + return new ClientBuilderImpl(); + } + + private static final class ClientBuilderImpl extends ClientBuilder { + + @Override + protected ClientBuilderImpl self() { + return this; + } + + @Override + public Client build() { + return new Client(this); + } + } + + public static abstract class ClientBuilder> { + private String client; + protected abstract B self(); + + public abstract C build(); + + public B client(String client) { + this.client = client; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/DeprecatedObject.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/DeprecatedObject.java new file mode 100644 index 000000000000..a73cf2ceabea --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/DeprecatedObject.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("DeprecatedObject") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class DeprecatedObject implements Serializable { + private String name; + + protected DeprecatedObject(DeprecatedObjectBuilder b) { + this.name = b.name; + } + + public DeprecatedObject() { + } + + /** + **/ + public DeprecatedObject name(String name) { + this.name = name; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeprecatedObject deprecatedObject = (DeprecatedObject) o; + return Objects.equals(this.name, deprecatedObject.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeprecatedObject {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static DeprecatedObjectBuilder builder() { + return new DeprecatedObjectBuilderImpl(); + } + + private static final class DeprecatedObjectBuilderImpl extends DeprecatedObjectBuilder { + + @Override + protected DeprecatedObjectBuilderImpl self() { + return this; + } + + @Override + public DeprecatedObject build() { + return new DeprecatedObject(this); + } + } + + public static abstract class DeprecatedObjectBuilder> { + private String name; + protected abstract B self(); + + public abstract C build(); + + public B name(String name) { + this.name = name; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Dog.java new file mode 100644 index 000000000000..e803eef04547 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Dog.java @@ -0,0 +1,127 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.Animal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("Dog") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Dog extends Animal implements Serializable { + private String breed; + + protected Dog(DogBuilder b) { + super(b); + this.breed = b.breed; + } + + public Dog() { + } + + @JsonCreator + public Dog( + @JsonProperty(required = true, value = "className") String className + ) { + super( + className + ); + } + + /** + **/ + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("breed") + public String getBreed() { + return breed; + } + + @JsonProperty("breed") + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static DogBuilder builder() { + return new DogBuilderImpl(); + } + + private static final class DogBuilderImpl extends DogBuilder { + + @Override + protected DogBuilderImpl self() { + return this; + } + + @Override + public Dog build() { + return new Dog(this); + } + } + + public static abstract class DogBuilder> extends AnimalBuilder { + private String breed; + + public B breed(String breed) { + this.breed = breed; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/EnumArrays.java new file mode 100644 index 000000000000..50b80bad1a5d --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/EnumArrays.java @@ -0,0 +1,259 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("EnumArrays") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class EnumArrays implements Serializable { + public enum JustSymbolEnum { + + GREATER_THAN_OR_EQUAL_TO(String.valueOf(">=")), DOLLAR(String.valueOf("$")); + + + private String value; + + JustSymbolEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static JustSymbolEnum fromString(String s) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String value) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private JustSymbolEnum justSymbol; + public enum ArrayEnumEnum { + + FISH(String.valueOf("fish")), CRAB(String.valueOf("crab")); + + + private String value; + + ArrayEnumEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static ArrayEnumEnum fromString(String s) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String value) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private @Valid List arrayEnum = new ArrayList<>(); + + protected EnumArrays(EnumArraysBuilder b) { + this.justSymbol = b.justSymbol; + this.arrayEnum = b.arrayEnum; + } + + public EnumArrays() { + } + + /** + **/ + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("just_symbol") + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + @JsonProperty("just_symbol") + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + /** + **/ + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_enum") + public List getArrayEnum() { + return arrayEnum; + } + + @JsonProperty("array_enum") + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList<>(); + } + + this.arrayEnum.add(arrayEnumItem); + return this; + } + + public EnumArrays removeArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (arrayEnumItem != null && this.arrayEnum != null) { + this.arrayEnum.remove(arrayEnumItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static EnumArraysBuilder builder() { + return new EnumArraysBuilderImpl(); + } + + private static final class EnumArraysBuilderImpl extends EnumArraysBuilder { + + @Override + protected EnumArraysBuilderImpl self() { + return this; + } + + @Override + public EnumArrays build() { + return new EnumArrays(this); + } + } + + public static abstract class EnumArraysBuilder> { + private JustSymbolEnum justSymbol; + private List arrayEnum = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return self(); + } + public B arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/EnumClass.java new file mode 100644 index 000000000000..089a69da6da5 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/EnumClass.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumClass fromString(String s) { + for (EnumClass b : EnumClass.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/EnumTest.java new file mode 100644 index 000000000000..f58c39c6fa83 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/EnumTest.java @@ -0,0 +1,515 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import org.openapitools.model.OuterEnum; +import org.openapitools.model.OuterEnumDefaultValue; +import org.openapitools.model.OuterEnumInteger; +import org.openapitools.model.OuterEnumIntegerDefaultValue; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("Enum_Test") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class EnumTest implements Serializable { + public enum EnumStringEnum { + + UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")), EMPTY(String.valueOf("")); + + + private String value; + + EnumStringEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumStringEnum fromString(String s) { + for (EnumStringEnum b : EnumStringEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumStringEnum fromValue(String value) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumStringEnum enumString; + public enum EnumStringRequiredEnum { + + UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")), EMPTY(String.valueOf("")); + + + private String value; + + EnumStringRequiredEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumStringRequiredEnum fromString(String s) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String value) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumStringRequiredEnum enumStringRequired; + public enum EnumIntegerEnum { + + NUMBER_1(Integer.valueOf(1)), NUMBER_MINUS_1(Integer.valueOf(-1)); + + + private Integer value; + + EnumIntegerEnum (Integer v) { + value = v; + } + + public Integer value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumIntegerEnum fromString(String s) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(Integer value) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumIntegerEnum enumInteger; + public enum EnumNumberEnum { + + NUMBER_1_DOT_1(Double.valueOf(1.1)), NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2)); + + + private Double value; + + EnumNumberEnum (Double v) { + value = v; + } + + public Double value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into Double, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumNumberEnum fromString(String s) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumNumberEnum fromValue(Double value) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumNumberEnum enumNumber; + private OuterEnum outerEnum; + private OuterEnumInteger outerEnumInteger; + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + + protected EnumTest(EnumTestBuilder b) { + this.enumString = b.enumString; + this.enumStringRequired = b.enumStringRequired; + this.enumInteger = b.enumInteger; + this.enumNumber = b.enumNumber; + this.outerEnum = b.outerEnum; + this.outerEnumInteger = b.outerEnumInteger; + this.outerEnumDefaultValue = b.outerEnumDefaultValue; + this.outerEnumIntegerDefaultValue = b.outerEnumIntegerDefaultValue; + } + + public EnumTest() { + } + + @JsonCreator + public EnumTest( + @JsonProperty(required = true, value = "enum_string_required") EnumStringRequiredEnum enumStringRequired + ) { + this.enumStringRequired = enumStringRequired; + } + + /** + **/ + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("enum_string") + public EnumStringEnum getEnumString() { + return enumString; + } + + @JsonProperty("enum_string") + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + /** + **/ + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty(required = true, value = "enum_string_required") + @NotNull public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + @JsonProperty(required = true, value = "enum_string_required") + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + /** + **/ + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("enum_integer") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + @JsonProperty("enum_integer") + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + /** + **/ + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("enum_number") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + @JsonProperty("enum_number") + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + /** + **/ + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("outerEnum") + public OuterEnum getOuterEnum() { + return outerEnum; + } + + @JsonProperty("outerEnum") + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + /** + **/ + public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("outerEnumInteger") + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + @JsonProperty("outerEnumInteger") + public void setOuterEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + /** + **/ + public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("outerEnumDefaultValue") + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + @JsonProperty("outerEnumDefaultValue") + public void setOuterEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + /** + **/ + public EnumTest outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("outerEnumIntegerDefaultValue") + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + @JsonProperty("outerEnumIntegerDefaultValue") + public void setOuterEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum) && + Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) && + Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) && + Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static EnumTestBuilder builder() { + return new EnumTestBuilderImpl(); + } + + private static final class EnumTestBuilderImpl extends EnumTestBuilder { + + @Override + protected EnumTestBuilderImpl self() { + return this; + } + + @Override + public EnumTest build() { + return new EnumTest(this); + } + } + + public static abstract class EnumTestBuilder> { + private EnumStringEnum enumString; + private EnumStringRequiredEnum enumStringRequired; + private EnumIntegerEnum enumInteger; + private EnumNumberEnum enumNumber; + private OuterEnum outerEnum; + private OuterEnumInteger outerEnumInteger; + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + protected abstract B self(); + + public abstract C build(); + + public B enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return self(); + } + public B enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return self(); + } + public B enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return self(); + } + public B enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return self(); + } + public B outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return self(); + } + public B outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return self(); + } + public B outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return self(); + } + public B outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java new file mode 100644 index 000000000000..ef8c84a049c9 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,166 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("fakeBigDecimalMap_200_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeBigDecimalMap200Response implements Serializable { + private BigDecimal someId; + private @Valid Map someMap = new HashMap<>(); + + protected FakeBigDecimalMap200Response(FakeBigDecimalMap200ResponseBuilder b) { + this.someId = b.someId; + this.someMap = b.someMap; + } + + public FakeBigDecimalMap200Response() { + } + + /** + **/ + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + this.someId = someId; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("someId") + @Valid public BigDecimal getSomeId() { + return someId; + } + + @JsonProperty("someId") + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + /** + **/ + public FakeBigDecimalMap200Response someMap(Map someMap) { + this.someMap = someMap; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("someMap") + @Valid public Map getSomeMap() { + return someMap; + } + + @JsonProperty("someMap") + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + + this.someMap.put(key, someMapItem); + return this; + } + + public FakeBigDecimalMap200Response removeSomeMapItem(String key) { + if (this.someMap != null) { + this.someMap.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FakeBigDecimalMap200ResponseBuilder builder() { + return new FakeBigDecimalMap200ResponseBuilderImpl(); + } + + private static final class FakeBigDecimalMap200ResponseBuilderImpl extends FakeBigDecimalMap200ResponseBuilder { + + @Override + protected FakeBigDecimalMap200ResponseBuilderImpl self() { + return this; + } + + @Override + public FakeBigDecimalMap200Response build() { + return new FakeBigDecimalMap200Response(this); + } + } + + public static abstract class FakeBigDecimalMap200ResponseBuilder> { + private BigDecimal someId; + private Map someMap = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B someId(BigDecimal someId) { + this.someId = someId; + return self(); + } + public B someMap(Map someMap) { + this.someMap = someMap; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java new file mode 100644 index 000000000000..11d86dfa10ac --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java @@ -0,0 +1,299 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.IntegerEnum; +import org.openapitools.model.StringEnum; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("fake_tests_defaults_default_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeTestsDefaultsDefaultResponse implements Serializable { + private StringEnum stringEnum = StringEnum.FOO; + private IntegerEnum integerEnum = IntegerEnum.NUMBER_1; + public enum StringEnumInlineEnum { + + FOO(String.valueOf("foo")), BAR(String.valueOf("bar")), BAZ(String.valueOf("baz")); + + + private String value; + + StringEnumInlineEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StringEnumInlineEnum fromString(String s) { + for (StringEnumInlineEnum b : StringEnumInlineEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static StringEnumInlineEnum fromValue(String value) { + for (StringEnumInlineEnum b : StringEnumInlineEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private StringEnumInlineEnum stringEnumInline = StringEnumInlineEnum.FOO; + public enum IntegerEnumInlineEnum { + + NUMBER_1(Integer.valueOf(1)), NUMBER_2(Integer.valueOf(2)), NUMBER_3(Integer.valueOf(3)); + + + private Integer value; + + IntegerEnumInlineEnum (Integer v) { + value = v; + } + + public Integer value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static IntegerEnumInlineEnum fromString(String s) { + for (IntegerEnumInlineEnum b : IntegerEnumInlineEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static IntegerEnumInlineEnum fromValue(Integer value) { + for (IntegerEnumInlineEnum b : IntegerEnumInlineEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private IntegerEnumInlineEnum integerEnumInline = IntegerEnumInlineEnum.NUMBER_1; + + protected FakeTestsDefaultsDefaultResponse(FakeTestsDefaultsDefaultResponseBuilder b) { + this.stringEnum = b.stringEnum; + this.integerEnum = b.integerEnum; + this.stringEnumInline = b.stringEnumInline; + this.integerEnumInline = b.integerEnumInline; + } + + public FakeTestsDefaultsDefaultResponse() { + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse stringEnum(StringEnum stringEnum) { + this.stringEnum = stringEnum; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("stringEnum") + public StringEnum getStringEnum() { + return stringEnum; + } + + @JsonProperty("stringEnum") + public void setStringEnum(StringEnum stringEnum) { + this.stringEnum = stringEnum; + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse integerEnum(IntegerEnum integerEnum) { + this.integerEnum = integerEnum; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("integerEnum") + public IntegerEnum getIntegerEnum() { + return integerEnum; + } + + @JsonProperty("integerEnum") + public void setIntegerEnum(IntegerEnum integerEnum) { + this.integerEnum = integerEnum; + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse stringEnumInline(StringEnumInlineEnum stringEnumInline) { + this.stringEnumInline = stringEnumInline; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("stringEnumInline") + public StringEnumInlineEnum getStringEnumInline() { + return stringEnumInline; + } + + @JsonProperty("stringEnumInline") + public void setStringEnumInline(StringEnumInlineEnum stringEnumInline) { + this.stringEnumInline = stringEnumInline; + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse integerEnumInline(IntegerEnumInlineEnum integerEnumInline) { + this.integerEnumInline = integerEnumInline; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("integerEnumInline") + public IntegerEnumInlineEnum getIntegerEnumInline() { + return integerEnumInline; + } + + @JsonProperty("integerEnumInline") + public void setIntegerEnumInline(IntegerEnumInlineEnum integerEnumInline) { + this.integerEnumInline = integerEnumInline; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeTestsDefaultsDefaultResponse fakeTestsDefaultsDefaultResponse = (FakeTestsDefaultsDefaultResponse) o; + return Objects.equals(this.stringEnum, fakeTestsDefaultsDefaultResponse.stringEnum) && + Objects.equals(this.integerEnum, fakeTestsDefaultsDefaultResponse.integerEnum) && + Objects.equals(this.stringEnumInline, fakeTestsDefaultsDefaultResponse.stringEnumInline) && + Objects.equals(this.integerEnumInline, fakeTestsDefaultsDefaultResponse.integerEnumInline); + } + + @Override + public int hashCode() { + return Objects.hash(stringEnum, integerEnum, stringEnumInline, integerEnumInline); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeTestsDefaultsDefaultResponse {\n"); + + sb.append(" stringEnum: ").append(toIndentedString(stringEnum)).append("\n"); + sb.append(" integerEnum: ").append(toIndentedString(integerEnum)).append("\n"); + sb.append(" stringEnumInline: ").append(toIndentedString(stringEnumInline)).append("\n"); + sb.append(" integerEnumInline: ").append(toIndentedString(integerEnumInline)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FakeTestsDefaultsDefaultResponseBuilder builder() { + return new FakeTestsDefaultsDefaultResponseBuilderImpl(); + } + + private static final class FakeTestsDefaultsDefaultResponseBuilderImpl extends FakeTestsDefaultsDefaultResponseBuilder { + + @Override + protected FakeTestsDefaultsDefaultResponseBuilderImpl self() { + return this; + } + + @Override + public FakeTestsDefaultsDefaultResponse build() { + return new FakeTestsDefaultsDefaultResponse(this); + } + } + + public static abstract class FakeTestsDefaultsDefaultResponseBuilder> { + private StringEnum stringEnum = StringEnum.FOO; + private IntegerEnum integerEnum = IntegerEnum.NUMBER_1; + private StringEnumInlineEnum stringEnumInline = StringEnumInlineEnum.FOO; + private IntegerEnumInlineEnum integerEnumInline = IntegerEnumInlineEnum.NUMBER_1; + protected abstract B self(); + + public abstract C build(); + + public B stringEnum(StringEnum stringEnum) { + this.stringEnum = stringEnum; + return self(); + } + public B integerEnum(IntegerEnum integerEnum) { + this.integerEnum = integerEnum; + return self(); + } + public B stringEnumInline(StringEnumInlineEnum stringEnumInline) { + this.stringEnumInline = stringEnumInline; + return self(); + } + public B integerEnumInline(IntegerEnumInlineEnum integerEnumInline) { + this.integerEnumInline = integerEnumInline; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..f32011c66a52 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -0,0 +1,166 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.ModelFile; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("FileSchemaTestClass") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FileSchemaTestClass implements Serializable { + private ModelFile _file; + private @Valid List<@Valid ModelFile> files = new ArrayList<>(); + + protected FileSchemaTestClass(FileSchemaTestClassBuilder b) { + this._file = b._file; + this.files = b.files; + } + + public FileSchemaTestClass() { + } + + /** + **/ + public FileSchemaTestClass _file(ModelFile _file) { + this._file = _file; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("file") + @Valid public ModelFile getFile() { + return _file; + } + + @JsonProperty("file") + public void setFile(ModelFile _file) { + this._file = _file; + } + + /** + **/ + public FileSchemaTestClass files(List<@Valid ModelFile> files) { + this.files = files; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("files") + @Valid public List<@Valid ModelFile> getFiles() { + return files; + } + + @JsonProperty("files") + public void setFiles(List<@Valid ModelFile> files) { + this.files = files; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + + this.files.add(filesItem); + return this; + } + + public FileSchemaTestClass removeFilesItem(ModelFile filesItem) { + if (filesItem != null && this.files != null) { + this.files.remove(filesItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this._file, fileSchemaTestClass._file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(_file, files); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FileSchemaTestClassBuilder builder() { + return new FileSchemaTestClassBuilderImpl(); + } + + private static final class FileSchemaTestClassBuilderImpl extends FileSchemaTestClassBuilder { + + @Override + protected FileSchemaTestClassBuilderImpl self() { + return this; + } + + @Override + public FileSchemaTestClass build() { + return new FileSchemaTestClass(this); + } + } + + public static abstract class FileSchemaTestClassBuilder> { + private ModelFile _file; + private List files = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B _file(ModelFile _file) { + this._file = _file; + return self(); + } + public B files(List files) { + this.files = files; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Foo.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Foo.java new file mode 100644 index 000000000000..d2e4c42204ee --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Foo.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("Foo") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Foo implements Serializable { + private String bar = "bar"; + + protected Foo(FooBuilder b) { + this.bar = b.bar; + } + + public Foo() { + } + + /** + **/ + public Foo bar(String bar) { + this.bar = bar; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + + @JsonProperty("bar") + public void setBar(String bar) { + this.bar = bar; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Foo foo = (Foo) o; + return Objects.equals(this.bar, foo.bar); + } + + @Override + public int hashCode() { + return Objects.hash(bar); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FooBuilder builder() { + return new FooBuilderImpl(); + } + + private static final class FooBuilderImpl extends FooBuilder { + + @Override + protected FooBuilderImpl self() { + return this; + } + + @Override + public Foo build() { + return new Foo(this); + } + } + + public static abstract class FooBuilder> { + private String bar = "bar"; + protected abstract B self(); + + public abstract C build(); + + public B bar(String bar) { + this.bar = bar; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java new file mode 100644 index 000000000000..35e2d33836a4 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java @@ -0,0 +1,120 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.Foo; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("_foo_get_default_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FooGetDefaultResponse implements Serializable { + private Foo string; + + protected FooGetDefaultResponse(FooGetDefaultResponseBuilder b) { + this.string = b.string; + } + + public FooGetDefaultResponse() { + } + + /** + **/ + public FooGetDefaultResponse string(Foo string) { + this.string = string; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("string") + @Valid public Foo getString() { + return string; + } + + @JsonProperty("string") + public void setString(Foo string) { + this.string = string; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FooGetDefaultResponseBuilder builder() { + return new FooGetDefaultResponseBuilderImpl(); + } + + private static final class FooGetDefaultResponseBuilderImpl extends FooGetDefaultResponseBuilder { + + @Override + protected FooGetDefaultResponseBuilderImpl self() { + return this; + } + + @Override + public FooGetDefaultResponse build() { + return new FooGetDefaultResponse(this); + } + } + + public static abstract class FooGetDefaultResponseBuilder> { + private Foo string; + protected abstract B self(); + + public abstract C build(); + + public B string(Foo string) { + this.string = string; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FormatTest.java new file mode 100644 index 000000000000..0ac7783e1214 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/FormatTest.java @@ -0,0 +1,570 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.Date; +import java.util.UUID; +import org.joda.time.LocalDate; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("format_test") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FormatTest implements Serializable { + private Integer integer; + private Integer int32; + private Long int64; + private BigDecimal number; + private Float _float; + private Double _double; + private BigDecimal decimal; + private String string; + private byte[] _byte; + private File binary; + private LocalDate date; + private Date dateTime; + private UUID uuid; + private String password; + private String patternWithDigits; + private String patternWithDigitsAndDelimiter; + + protected FormatTest(FormatTestBuilder b) { + this.integer = b.integer; + this.int32 = b.int32; + this.int64 = b.int64; + this.number = b.number; + this._float = b._float; + this._double = b._double; + this.decimal = b.decimal; + this.string = b.string; + this._byte = b._byte; + this.binary = b.binary; + this.date = b.date; + this.dateTime = b.dateTime; + this.uuid = b.uuid; + this.password = b.password; + this.patternWithDigits = b.patternWithDigits; + this.patternWithDigitsAndDelimiter = b.patternWithDigitsAndDelimiter; + } + + public FormatTest() { + } + + @JsonCreator + public FormatTest( + @JsonProperty(required = true, value = "number") BigDecimal number, + @JsonProperty(required = true, value = "byte") byte[] _byte, + @JsonProperty(required = true, value = "date") LocalDate date, + @JsonProperty(required = true, value = "password") String password + ) { + this.number = number; + this._byte = _byte; + this.date = date; + this.password = password; + } + + /** + * minimum: 10 + * maximum: 100 + **/ + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("integer") + @Min(10) @Max(100)public Integer getInteger() { + return integer; + } + + @JsonProperty("integer") + public void setInteger(Integer integer) { + this.integer = integer; + } + + /** + * minimum: 20 + * maximum: 200 + **/ + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("int32") + @Min(20) @Max(200)public Integer getInt32() { + return int32; + } + + @JsonProperty("int32") + public void setInt32(Integer int32) { + this.int32 = int32; + } + + /** + **/ + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("int64") + public Long getInt64() { + return int64; + } + + @JsonProperty("int64") + public void setInt64(Long int64) { + this.int64 = int64; + } + + /** + * minimum: 32.1 + * maximum: 543.2 + **/ + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty(required = true, value = "number") + @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2")public BigDecimal getNumber() { + return number; + } + + @JsonProperty(required = true, value = "number") + public void setNumber(BigDecimal number) { + this.number = number; + } + + /** + * minimum: 54.3 + * maximum: 987.6 + **/ + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("float") + @DecimalMin("54.3") @DecimalMax("987.6")public Float getFloat() { + return _float; + } + + @JsonProperty("float") + public void setFloat(Float _float) { + this._float = _float; + } + + /** + * minimum: 67.8 + * maximum: 123.4 + **/ + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("double") + @DecimalMin("67.8") @DecimalMax("123.4")public Double getDouble() { + return _double; + } + + @JsonProperty("double") + public void setDouble(Double _double) { + this._double = _double; + } + + /** + **/ + public FormatTest decimal(BigDecimal decimal) { + this.decimal = decimal; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("decimal") + @Valid public BigDecimal getDecimal() { + return decimal; + } + + @JsonProperty("decimal") + public void setDecimal(BigDecimal decimal) { + this.decimal = decimal; + } + + /** + **/ + public FormatTest string(String string) { + this.string = string; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("string") + @Pattern(regexp="/[a-z]/i")public String getString() { + return string; + } + + @JsonProperty("string") + public void setString(String string) { + this.string = string; + } + + /** + **/ + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty(required = true, value = "byte") + @NotNull public byte[] getByte() { + return _byte; + } + + @JsonProperty(required = true, value = "byte") + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + /** + **/ + public FormatTest binary(File binary) { + this.binary = binary; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("binary") + public File getBinary() { + return binary; + } + + @JsonProperty("binary") + public void setBinary(File binary) { + this.binary = binary; + } + + /** + **/ + public FormatTest date(LocalDate date) { + this.date = date; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty(required = true, value = "date") + @NotNull public LocalDate getDate() { + return date; + } + + @JsonProperty(required = true, value = "date") + public void setDate(LocalDate date) { + this.date = date; + } + + /** + **/ + public FormatTest dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("dateTime") + public Date getDateTime() { + return dateTime; + } + + @JsonProperty("dateTime") + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + + @ApiModelProperty(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", value = "") + @JsonProperty("uuid") + public UUID getUuid() { + return uuid; + } + + @JsonProperty("uuid") + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + /** + **/ + public FormatTest password(String password) { + this.password = password; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty(required = true, value = "password") + @NotNull @Size(min=10,max=64)public String getPassword() { + return password; + } + + @JsonProperty(required = true, value = "password") + public void setPassword(String password) { + this.password = password; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + **/ + public FormatTest patternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return this; + } + + + @ApiModelProperty(value = "A string that is a 10 digit number. Can have leading zeros.") + @JsonProperty("pattern_with_digits") + @Pattern(regexp="^\\d{10}$")public String getPatternWithDigits() { + return patternWithDigits; + } + + @JsonProperty("pattern_with_digits") + public void setPatternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + **/ + public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + + @ApiModelProperty(value = "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + @JsonProperty("pattern_with_digits_and_delimiter") + @Pattern(regexp="/^image_\\d{1,3}$/i")public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + @JsonProperty("pattern_with_digits_and_delimiter") + public void setPatternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.decimal, formatTest.decimal) && + Objects.equals(this.string, formatTest.string) && + Arrays.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password) && + Objects.equals(this.patternWithDigits, formatTest.patternWithDigits) && + Objects.equals(this.patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, decimal, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" decimal: ").append(toIndentedString(decimal)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append("*").append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FormatTestBuilder builder() { + return new FormatTestBuilderImpl(); + } + + private static final class FormatTestBuilderImpl extends FormatTestBuilder { + + @Override + protected FormatTestBuilderImpl self() { + return this; + } + + @Override + public FormatTest build() { + return new FormatTest(this); + } + } + + public static abstract class FormatTestBuilder> { + private Integer integer; + private Integer int32; + private Long int64; + private BigDecimal number; + private Float _float; + private Double _double; + private BigDecimal decimal; + private String string; + private byte[] _byte; + private File binary; + private LocalDate date; + private Date dateTime; + private UUID uuid; + private String password; + private String patternWithDigits; + private String patternWithDigitsAndDelimiter; + protected abstract B self(); + + public abstract C build(); + + public B integer(Integer integer) { + this.integer = integer; + return self(); + } + public B int32(Integer int32) { + this.int32 = int32; + return self(); + } + public B int64(Long int64) { + this.int64 = int64; + return self(); + } + public B number(BigDecimal number) { + this.number = number; + return self(); + } + public B _float(Float _float) { + this._float = _float; + return self(); + } + public B _double(Double _double) { + this._double = _double; + return self(); + } + public B decimal(BigDecimal decimal) { + this.decimal = decimal; + return self(); + } + public B string(String string) { + this.string = string; + return self(); + } + public B _byte(byte[] _byte) { + this._byte = _byte; + return self(); + } + public B binary(File binary) { + this.binary = binary; + return self(); + } + public B date(LocalDate date) { + this.date = date; + return self(); + } + public B dateTime(Date dateTime) { + this.dateTime = dateTime; + return self(); + } + public B uuid(UUID uuid) { + this.uuid = uuid; + return self(); + } + public B password(String password) { + this.password = password; + return self(); + } + public B patternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return self(); + } + public B patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..7e4ec364cdc3 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -0,0 +1,147 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("hasOnlyReadOnly") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class HasOnlyReadOnly implements Serializable { + private String bar; + private String foo; + + protected HasOnlyReadOnly(HasOnlyReadOnlyBuilder b) { + this.bar = b.bar; + this.foo = b.foo; + } + + public HasOnlyReadOnly() { + } + + /** + **/ + public HasOnlyReadOnly bar(String bar) { + this.bar = bar; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + + @JsonProperty("bar") + public void setBar(String bar) { + this.bar = bar; + } + + /** + **/ + public HasOnlyReadOnly foo(String foo) { + this.foo = foo; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + @JsonProperty("foo") + public void setFoo(String foo) { + this.foo = foo; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HasOnlyReadOnlyBuilder builder() { + return new HasOnlyReadOnlyBuilderImpl(); + } + + private static final class HasOnlyReadOnlyBuilderImpl extends HasOnlyReadOnlyBuilder { + + @Override + protected HasOnlyReadOnlyBuilderImpl self() { + return this; + } + + @Override + public HasOnlyReadOnly build() { + return new HasOnlyReadOnly(this); + } + } + + public static abstract class HasOnlyReadOnlyBuilder> { + private String bar; + private String foo; + protected abstract B self(); + + public abstract C build(); + + public B bar(String bar) { + this.bar = bar; + return self(); + } + public B foo(String foo) { + this.foo = foo; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/HealthCheckResult.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/HealthCheckResult.java new file mode 100644 index 000000000000..23869cd6bd69 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/HealthCheckResult.java @@ -0,0 +1,121 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + **/ +@ApiModel(description = "Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.") +@JsonTypeName("HealthCheckResult") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class HealthCheckResult implements Serializable { + private String nullableMessage; + + protected HealthCheckResult(HealthCheckResultBuilder b) { + this.nullableMessage = b.nullableMessage; + } + + public HealthCheckResult() { + } + + /** + **/ + public HealthCheckResult nullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("NullableMessage") + public String getNullableMessage() { + return nullableMessage; + } + + @JsonProperty("NullableMessage") + public void setNullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return Objects.equals(this.nullableMessage, healthCheckResult.nullableMessage); + } + + @Override + public int hashCode() { + return Objects.hash(nullableMessage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HealthCheckResultBuilder builder() { + return new HealthCheckResultBuilderImpl(); + } + + private static final class HealthCheckResultBuilderImpl extends HealthCheckResultBuilder { + + @Override + protected HealthCheckResultBuilderImpl self() { + return this; + } + + @Override + public HealthCheckResult build() { + return new HealthCheckResult(this); + } + } + + public static abstract class HealthCheckResultBuilder> { + private String nullableMessage; + protected abstract B self(); + + public abstract C build(); + + public B nullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/IntegerEnum.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/IntegerEnum.java new file mode 100644 index 000000000000..01c18bf99ad2 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/IntegerEnum.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets IntegerEnum + */ +public enum IntegerEnum { + + NUMBER_1(1), + + NUMBER_2(2), + + NUMBER_3(3); + + private Integer value; + + IntegerEnum(Integer value) { + this.value = value; + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static IntegerEnum fromString(String s) { + for (IntegerEnum b : IntegerEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static IntegerEnum fromValue(Integer value) { + for (IntegerEnum b : IntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/MapTest.java new file mode 100644 index 000000000000..8f1afc702e9f --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/MapTest.java @@ -0,0 +1,315 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("MapTest") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class MapTest implements Serializable { + private @Valid Map> mapMapOfString = new HashMap<>(); + public enum InnerEnum { + + UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")); + + + private String value; + + InnerEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static InnerEnum fromString(String s) { + for (InnerEnum b : InnerEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static InnerEnum fromValue(String value) { + for (InnerEnum b : InnerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private @Valid Map mapOfEnumString = new HashMap<>(); + private @Valid Map directMap = new HashMap<>(); + private @Valid Map indirectMap = new HashMap<>(); + + protected MapTest(MapTestBuilder b) { + this.mapMapOfString = b.mapMapOfString; + this.mapOfEnumString = b.mapOfEnumString; + this.directMap = b.directMap; + this.indirectMap = b.indirectMap; + } + + public MapTest() { + } + + /** + **/ + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("map_map_of_string") + public Map> getMapMapOfString() { + return mapMapOfString; + } + + @JsonProperty("map_map_of_string") + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap<>(); + } + + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + public MapTest removeMapMapOfStringItem(String key) { + if (this.mapMapOfString != null) { + this.mapMapOfString.remove(key); + } + + return this; + } + /** + **/ + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("map_of_enum_string") + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + @JsonProperty("map_of_enum_string") + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap<>(); + } + + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + public MapTest removeMapOfEnumStringItem(String key) { + if (this.mapOfEnumString != null) { + this.mapOfEnumString.remove(key); + } + + return this; + } + /** + **/ + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("direct_map") + public Map getDirectMap() { + return directMap; + } + + @JsonProperty("direct_map") + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap<>(); + } + + this.directMap.put(key, directMapItem); + return this; + } + + public MapTest removeDirectMapItem(String key) { + if (this.directMap != null) { + this.directMap.remove(key); + } + + return this; + } + /** + **/ + public MapTest indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("indirect_map") + public Map getIndirectMap() { + return indirectMap; + } + + @JsonProperty("indirect_map") + public void setIndirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + + this.indirectMap.put(key, indirectMapItem); + return this; + } + + public MapTest removeIndirectMapItem(String key) { + if (this.indirectMap != null) { + this.indirectMap.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static MapTestBuilder builder() { + return new MapTestBuilderImpl(); + } + + private static final class MapTestBuilderImpl extends MapTestBuilder { + + @Override + protected MapTestBuilderImpl self() { + return this; + } + + @Override + public MapTest build() { + return new MapTest(this); + } + } + + public static abstract class MapTestBuilder> { + private Map> mapMapOfString = new HashMap<>(); + private Map mapOfEnumString = new HashMap<>(); + private Map directMap = new HashMap<>(); + private Map indirectMap = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return self(); + } + public B mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return self(); + } + public B directMap(Map directMap) { + this.directMap = directMap; + return self(); + } + public B indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..9f7b8665865e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,195 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.model.Animal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("MixedPropertiesAndAdditionalPropertiesClass") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class MixedPropertiesAndAdditionalPropertiesClass implements Serializable { + private UUID uuid; + private Date dateTime; + private @Valid Map map = new HashMap<>(); + + protected MixedPropertiesAndAdditionalPropertiesClass(MixedPropertiesAndAdditionalPropertiesClassBuilder b) { + this.uuid = b.uuid; + this.dateTime = b.dateTime; + this.map = b.map; + } + + public MixedPropertiesAndAdditionalPropertiesClass() { + } + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("uuid") + public UUID getUuid() { + return uuid; + } + + @JsonProperty("uuid") + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("dateTime") + public Date getDateTime() { + return dateTime; + } + + @JsonProperty("dateTime") + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("map") + @Valid public Map getMap() { + return map; + } + + @JsonProperty("map") + public void setMap(Map map) { + this.map = map; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap<>(); + } + + this.map.put(key, mapItem); + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(String key) { + if (this.map != null) { + this.map.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static MixedPropertiesAndAdditionalPropertiesClassBuilder builder() { + return new MixedPropertiesAndAdditionalPropertiesClassBuilderImpl(); + } + + private static final class MixedPropertiesAndAdditionalPropertiesClassBuilderImpl extends MixedPropertiesAndAdditionalPropertiesClassBuilder { + + @Override + protected MixedPropertiesAndAdditionalPropertiesClassBuilderImpl self() { + return this; + } + + @Override + public MixedPropertiesAndAdditionalPropertiesClass build() { + return new MixedPropertiesAndAdditionalPropertiesClass(this); + } + } + + public static abstract class MixedPropertiesAndAdditionalPropertiesClassBuilder> { + private UUID uuid; + private Date dateTime; + private Map map = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B uuid(UUID uuid) { + this.uuid = uuid; + return self(); + } + public B dateTime(Date dateTime) { + this.dateTime = dateTime; + return self(); + } + public B map(Map map) { + this.map = map; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Model200Response.java new file mode 100644 index 000000000000..7d0315ad979f --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Model200Response.java @@ -0,0 +1,149 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing model name starting with number + **/ +@ApiModel(description = "Model for testing model name starting with number") +@JsonTypeName("200_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Model200Response implements Serializable { + private Integer name; + private String propertyClass; + + protected Model200Response(Model200ResponseBuilder b) { + this.name = b.name; + this.propertyClass = b.propertyClass; + } + + public Model200Response() { + } + + /** + **/ + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("name") + public Integer getName() { + return name; + } + + @JsonProperty("name") + public void setName(Integer name) { + this.name = name; + } + + /** + **/ + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("class") + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty("class") + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static Model200ResponseBuilder builder() { + return new Model200ResponseBuilderImpl(); + } + + private static final class Model200ResponseBuilderImpl extends Model200ResponseBuilder { + + @Override + protected Model200ResponseBuilderImpl self() { + return this; + } + + @Override + public Model200Response build() { + return new Model200Response(this); + } + } + + public static abstract class Model200ResponseBuilder> { + private Integer name; + private String propertyClass; + protected abstract B self(); + + public abstract C build(); + + public B name(Integer name) { + this.name = name; + return self(); + } + public B propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelApiResponse.java new file mode 100644 index 000000000000..02d38af538d9 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -0,0 +1,175 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("ApiResponse") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelApiResponse implements Serializable { + private Integer code; + private String type; + private String message; + + protected ModelApiResponse(ModelApiResponseBuilder b) { + this.code = b.code; + this.type = b.type; + this.message = b.message; + } + + public ModelApiResponse() { + } + + /** + **/ + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("code") + public Integer getCode() { + return code; + } + + @JsonProperty("code") + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + /** + **/ + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + + @JsonProperty("message") + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelApiResponseBuilder builder() { + return new ModelApiResponseBuilderImpl(); + } + + private static final class ModelApiResponseBuilderImpl extends ModelApiResponseBuilder { + + @Override + protected ModelApiResponseBuilderImpl self() { + return this; + } + + @Override + public ModelApiResponse build() { + return new ModelApiResponse(this); + } + } + + public static abstract class ModelApiResponseBuilder> { + private Integer code; + private String type; + private String message; + protected abstract B self(); + + public abstract C build(); + + public B code(Integer code) { + this.code = code; + return self(); + } + public B type(String type) { + this.type = type; + return self(); + } + public B message(String message) { + this.message = message; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelFile.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelFile.java new file mode 100644 index 000000000000..ac4bd6d10e4d --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelFile.java @@ -0,0 +1,122 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Must be named `File` for test. + **/ +@ApiModel(description = "Must be named `File` for test.") +@JsonTypeName("File") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelFile implements Serializable { + private String sourceURI; + + protected ModelFile(ModelFileBuilder b) { + this.sourceURI = b.sourceURI; + } + + public ModelFile() { + } + + /** + * Test capitalization + **/ + public ModelFile sourceURI(String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + + @ApiModelProperty(value = "Test capitalization") + @JsonProperty("sourceURI") + public String getSourceURI() { + return sourceURI; + } + + @JsonProperty("sourceURI") + public void setSourceURI(String sourceURI) { + this.sourceURI = sourceURI; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelFile _file = (ModelFile) o; + return Objects.equals(this.sourceURI, _file.sourceURI); + } + + @Override + public int hashCode() { + return Objects.hash(sourceURI); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelFileBuilder builder() { + return new ModelFileBuilderImpl(); + } + + private static final class ModelFileBuilderImpl extends ModelFileBuilder { + + @Override + protected ModelFileBuilderImpl self() { + return this; + } + + @Override + public ModelFile build() { + return new ModelFile(this); + } + } + + public static abstract class ModelFileBuilder> { + private String sourceURI; + protected abstract B self(); + + public abstract C build(); + + public B sourceURI(String sourceURI) { + this.sourceURI = sourceURI; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelList.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelList.java new file mode 100644 index 000000000000..6609a9b18ddd --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelList.java @@ -0,0 +1,119 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("List") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelList implements Serializable { + private String _123list; + + protected ModelList(ModelListBuilder b) { + this._123list = b._123list; + } + + public ModelList() { + } + + /** + **/ + public ModelList _123list(String _123list) { + this._123list = _123list; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("123-list") + public String get123list() { + return _123list; + } + + @JsonProperty("123-list") + public void set123list(String _123list) { + this._123list = _123list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelList _list = (ModelList) o; + return Objects.equals(this._123list, _list._123list); + } + + @Override + public int hashCode() { + return Objects.hash(_123list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + + sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelListBuilder builder() { + return new ModelListBuilderImpl(); + } + + private static final class ModelListBuilderImpl extends ModelListBuilder { + + @Override + protected ModelListBuilderImpl self() { + return this; + } + + @Override + public ModelList build() { + return new ModelList(this); + } + } + + public static abstract class ModelListBuilder> { + private String _123list; + protected abstract B self(); + + public abstract C build(); + + public B _123list(String _123list) { + this._123list = _123list; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelReturn.java new file mode 100644 index 000000000000..92d2ad1d9107 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ModelReturn.java @@ -0,0 +1,121 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing reserved words + **/ +@ApiModel(description = "Model for testing reserved words") +@JsonTypeName("Return") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelReturn implements Serializable { + private Integer _return; + + protected ModelReturn(ModelReturnBuilder b) { + this._return = b._return; + } + + public ModelReturn() { + } + + /** + **/ + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("return") + public Integer getReturn() { + return _return; + } + + @JsonProperty("return") + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelReturnBuilder builder() { + return new ModelReturnBuilderImpl(); + } + + private static final class ModelReturnBuilderImpl extends ModelReturnBuilder { + + @Override + protected ModelReturnBuilderImpl self() { + return this; + } + + @Override + public ModelReturn build() { + return new ModelReturn(this); + } + } + + public static abstract class ModelReturnBuilder> { + private Integer _return; + protected abstract B self(); + + public abstract C build(); + + public B _return(Integer _return) { + this._return = _return; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Name.java new file mode 100644 index 000000000000..caafb9babe9d --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Name.java @@ -0,0 +1,211 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing model name same as property name + **/ +@ApiModel(description = "Model for testing model name same as property name") +@JsonTypeName("Name") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Name implements Serializable { + private Integer name; + private Integer snakeCase; + private String property; + private Integer _123number; + + protected Name(NameBuilder b) { + this.name = b.name; + this.snakeCase = b.snakeCase; + this.property = b.property; + this._123number = b._123number; + } + + public Name() { + } + + @JsonCreator + public Name( + @JsonProperty(required = true, value = "name") Integer name + ) { + this.name = name; + } + + /** + **/ + public Name name(Integer name) { + this.name = name; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty(required = true, value = "name") + @NotNull public Integer getName() { + return name; + } + + @JsonProperty(required = true, value = "name") + public void setName(Integer name) { + this.name = name; + } + + /** + **/ + public Name snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("snake_case") + public Integer getSnakeCase() { + return snakeCase; + } + + @JsonProperty("snake_case") + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + + /** + **/ + public Name property(String property) { + this.property = property; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("property") + public String getProperty() { + return property; + } + + @JsonProperty("property") + public void setProperty(String property) { + this.property = property; + } + + /** + **/ + public Name _123number(Integer _123number) { + this._123number = _123number; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("123Number") + public Integer get123number() { + return _123number; + } + + @JsonProperty("123Number") + public void set123number(Integer _123number) { + this._123number = _123number; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static NameBuilder builder() { + return new NameBuilderImpl(); + } + + private static final class NameBuilderImpl extends NameBuilder { + + @Override + protected NameBuilderImpl self() { + return this; + } + + @Override + public Name build() { + return new Name(this); + } + } + + public static abstract class NameBuilder> { + private Integer name; + private Integer snakeCase; + private String property; + private Integer _123number; + protected abstract B self(); + + public abstract C build(); + + public B name(Integer name) { + this.name = name; + return self(); + } + public B snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return self(); + } + public B property(String property) { + this.property = property; + return self(); + } + public B _123number(Integer _123number) { + this._123number = _123number; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/NullableClass.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/NullableClass.java new file mode 100644 index 000000000000..1a7656015918 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/NullableClass.java @@ -0,0 +1,434 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.joda.time.LocalDate; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("NullableClass") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class NullableClass extends HashMap implements Serializable { + private Integer integerProp; + private BigDecimal numberProp; + private Boolean booleanProp; + private String stringProp; + private LocalDate dateProp; + private Date datetimeProp; + private @Valid List arrayNullableProp; + private @Valid List arrayAndItemsNullableProp; + private @Valid List arrayItemsNullable = new ArrayList<>(); + private @Valid Map objectNullableProp; + private @Valid Map objectAndItemsNullableProp; + private @Valid Map objectItemsNullable = new HashMap<>(); + + public NullableClass() { + } + + /** + **/ + public NullableClass integerProp(Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("integer_prop") + public Integer getIntegerProp() { + return integerProp; + } + + @JsonProperty("integer_prop") + public void setIntegerProp(Integer integerProp) { + this.integerProp = integerProp; + } + + /** + **/ + public NullableClass numberProp(BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("number_prop") + @Valid public BigDecimal getNumberProp() { + return numberProp; + } + + @JsonProperty("number_prop") + public void setNumberProp(BigDecimal numberProp) { + this.numberProp = numberProp; + } + + /** + **/ + public NullableClass booleanProp(Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("boolean_prop") + public Boolean getBooleanProp() { + return booleanProp; + } + + @JsonProperty("boolean_prop") + public void setBooleanProp(Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + /** + **/ + public NullableClass stringProp(String stringProp) { + this.stringProp = stringProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("string_prop") + public String getStringProp() { + return stringProp; + } + + @JsonProperty("string_prop") + public void setStringProp(String stringProp) { + this.stringProp = stringProp; + } + + /** + **/ + public NullableClass dateProp(LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("date_prop") + public LocalDate getDateProp() { + return dateProp; + } + + @JsonProperty("date_prop") + public void setDateProp(LocalDate dateProp) { + this.dateProp = dateProp; + } + + /** + **/ + public NullableClass datetimeProp(Date datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("datetime_prop") + public Date getDatetimeProp() { + return datetimeProp; + } + + @JsonProperty("datetime_prop") + public void setDatetimeProp(Date datetimeProp) { + this.datetimeProp = datetimeProp; + } + + /** + **/ + public NullableClass arrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_nullable_prop") + public List getArrayNullableProp() { + return arrayNullableProp; + } + + @JsonProperty("array_nullable_prop") + public void setArrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + public NullableClass removeArrayNullablePropItem(Object arrayNullablePropItem) { + if (arrayNullablePropItem != null && this.arrayNullableProp != null) { + this.arrayNullableProp.remove(arrayNullablePropItem); + } + + return this; + } + /** + **/ + public NullableClass arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_and_items_nullable_prop") + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + @JsonProperty("array_and_items_nullable_prop") + public void setArrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + public NullableClass removeArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (arrayAndItemsNullablePropItem != null && this.arrayAndItemsNullableProp != null) { + this.arrayAndItemsNullableProp.remove(arrayAndItemsNullablePropItem); + } + + return this; + } + /** + **/ + public NullableClass arrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("array_items_nullable") + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + @JsonProperty("array_items_nullable") + public void setArrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + public NullableClass removeArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (arrayItemsNullableItem != null && this.arrayItemsNullable != null) { + this.arrayItemsNullable.remove(arrayItemsNullableItem); + } + + return this; + } + /** + **/ + public NullableClass objectNullableProp(Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("object_nullable_prop") + public Map getObjectNullableProp() { + return objectNullableProp; + } + + @JsonProperty("object_nullable_prop") + public void setObjectNullableProp(Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + public NullableClass removeObjectNullablePropItem(String key) { + if (this.objectNullableProp != null) { + this.objectNullableProp.remove(key); + } + + return this; + } + /** + **/ + public NullableClass objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("object_and_items_nullable_prop") + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + @JsonProperty("object_and_items_nullable_prop") + public void setObjectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + public NullableClass removeObjectAndItemsNullablePropItem(String key) { + if (this.objectAndItemsNullableProp != null) { + this.objectAndItemsNullableProp.remove(key); + } + + return this; + } + /** + **/ + public NullableClass objectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("object_items_nullable") + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + @JsonProperty("object_items_nullable") + public void setObjectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + if (this.objectItemsNullable == null) { + this.objectItemsNullable = new HashMap<>(); + } + + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + public NullableClass removeObjectItemsNullableItem(String key) { + if (this.objectItemsNullable != null) { + this.objectItemsNullable.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableClass nullableClass = (NullableClass) o; + return Objects.equals(this.integerProp, nullableClass.integerProp) && + Objects.equals(this.numberProp, nullableClass.numberProp) && + Objects.equals(this.booleanProp, nullableClass.booleanProp) && + Objects.equals(this.stringProp, nullableClass.stringProp) && + Objects.equals(this.dateProp, nullableClass.dateProp) && + Objects.equals(this.datetimeProp, nullableClass.datetimeProp) && + Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) && + Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) && + Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) && + Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) && + Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && + Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); + sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); + sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); + sb.append(" stringProp: ").append(toIndentedString(stringProp)).append("\n"); + sb.append(" dateProp: ").append(toIndentedString(dateProp)).append("\n"); + sb.append(" datetimeProp: ").append(toIndentedString(datetimeProp)).append("\n"); + sb.append(" arrayNullableProp: ").append(toIndentedString(arrayNullableProp)).append("\n"); + sb.append(" arrayAndItemsNullableProp: ").append(toIndentedString(arrayAndItemsNullableProp)).append("\n"); + sb.append(" arrayItemsNullable: ").append(toIndentedString(arrayItemsNullable)).append("\n"); + sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); + sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); + sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/NumberOnly.java new file mode 100644 index 000000000000..df0d78161e74 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/NumberOnly.java @@ -0,0 +1,119 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("NumberOnly") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class NumberOnly implements Serializable { + private BigDecimal justNumber; + + protected NumberOnly(NumberOnlyBuilder b) { + this.justNumber = b.justNumber; + } + + public NumberOnly() { + } + + /** + **/ + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("JustNumber") + @Valid public BigDecimal getJustNumber() { + return justNumber; + } + + @JsonProperty("JustNumber") + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static NumberOnlyBuilder builder() { + return new NumberOnlyBuilderImpl(); + } + + private static final class NumberOnlyBuilderImpl extends NumberOnlyBuilder { + + @Override + protected NumberOnlyBuilderImpl self() { + return this; + } + + @Override + public NumberOnly build() { + return new NumberOnly(this); + } + } + + public static abstract class NumberOnlyBuilder> { + private BigDecimal justNumber; + protected abstract B self(); + + public abstract C build(); + + public B justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java new file mode 100644 index 000000000000..9c32a4959a62 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java @@ -0,0 +1,223 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.DeprecatedObject; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("ObjectWithDeprecatedFields") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ObjectWithDeprecatedFields implements Serializable { + private String uuid; + private BigDecimal id; + private DeprecatedObject deprecatedRef; + private @Valid List bars = new ArrayList<>(); + + protected ObjectWithDeprecatedFields(ObjectWithDeprecatedFieldsBuilder b) { + this.uuid = b.uuid; + this.id = b.id; + this.deprecatedRef = b.deprecatedRef; + this.bars = b.bars; + } + + public ObjectWithDeprecatedFields() { + } + + /** + **/ + public ObjectWithDeprecatedFields uuid(String uuid) { + this.uuid = uuid; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("uuid") + public String getUuid() { + return uuid; + } + + @JsonProperty("uuid") + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + **/ + public ObjectWithDeprecatedFields id(BigDecimal id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + @Valid public BigDecimal getId() { + return id; + } + + @JsonProperty("id") + public void setId(BigDecimal id) { + this.id = id; + } + + /** + **/ + public ObjectWithDeprecatedFields deprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("deprecatedRef") + @Valid public DeprecatedObject getDeprecatedRef() { + return deprecatedRef; + } + + @JsonProperty("deprecatedRef") + public void setDeprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + } + + /** + **/ + public ObjectWithDeprecatedFields bars(List bars) { + this.bars = bars; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("bars") + public List getBars() { + return bars; + } + + @JsonProperty("bars") + public void setBars(List bars) { + this.bars = bars; + } + + public ObjectWithDeprecatedFields addBarsItem(String barsItem) { + if (this.bars == null) { + this.bars = new ArrayList<>(); + } + + this.bars.add(barsItem); + return this; + } + + public ObjectWithDeprecatedFields removeBarsItem(String barsItem) { + if (barsItem != null && this.bars != null) { + this.bars.remove(barsItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObjectWithDeprecatedFields objectWithDeprecatedFields = (ObjectWithDeprecatedFields) o; + return Objects.equals(this.uuid, objectWithDeprecatedFields.uuid) && + Objects.equals(this.id, objectWithDeprecatedFields.id) && + Objects.equals(this.deprecatedRef, objectWithDeprecatedFields.deprecatedRef) && + Objects.equals(this.bars, objectWithDeprecatedFields.bars); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, id, deprecatedRef, bars); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObjectWithDeprecatedFields {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" deprecatedRef: ").append(toIndentedString(deprecatedRef)).append("\n"); + sb.append(" bars: ").append(toIndentedString(bars)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ObjectWithDeprecatedFieldsBuilder builder() { + return new ObjectWithDeprecatedFieldsBuilderImpl(); + } + + private static final class ObjectWithDeprecatedFieldsBuilderImpl extends ObjectWithDeprecatedFieldsBuilder { + + @Override + protected ObjectWithDeprecatedFieldsBuilderImpl self() { + return this; + } + + @Override + public ObjectWithDeprecatedFields build() { + return new ObjectWithDeprecatedFields(this); + } + } + + public static abstract class ObjectWithDeprecatedFieldsBuilder> { + private String uuid; + private BigDecimal id; + private DeprecatedObject deprecatedRef; + private List bars = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B uuid(String uuid) { + this.uuid = uuid; + return self(); + } + public B id(BigDecimal id) { + this.id = id; + return self(); + } + public B deprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return self(); + } + public B bars(List bars) { + this.bars = bars; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Order.java new file mode 100644 index 000000000000..1d6ed3bf20be --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Order.java @@ -0,0 +1,307 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("Order") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Order implements Serializable { + private Long id; + private Long petId; + private Integer quantity; + private Date shipDate; + public enum StatusEnum { + + PLACED(String.valueOf("placed")), APPROVED(String.valueOf("approved")), DELIVERED(String.valueOf("delivered")); + + + private String value; + + StatusEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StatusEnum fromString(String s) { + for (StatusEnum b : StatusEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private StatusEnum status; + private Boolean complete = false; + + protected Order(OrderBuilder b) { + this.id = b.id; + this.petId = b.petId; + this.quantity = b.quantity; + this.shipDate = b.shipDate; + this.status = b.status; + this.complete = b.complete; + } + + public Order() { + } + + /** + **/ + public Order id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("petId") + public Long getPetId() { + return petId; + } + + @JsonProperty("petId") + public void setPetId(Long petId) { + this.petId = petId; + } + + /** + **/ + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("quantity") + public Integer getQuantity() { + return quantity; + } + + @JsonProperty("quantity") + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + /** + **/ + public Order shipDate(Date shipDate) { + this.shipDate = shipDate; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("shipDate") + public Date getShipDate() { + return shipDate; + } + + @JsonProperty("shipDate") + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + /** + * Order Status + **/ + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + + @ApiModelProperty(value = "Order Status") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + + @JsonProperty("status") + public void setStatus(StatusEnum status) { + this.status = status; + } + + /** + **/ + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("complete") + public Boolean getComplete() { + return complete; + } + + @JsonProperty("complete") + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static OrderBuilder builder() { + return new OrderBuilderImpl(); + } + + private static final class OrderBuilderImpl extends OrderBuilder { + + @Override + protected OrderBuilderImpl self() { + return this; + } + + @Override + public Order build() { + return new Order(this); + } + } + + public static abstract class OrderBuilder> { + private Long id; + private Long petId; + private Integer quantity; + private Date shipDate; + private StatusEnum status; + private Boolean complete = false; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B petId(Long petId) { + this.petId = petId; + return self(); + } + public B quantity(Integer quantity) { + this.quantity = quantity; + return self(); + } + public B shipDate(Date shipDate) { + this.shipDate = shipDate; + return self(); + } + public B status(StatusEnum status) { + this.status = status; + return self(); + } + public B complete(Boolean complete) { + this.complete = complete; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterComposite.java new file mode 100644 index 000000000000..b1d099d0db4f --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterComposite.java @@ -0,0 +1,175 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("OuterComposite") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class OuterComposite implements Serializable { + private BigDecimal myNumber; + private String myString; + private Boolean myBoolean; + + protected OuterComposite(OuterCompositeBuilder b) { + this.myNumber = b.myNumber; + this.myString = b.myString; + this.myBoolean = b.myBoolean; + } + + public OuterComposite() { + } + + /** + **/ + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("my_number") + @Valid public BigDecimal getMyNumber() { + return myNumber; + } + + @JsonProperty("my_number") + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + /** + **/ + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("my_string") + public String getMyString() { + return myString; + } + + @JsonProperty("my_string") + public void setMyString(String myString) { + this.myString = myString; + } + + /** + **/ + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("my_boolean") + public Boolean getMyBoolean() { + return myBoolean; + } + + @JsonProperty("my_boolean") + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static OuterCompositeBuilder builder() { + return new OuterCompositeBuilderImpl(); + } + + private static final class OuterCompositeBuilderImpl extends OuterCompositeBuilder { + + @Override + protected OuterCompositeBuilderImpl self() { + return this; + } + + @Override + public OuterComposite build() { + return new OuterComposite(this); + } + } + + public static abstract class OuterCompositeBuilder> { + private BigDecimal myNumber; + private String myString; + private Boolean myBoolean; + protected abstract B self(); + + public abstract C build(); + + public B myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return self(); + } + public B myString(String myString) { + this.myString = myString; + return self(); + } + public B myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnum.java new file mode 100644 index 000000000000..5f86922395d7 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnum.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnum fromString(String s) { + for (OuterEnum b : OuterEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + return null; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..f9fd44c8deb0 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumDefaultValue + */ +public enum OuterEnumDefaultValue { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnumDefaultValue(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumDefaultValue fromString(String s) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumDefaultValue fromValue(String value) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnumInteger.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnumInteger.java new file mode 100644 index 000000000000..a81c0a77bebf --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnumInteger.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumInteger + */ +public enum OuterEnumInteger { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumInteger(Integer value) { + this.value = value; + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumInteger fromString(String s) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumInteger fromValue(Integer value) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..3f16a4d4e458 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumIntegerDefaultValue + */ +public enum OuterEnumIntegerDefaultValue { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumIntegerDefaultValue(Integer value) { + this.value = value; + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumIntegerDefaultValue fromString(String s) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumIntegerDefaultValue fromValue(Integer value) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java new file mode 100644 index 000000000000..bfc0d133ac75 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java @@ -0,0 +1,126 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.OuterEnumInteger; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("OuterObjectWithEnumProperty") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class OuterObjectWithEnumProperty implements Serializable { + private OuterEnumInteger value; + + protected OuterObjectWithEnumProperty(OuterObjectWithEnumPropertyBuilder b) { + this.value = b.value; + } + + public OuterObjectWithEnumProperty() { + } + + @JsonCreator + public OuterObjectWithEnumProperty( + @JsonProperty(required = true, value = "value") OuterEnumInteger value + ) { + this.value = value; + } + + /** + **/ + public OuterObjectWithEnumProperty value(OuterEnumInteger value) { + this.value = value; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty(required = true, value = "value") + @NotNull public OuterEnumInteger getValue() { + return value; + } + + @JsonProperty(required = true, value = "value") + public void setValue(OuterEnumInteger value) { + this.value = value; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterObjectWithEnumProperty outerObjectWithEnumProperty = (OuterObjectWithEnumProperty) o; + return Objects.equals(this.value, outerObjectWithEnumProperty.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterObjectWithEnumProperty {\n"); + + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static OuterObjectWithEnumPropertyBuilder builder() { + return new OuterObjectWithEnumPropertyBuilderImpl(); + } + + private static final class OuterObjectWithEnumPropertyBuilderImpl extends OuterObjectWithEnumPropertyBuilder { + + @Override + protected OuterObjectWithEnumPropertyBuilderImpl self() { + return this; + } + + @Override + public OuterObjectWithEnumProperty build() { + return new OuterObjectWithEnumProperty(this); + } + } + + public static abstract class OuterObjectWithEnumPropertyBuilder> { + private OuterEnumInteger value; + protected abstract B self(); + + public abstract C build(); + + public B value(OuterEnumInteger value) { + this.value = value; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ParentWithNullable.java new file mode 100644 index 000000000000..5a80b5cabfb1 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ParentWithNullable.java @@ -0,0 +1,201 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChildWithNullable.class, name = "ChildWithNullable"), +}) + + +@JsonTypeName("ParentWithNullable") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ParentWithNullable implements Serializable { + public enum TypeEnum { + + CHILD_WITH_NULLABLE(String.valueOf("ChildWithNullable")); + + + private String value; + + TypeEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static TypeEnum fromString(String s) { + for (TypeEnum b : TypeEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private TypeEnum type; + private String nullableProperty; + + protected ParentWithNullable(ParentWithNullableBuilder b) { + this.type = b.type; + this.nullableProperty = b.nullableProperty; + } + + public ParentWithNullable() { + } + + /** + **/ + public ParentWithNullable type(TypeEnum type) { + this.type = type; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("type") + public TypeEnum getType() { + return type; + } + + @JsonProperty("type") + public void setType(TypeEnum type) { + this.type = type; + } + + /** + **/ + public ParentWithNullable nullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("nullableProperty") + public String getNullableProperty() { + return nullableProperty; + } + + @JsonProperty("nullableProperty") + public void setNullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParentWithNullable parentWithNullable = (ParentWithNullable) o; + return Objects.equals(this.type, parentWithNullable.type) && + Objects.equals(this.nullableProperty, parentWithNullable.nullableProperty); + } + + @Override + public int hashCode() { + return Objects.hash(type, nullableProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParentWithNullable {\n"); + + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" nullableProperty: ").append(toIndentedString(nullableProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ParentWithNullableBuilder builder() { + return new ParentWithNullableBuilderImpl(); + } + + private static final class ParentWithNullableBuilderImpl extends ParentWithNullableBuilder { + + @Override + protected ParentWithNullableBuilderImpl self() { + return this; + } + + @Override + public ParentWithNullable build() { + return new ParentWithNullable(this); + } + } + + public static abstract class ParentWithNullableBuilder> { + private TypeEnum type; + private String nullableProperty; + protected abstract B self(); + + public abstract C build(); + + public B type(TypeEnum type) { + this.type = type; + return self(); + } + public B nullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Pet.java new file mode 100644 index 000000000000..5bd95c1f88cf --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Pet.java @@ -0,0 +1,356 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.model.Category; +import org.openapitools.model.Tag; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("Pet") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Pet implements Serializable { + private Long id; + private Category category; + private String name; + private @Valid Set photoUrls = new LinkedHashSet<>(); + private @Valid List<@Valid Tag> tags = new ArrayList<>(); + public enum StatusEnum { + + AVAILABLE(String.valueOf("available")), PENDING(String.valueOf("pending")), SOLD(String.valueOf("sold")); + + + private String value; + + StatusEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StatusEnum fromString(String s) { + for (StatusEnum b : StatusEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private StatusEnum status; + + protected Pet(PetBuilder b) { + this.id = b.id; + this.category = b.category; + this.name = b.name; + this.photoUrls = b.photoUrls; + this.tags = b.tags; + this.status = b.status; + } + + public Pet() { + } + + @JsonCreator + public Pet( + @JsonProperty(required = true, value = "name") String name, + @JsonProperty(required = true, value = "photoUrls") Set photoUrls + ) { + this.name = name; + this.photoUrls = photoUrls; + } + + /** + **/ + public Pet id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Pet category(Category category) { + this.category = category; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("category") + @Valid public Category getCategory() { + return category; + } + + @JsonProperty("category") + public void setCategory(Category category) { + this.category = category; + } + + /** + **/ + public Pet name(String name) { + this.name = name; + return this; + } + + + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty(required = true, value = "name") + @NotNull public String getName() { + return name; + } + + @JsonProperty(required = true, value = "name") + public void setName(String name) { + this.name = name; + } + + /** + **/ + public Pet photoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + + @ApiModelProperty(required = true, value = "") + @JsonProperty(required = true, value = "photoUrls") + @NotNull public Set getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(required = true, value = "photoUrls") + @JsonDeserialize(as = LinkedHashSet.class) + public void setPhotoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new LinkedHashSet<>(); + } + + this.photoUrls.add(photoUrlsItem); + return this; + } + + public Pet removePhotoUrlsItem(String photoUrlsItem) { + if (photoUrlsItem != null && this.photoUrls != null) { + this.photoUrls.remove(photoUrlsItem); + } + + return this; + } + /** + **/ + public Pet tags(List<@Valid Tag> tags) { + this.tags = tags; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("tags") + @Valid public List<@Valid Tag> getTags() { + return tags; + } + + @JsonProperty("tags") + public void setTags(List<@Valid Tag> tags) { + this.tags = tags; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + + this.tags.add(tagsItem); + return this; + } + + public Pet removeTagsItem(Tag tagsItem) { + if (tagsItem != null && this.tags != null) { + this.tags.remove(tagsItem); + } + + return this; + } + /** + * pet status in the store + **/ + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + + @ApiModelProperty(value = "pet status in the store") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + + @JsonProperty("status") + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static PetBuilder builder() { + return new PetBuilderImpl(); + } + + private static final class PetBuilderImpl extends PetBuilder { + + @Override + protected PetBuilderImpl self() { + return this; + } + + @Override + public Pet build() { + return new Pet(this); + } + } + + public static abstract class PetBuilder> { + private Long id; + private Category category; + private String name; + private Set photoUrls = new LinkedHashSet<>(); + private List tags = new ArrayList<>(); + private StatusEnum status; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B category(Category category) { + this.category = category; + return self(); + } + public B name(String name) { + this.name = name; + return self(); + } + public B photoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + return self(); + } + public B tags(List tags) { + this.tags = tags; + return self(); + } + public B status(StatusEnum status) { + this.status = status; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..6dc5d80381bb --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -0,0 +1,146 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("ReadOnlyFirst") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ReadOnlyFirst implements Serializable { + private String bar; + private String baz; + + protected ReadOnlyFirst(ReadOnlyFirstBuilder b) { + this.bar = b.bar; + this.baz = b.baz; + } + + public ReadOnlyFirst() { + } + + /** + **/ + public ReadOnlyFirst bar(String bar) { + this.bar = bar; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + + @JsonProperty("bar") + public void setBar(String bar) { + this.bar = bar; + } + + /** + **/ + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("baz") + public String getBaz() { + return baz; + } + + @JsonProperty("baz") + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ReadOnlyFirstBuilder builder() { + return new ReadOnlyFirstBuilderImpl(); + } + + private static final class ReadOnlyFirstBuilderImpl extends ReadOnlyFirstBuilder { + + @Override + protected ReadOnlyFirstBuilderImpl self() { + return this; + } + + @Override + public ReadOnlyFirst build() { + return new ReadOnlyFirst(this); + } + } + + public static abstract class ReadOnlyFirstBuilder> { + private String bar; + private String baz; + protected abstract B self(); + + public abstract C build(); + + public B bar(String bar) { + this.bar = bar; + return self(); + } + public B baz(String baz) { + this.baz = baz; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/SingleRefType.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/SingleRefType.java new file mode 100644 index 000000000000..3314a0f57b45 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/SingleRefType.java @@ -0,0 +1,57 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets SingleRefType + */ +public enum SingleRefType { + + ADMIN("admin"), + + USER("user"); + + private String value; + + SingleRefType(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static SingleRefType fromString(String s) { + for (SingleRefType b : SingleRefType.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SingleRefType fromValue(String value) { + for (SingleRefType b : SingleRefType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/SpecialModelName.java new file mode 100644 index 000000000000..a09dfe8f75d5 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -0,0 +1,119 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("_special_model.name_") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class SpecialModelName implements Serializable { + private Long $specialPropertyName; + + protected SpecialModelName(SpecialModelNameBuilder b) { + this.$specialPropertyName = b.$specialPropertyName; + } + + public SpecialModelName() { + } + + /** + **/ + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("$special[property.name]") + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + @JsonProperty("$special[property.name]") + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static SpecialModelNameBuilder builder() { + return new SpecialModelNameBuilderImpl(); + } + + private static final class SpecialModelNameBuilderImpl extends SpecialModelNameBuilder { + + @Override + protected SpecialModelNameBuilderImpl self() { + return this; + } + + @Override + public SpecialModelName build() { + return new SpecialModelName(this); + } + } + + public static abstract class SpecialModelNameBuilder> { + private Long $specialPropertyName; + protected abstract B self(); + + public abstract C build(); + + public B $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/StringEnum.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/StringEnum.java new file mode 100644 index 000000000000..4e37a7e483bf --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/StringEnum.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets StringEnum + */ +public enum StringEnum { + + FOO("foo"), + + BAR("bar"), + + BAZ("baz"); + + private String value; + + StringEnum(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StringEnum fromString(String s) { + for (StringEnum b : StringEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StringEnum fromValue(String value) { + for (StringEnum b : StringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Tag.java new file mode 100644 index 000000000000..e86fa3376597 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/Tag.java @@ -0,0 +1,146 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("Tag") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Tag implements Serializable { + private Long id; + private String name; + + protected Tag(TagBuilder b) { + this.id = b.id; + this.name = b.name; + } + + public Tag() { + } + + /** + **/ + public Tag id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Tag name(String name) { + this.name = name; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static TagBuilder builder() { + return new TagBuilderImpl(); + } + + private static final class TagBuilderImpl extends TagBuilder { + + @Override + protected TagBuilderImpl self() { + return this; + } + + @Override + public Tag build() { + return new Tag(this); + } + } + + public static abstract class TagBuilder> { + private Long id; + private String name; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B name(String name) { + this.name = name; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java new file mode 100644 index 000000000000..2abbdcc5634b --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -0,0 +1,90 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("testInlineFreeformAdditionalProperties_request") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap implements Serializable { + private String someProperty; + + public TestInlineFreeformAdditionalPropertiesRequest() { + } + + /** + **/ + public TestInlineFreeformAdditionalPropertiesRequest someProperty(String someProperty) { + this.someProperty = someProperty; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("someProperty") + public String getSomeProperty() { + return someProperty; + } + + @JsonProperty("someProperty") + public void setSomeProperty(String someProperty) { + this.someProperty = someProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = (TestInlineFreeformAdditionalPropertiesRequest) o; + return Objects.equals(this.someProperty, testInlineFreeformAdditionalPropertiesRequest.someProperty) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(someProperty, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" someProperty: ").append(toIndentedString(someProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/User.java new file mode 100644 index 000000000000..5b25269f2432 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/gen/java/org/openapitools/model/User.java @@ -0,0 +1,315 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@JsonTypeName("User") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class User implements Serializable { + private Long id; + private String username; + private String firstName; + private String lastName; + private String email; + private String password; + private String phone; + private Integer userStatus; + + protected User(UserBuilder b) { + this.id = b.id; + this.username = b.username; + this.firstName = b.firstName; + this.lastName = b.lastName; + this.email = b.email; + this.password = b.password; + this.phone = b.phone; + this.userStatus = b.userStatus; + } + + public User() { + } + + /** + **/ + public User id(Long id) { + this.id = id; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public User username(String username) { + this.username = username; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonProperty("username") + public void setUsername(String username) { + this.username = username; + } + + /** + **/ + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("firstName") + public String getFirstName() { + return firstName; + } + + @JsonProperty("firstName") + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + **/ + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("lastName") + public String getLastName() { + return lastName; + } + + @JsonProperty("lastName") + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + **/ + public User email(String email) { + this.email = email; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("email") + public String getEmail() { + return email; + } + + @JsonProperty("email") + public void setEmail(String email) { + this.email = email; + } + + /** + **/ + public User password(String password) { + this.password = password; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("password") + public String getPassword() { + return password; + } + + @JsonProperty("password") + public void setPassword(String password) { + this.password = password; + } + + /** + **/ + public User phone(String phone) { + this.phone = phone; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("phone") + public String getPhone() { + return phone; + } + + @JsonProperty("phone") + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * User Status + **/ + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + + @ApiModelProperty(value = "User Status") + @JsonProperty("userStatus") + public Integer getUserStatus() { + return userStatus; + } + + @JsonProperty("userStatus") + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static UserBuilder builder() { + return new UserBuilderImpl(); + } + + private static final class UserBuilderImpl extends UserBuilder { + + @Override + protected UserBuilderImpl self() { + return this; + } + + @Override + public User build() { + return new User(this); + } + } + + public static abstract class UserBuilder> { + private Long id; + private String username; + private String firstName; + private String lastName; + private String email; + private String password; + private String phone; + private Integer userStatus; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B username(String username) { + this.username = username; + return self(); + } + public B firstName(String firstName) { + this.firstName = firstName; + return self(); + } + public B lastName(String lastName) { + this.lastName = lastName; + return self(); + } + public B email(String email) { + this.email = email; + return self(); + } + public B password(String password) { + this.password = password; + return self(); + } + public B phone(String phone) { + this.phone = phone; + return self(); + } + public B userStatus(Integer userStatus) { + this.userStatus = userStatus; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-annotations/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/main/openapi/openapi.yaml new file mode 100644 index 000000000000..e8ba4f7ffd4e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-annotations/src/main/openapi/openapi.yaml @@ -0,0 +1,2508 @@ +openapi: 3.0.0 +info: + description: "This spec is mainly for testing Petstore server and contains fake\ + \ endpoints, models. Please do not use this for any other purpose. Special characters:\ + \ \" \\" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- description: petstore server + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: "https://localhost:8080/{version}" + variables: + version: + default: v2 + enum: + - v1 + - v2 +- description: The local server without variables + url: https://127.0.0.1/no_varaible +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/_foo_get_default_response" + description: response + x-accepts: + - application/json + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + description: Successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: pet + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + description: Successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-webclient-blocking: true + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: pet + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 + - description: test server with variables + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + description: target server + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + x-tags: + - tag: pet + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + uniqueItems: true + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + uniqueItems: true + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + uniqueItems: true + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + x-tags: + - tag: pet + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + description: Successful operation + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + x-tags: + - tag: pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + x-tags: + - tag: pet + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "200": + description: Successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: pet + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-webclient-blocking: false + x-accepts: + - application/json + x-tags: + - tag: store + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + x-tags: + - tag: store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + x-tags: + - tag: store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + x-tags: + - tag: store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + x-tags: + - tag: user + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + x-tags: + - tag: user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Delete user + tags: + - user + x-accepts: + - application/json + x-tags: + - tag: user + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + x-tags: + - tag: user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake_classname_tags 123#$%^ + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + "400": + description: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: + - application/json + x-tags: + - tag: fake + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + - explode: true + in: query + name: enum_query_model_array + required: false + schema: + items: + $ref: "#/components/schemas/EnumClass" + type: array + style: form + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEnumParameters_request" + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test "client" model + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEndpointParameters_request" + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterNumber" + description: Input number as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterNumber" + description: Output number + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/property/enum-int: + post: + description: Test serialization of enum (int) properties with examples + operationId: fakePropertyEnumIntegerSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterObjectWithEnumProperty" + description: Input enum (int) as post body + required: true + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterObjectWithEnumProperty" + description: Output enum (int) + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterString" + description: Input string as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterString" + description: Output string + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Input boolean as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Output boolean + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterComposite" + description: Input composite as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterComposite" + description: Output composite + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/fakeBigDecimalMap_200_response" + description: successful operation + tags: + - fake + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testJsonFormData_request" + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FreeFormObject" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/MapOfString" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/inline-additionalProperties: + post: + description: "" + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/testInlineFreeformAdditionalProperties_request" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/nullable: + post: + description: "" + operationId: testNullable + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ChildWithNullable" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test nullable parent property + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: $another-fake? + /fake/body-with-file-schema: + put: + description: "For this test, the body for this request must reference a schema\ + \ named `File`." + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FileSchemaTestClass" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/body-with-binary: + put: + description: "For this test, the body has to be a binary file." + operationId: testBodyWithBinary + requestBody: + content: + image/png: + schema: + format: binary + nullable: true + type: string + description: image to upload + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: image/png + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: false + in: query + name: pipe + required: true + schema: + items: + type: string + type: array + style: pipeDelimited + - explode: false + in: query + name: ioutil + required: true + schema: + items: + type: string + type: array + style: form + - explode: false + in: query + name: http + required: true + schema: + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: language + required: false + schema: + additionalProperties: + format: string + type: string + type: object + style: form + - allowEmptyValue: true + explode: true + in: query + name: allowEmpty + required: true + schema: + type: string + style: form + responses: + "200": + description: Success + tags: + - fake + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFileWithRequiredFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: pet + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/HealthCheckResult" + description: The instance started successfully + summary: Health check endpoint + tags: + - fake + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/http-signature-test: + get: + operationId: fake-http-signature-test + parameters: + - description: query parameter + explode: true + in: query + name: query_1 + required: false + schema: + type: string + style: form + - description: header parameter + explode: false + in: header + name: header_1 + required: false + schema: + type: string + style: simple + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + description: The instance started successfully + security: + - http_signature_test: [] + summary: test http signature authentication + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/tests/defaults: + get: + operationId: fake-tests-defaults + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/fake_tests_defaults_default_response" + description: response + summary: test enum default in request body + tags: + - fake + x-accepts: + - application/json + x-tags: + - tag: fake +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + name: default-name + id: 6 + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: default-name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + uniqueItems: true + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + declawed: + type: boolean + type: object + Animal: + discriminator: + mapping: + DOG: "#/components/schemas/Dog" + CAT: "#/components/schemas/Cat" + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: "#/components/schemas/Animal" + type: array + format_test: + properties: + integer: + maximum: 100 + minimum: 10 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + decimal: + format: number + type: string + string: + pattern: "/[a-z]/i" + type: string + byte: + format: byte + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: "^\\d{10}$" + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: "/^image_\\d{1,3}$/i" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: "#/components/schemas/OuterEnum" + outerEnumInteger: + $ref: "#/components/schemas/OuterEnumInteger" + outerEnumDefaultValue: + $ref: "#/components/schemas/OuterEnumDefaultValue" + outerEnumIntegerDefaultValue: + $ref: "#/components/schemas/OuterEnumIntegerDefaultValue" + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: "#/components/schemas/Animal" + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + type: object + ArrayTest: + properties: + array_of_string: + items: + type: string + maxItems: 3 + minItems: 0 + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: "#/components/schemas/ReadOnlyFirst" + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + nullable: true + type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 2 + example: 2 + type: integer + OuterEnumDefaultValue: + default: placed + enum: + - placed + - approved + - delivered + type: string + OuterEnumIntegerDefaultValue: + default: 0 + enum: + - 0 + - 1 + - 2 + type: integer + OuterComposite: + example: + my_string: my_string + my_number: 0.8008281904610115 + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + ParentWithNullable: + discriminator: + propertyName: type + properties: + type: + enum: + - ChildWithNullable + type: string + nullableProperty: + nullable: true + type: string + type: object + ChildWithNullable: + allOf: + - $ref: "#/components/schemas/ParentWithNullable" + - properties: + otherProperty: + type: string + type: object + example: + otherProperty: otherProperty + nullableProperty: nullableProperty + type: ChildWithNullable + StringBooleanMap: + additionalProperties: + type: boolean + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: "#/components/schemas/File" + files: + items: + $ref: "#/components/schemas/File" + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + xml: + name: "$special[model.name]" + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage + properties: + NullableMessage: + nullable: true + type: string + type: object + NullableClass: + additionalProperties: + nullable: true + type: object + properties: + integer_prop: + nullable: true + type: integer + number_prop: + nullable: true + type: number + boolean_prop: + nullable: true + type: boolean + string_prop: + nullable: true + type: string + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: + items: + type: object + nullable: true + type: array + array_and_items_nullable_prop: + items: + nullable: true + type: object + nullable: true + type: array + array_items_nullable: + items: + nullable: true + type: object + type: array + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + type: object + type: object + OuterObjectWithEnumProperty: + example: + value: 2 + properties: + value: + $ref: "#/components/schemas/OuterEnumInteger" + required: + - value + type: object + DeprecatedObject: + deprecated: true + properties: + name: + type: string + type: object + ObjectWithDeprecatedFields: + properties: + uuid: + type: string + id: + deprecated: true + type: number + deprecatedRef: + $ref: "#/components/schemas/DeprecatedObject" + bars: + deprecated: true + items: + $ref: "#/components/schemas/Bar" + type: array + type: object + AllOfWithSingleRef: + properties: + username: + type: string + SingleRefType: + allOf: + - $ref: "#/components/schemas/SingleRefType" + type: object + SingleRefType: + enum: + - admin + - user + title: SingleRefType + type: string + StringEnum: + default: foo + enum: + - foo + - bar + - baz + type: string + IntegerEnum: + default: 1 + enum: + - 1 + - 2 + - 3 + type: integer + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: "#/components/schemas/Foo" + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + testEndpointParameters_request: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + fake_tests_defaults_default_response: + example: + stringEnum: foo + integerEnum: 0 + stringEnumInline: foo + integerEnumInline: 6 + properties: + stringEnum: + $ref: "#/components/schemas/StringEnum" + integerEnum: + $ref: "#/components/schemas/IntegerEnum" + stringEnumInline: + default: foo + enum: + - foo + - bar + - baz + type: string + integerEnumInline: + default: 1 + enum: + - 1 + - 2 + - 3 + type: integer + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + http_signature_test: + scheme: signature + type: http diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/.openapi-generator-ignore b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/.openapi-generator/FILES b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/.openapi-generator/FILES new file mode 100644 index 000000000000..7155b1df8e89 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/.openapi-generator/FILES @@ -0,0 +1,65 @@ +README.md +pom.xml +src/gen/java/org/openapitools/api/AnotherFakeApi.java +src/gen/java/org/openapitools/api/FakeApi.java +src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +src/gen/java/org/openapitools/api/FooApi.java +src/gen/java/org/openapitools/api/PetApi.java +src/gen/java/org/openapitools/api/RestApplication.java +src/gen/java/org/openapitools/api/RestResourceRoot.java +src/gen/java/org/openapitools/api/StoreApi.java +src/gen/java/org/openapitools/api/UserApi.java +src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +src/gen/java/org/openapitools/model/AllOfWithSingleRef.java +src/gen/java/org/openapitools/model/Animal.java +src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java +src/gen/java/org/openapitools/model/ArrayTest.java +src/gen/java/org/openapitools/model/Capitalization.java +src/gen/java/org/openapitools/model/Cat.java +src/gen/java/org/openapitools/model/Category.java +src/gen/java/org/openapitools/model/ChildWithNullable.java +src/gen/java/org/openapitools/model/ClassModel.java +src/gen/java/org/openapitools/model/Client.java +src/gen/java/org/openapitools/model/DeprecatedObject.java +src/gen/java/org/openapitools/model/Dog.java +src/gen/java/org/openapitools/model/EnumArrays.java +src/gen/java/org/openapitools/model/EnumClass.java +src/gen/java/org/openapitools/model/EnumTest.java +src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java +src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java +src/gen/java/org/openapitools/model/FileSchemaTestClass.java +src/gen/java/org/openapitools/model/Foo.java +src/gen/java/org/openapitools/model/FooGetDefaultResponse.java +src/gen/java/org/openapitools/model/FormatTest.java +src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +src/gen/java/org/openapitools/model/HealthCheckResult.java +src/gen/java/org/openapitools/model/IntegerEnum.java +src/gen/java/org/openapitools/model/MapTest.java +src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/gen/java/org/openapitools/model/Model200Response.java +src/gen/java/org/openapitools/model/ModelApiResponse.java +src/gen/java/org/openapitools/model/ModelFile.java +src/gen/java/org/openapitools/model/ModelList.java +src/gen/java/org/openapitools/model/ModelReturn.java +src/gen/java/org/openapitools/model/Name.java +src/gen/java/org/openapitools/model/NullableClass.java +src/gen/java/org/openapitools/model/NumberOnly.java +src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java +src/gen/java/org/openapitools/model/Order.java +src/gen/java/org/openapitools/model/OuterComposite.java +src/gen/java/org/openapitools/model/OuterEnum.java +src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java +src/gen/java/org/openapitools/model/OuterEnumInteger.java +src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java +src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java +src/gen/java/org/openapitools/model/ParentWithNullable.java +src/gen/java/org/openapitools/model/Pet.java +src/gen/java/org/openapitools/model/ReadOnlyFirst.java +src/gen/java/org/openapitools/model/SingleRefType.java +src/gen/java/org/openapitools/model/SpecialModelName.java +src/gen/java/org/openapitools/model/StringEnum.java +src/gen/java/org/openapitools/model/Tag.java +src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java +src/gen/java/org/openapitools/model/User.java +src/main/openapi/openapi.yaml diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/.openapi-generator/VERSION b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/.openapi-generator/VERSION new file mode 100644 index 000000000000..2fb556b60635 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.18.0-SNAPSHOT diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/README.md b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/README.md new file mode 100644 index 000000000000..da90cb71c166 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/README.md @@ -0,0 +1,27 @@ +# JAX-RS server with OpenAPI + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. + +This is an example of building a OpenAPI-enabled JAX-RS server. +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + + +The JAX-RS implementation needs to be provided by the application server you are deploying on. + +To run the server from the command line, you can use maven to provision and start a TomEE Server. +Please execute the following: + +``` +mvn -Dtomee-embedded-plugin.http=80 package org.apache.tomee.maven:tomee-embedded-maven-plugin:7.0.5:run +``` + +You can then call your server endpoints under: + +``` +http://localhost:80/v2/ +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/pom.xml b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/pom.xml new file mode 100644 index 000000000000..7796609e288e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/pom.xml @@ -0,0 +1,146 @@ + + 4.0.0 + org.openapitools + jaxrs-spec-petstore-server-jakarta-swagger-v3 + war + jaxrs-spec-petstore-server-jakarta-swagger-v3 + 1.0.0 + + + + src/main/java + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + false + + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + + + + jakarta.ws.rs + jakarta.ws.rs-api + ${jakarta.ws.rs-version} + provided + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-json-provider + ${jackson-version} + + + joda-time + joda-time + ${joda-version} + + + jakarta.annotation + jakarta.annotation-api + ${javax.annotation-api-version} + + + io.swagger.core.v3 + swagger-annotations + provided + ${io.swagger.v3.annotations.version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + junit + junit + ${junit-version} + test + + + org.testng + testng + 6.8.8 + test + + + junit + junit + + + snakeyaml + org.yaml + + + bsh + org.beanshell + + + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + + 1.8 + ${java.version} + ${java.version} + UTF-8 + 2.19.2 + 4.13.2 + 2.10.13 + 2.1.1 + 3.0.2 + 3.1.0 + 0.2.8 + 2.2.21 + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/AnotherFakeApi.java new file mode 100644 index 000000000000..79e37157bdad --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -0,0 +1,38 @@ +package org.openapitools.api; + +import org.openapitools.model.Client; + +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/another-fake/dummy") + +@Tag(name = "another-fake") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class AnotherFakeApi { + + @PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @Operation(summary = "To test special tags", description = "To test special tags and operation ID starting with number") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response call123testSpecialTags(@Valid @NotNull Client client) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/FakeApi.java new file mode 100644 index 000000000000..9f696c6d47a3 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/FakeApi.java @@ -0,0 +1,311 @@ +package org.openapitools.api; + +import java.math.BigDecimal; +import org.openapitools.model.ChildWithNullable; +import org.openapitools.model.Client; +import java.util.Date; +import org.openapitools.model.EnumClass; +import org.openapitools.model.FakeBigDecimalMap200Response; +import org.openapitools.model.FakeTestsDefaultsDefaultResponse; +import java.io.File; +import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; +import org.joda.time.LocalDate; +import java.util.Map; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.OuterComposite; +import org.openapitools.model.OuterObjectWithEnumProperty; +import org.openapitools.model.Pet; +import org.openapitools.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.model.User; + +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/fake") + +@Tag(name = "fake") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeApi { + + @GET + @Path("/BigDecimalMap") + @Produces({ "*/*" }) + @Operation(summary = "", description = "for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response fakeBigDecimalMap() { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/health") + @Produces({ "application/json" }) + @Operation(summary = "Health check endpoint", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "The instance started successfully") + }) + public Response fakeHealthGet() { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/http-signature-test") + @Consumes({ "application/json", "application/xml" }) + @Operation(summary = "test http signature authentication", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "The instance started successfully") + }) + public Response fakeHttpSignatureTest(@Valid @NotNull Pet pet,@QueryParam("query_1") String query1,@HeaderParam("header_1") String header1) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/boolean") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "Test serialization of outer boolean types") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Output boolean") + }) + public Response fakeOuterBooleanSerialize(@Valid Boolean body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/composite") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "Test serialization of object with outer number type") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Output composite") + }) + public Response fakeOuterCompositeSerialize(@Valid OuterComposite outerComposite) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/number") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "Test serialization of outer number types") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Output number") + }) + public Response fakeOuterNumberSerialize(@Valid BigDecimal body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/string") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "Test serialization of outer string types") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Output string") + }) + public Response fakeOuterStringSerialize(@Valid String body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/property/enum-int") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "Test serialization of enum (int) properties with examples") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Output enum (int)") + }) + public Response fakePropertyEnumIntegerSerialize(@Valid @NotNull OuterObjectWithEnumProperty outerObjectWithEnumProperty) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/tests/defaults") + @Produces({ "application/json" }) + @Operation(summary = "test enum default in request body", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "response") + }) + public Response fakeTestsDefaults() { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/additionalProperties-reference") + @Consumes({ "application/json" }) + @Operation(summary = "test referenced additionalProperties", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testAdditionalPropertiesReference(@Valid @NotNull Map requestBody) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/body-with-binary") + @Consumes({ "image/png" }) + @Operation(summary = "", description = "For this test, the body has to be a binary file.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Success") + }) + public Response testBodyWithBinary(@Valid File body) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/body-with-file-schema") + @Consumes({ "application/json" }) + @Operation(summary = "", description = "For this test, the body for this request must reference a schema named `File`.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Success") + }) + public Response testBodyWithFileSchema(@Valid @NotNull FileSchemaTestClass fileSchemaTestClass) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/body-with-query-params") + @Consumes({ "application/json" }) + @Operation(summary = "", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Success") + }) + public Response testBodyWithQueryParams(@QueryParam("query") @NotNull String query,@Valid @NotNull User user) { + return Response.ok().entity("magic!").build(); + } + + @PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @Operation(summary = "To test \"client\" model", description = "To test \"client\" model") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testClientModel(@Valid @NotNull Client client) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", description = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Invalid username supplied"), + @ApiResponse(responseCode = "404", description = "User not found") + }) + public Response testEndpointParameters(@FormParam(value = "number") BigDecimal number,@FormParam(value = "double") Double _double,@FormParam(value = "pattern_without_delimiter") String patternWithoutDelimiter,@FormParam(value = "byte") byte[] _byte,@FormParam(value = "integer") Integer integer,@FormParam(value = "int32") Integer int32,@FormParam(value = "int64") Long int64,@FormParam(value = "float") Float _float,@FormParam(value = "string") String string, @FormParam(value = "binary") InputStream binaryInputStream,@FormParam(value = "date") LocalDate date,@FormParam(value = "dateTime") Date dateTime,@FormParam(value = "password") String password,@FormParam(value = "callback") String paramCallback) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "To test enum parameters", description = "To test enum parameters") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Invalid request"), + @ApiResponse(responseCode = "404", description = "Not found") + }) + public Response testEnumParameters(@HeaderParam("enum_header_string_array") List enumHeaderStringArray,@QueryParam("enum_query_string_array") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") String enumQueryString,@QueryParam("enum_query_integer") Integer enumQueryInteger,@QueryParam("enum_query_double") Double enumQueryDouble,@QueryParam("enum_query_model_array") List enumQueryModelArray,@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) { + return Response.ok().entity("magic!").build(); + } + + @DELETE + @Operation(summary = "Fake endpoint to test group parameters (optional)", description = "Fake endpoint to test group parameters (optional)") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Something wrong") + }) + public Response testGroupParameters(@QueryParam("required_string_group") @NotNull Integer requiredStringGroup,@HeaderParam("required_boolean_group") @NotNull Boolean requiredBooleanGroup,@QueryParam("required_int64_group") @NotNull Long requiredInt64Group,@QueryParam("string_group") Integer stringGroup,@HeaderParam("boolean_group") Boolean booleanGroup,@QueryParam("int64_group") Long int64Group) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/inline-additionalProperties") + @Consumes({ "application/json" }) + @Operation(summary = "test inline additionalProperties", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testInlineAdditionalProperties(@Valid @NotNull Map requestBody) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/inline-freeform-additionalProperties") + @Consumes({ "application/json" }) + @Operation(summary = "test inline free-form additionalProperties", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testInlineFreeformAdditionalProperties(@Valid @NotNull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/jsonFormData") + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "test json serialization of form data", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testJsonFormData(@FormParam(value = "param") String param,@FormParam(value = "param2") String param2) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/nullable") + @Consumes({ "application/json" }) + @Operation(summary = "test nullable parent property", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testNullable(@Valid @NotNull ChildWithNullable childWithNullable) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/test-query-parameters") + @Operation(summary = "", description = "To test the collection format in query parameters") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Success") + }) + public Response testQueryParameterCollectionFormat(@QueryParam("pipe") @NotNull List pipe,@QueryParam("ioutil") @NotNull List ioutil,@QueryParam("http") @NotNull List http,@QueryParam("url") @NotNull List url,@QueryParam("context") @NotNull List context,@QueryParam("allowEmpty") @NotNull String allowEmpty,@QueryParam("language") Map language) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/stringMap-reference") + @Consumes({ "application/json" }) + @Operation(summary = "test referenced string map", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testStringMapReference(@Valid @NotNull Map requestBody) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/{petId}/uploadImageWithRequiredFile") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @Operation(summary = "uploads an image (required)", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response uploadFileWithRequiredFile(@PathParam("petId") Long petId, @FormParam(value = "requiredFile") InputStream requiredFileInputStream,@FormParam(value = "additionalMetadata") String additionalMetadata) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java new file mode 100644 index 000000000000..a6b36d870ed3 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -0,0 +1,38 @@ +package org.openapitools.api; + +import org.openapitools.model.Client; + +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/fake_classname_test") + +@Tag(name = "fake_classname_test") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeClassnameTestApi { + + @PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @Operation(summary = "To test class name in snake case", description = "To test class name in snake case") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testClassname(@Valid @NotNull Client client) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/FooApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/FooApi.java new file mode 100644 index 000000000000..88d1776b5824 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/FooApi.java @@ -0,0 +1,37 @@ +package org.openapitools.api; + +import org.openapitools.model.FooGetDefaultResponse; + +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/foo") + +@Tag(name = "foo") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FooApi { + + @GET + @Produces({ "application/json" }) + @Operation(summary = "", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "response") + }) + public Response fooGet() { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/PetApi.java new file mode 100644 index 000000000000..d66fdac1c7f4 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/PetApi.java @@ -0,0 +1,126 @@ +package org.openapitools.api; + +import java.io.File; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.Pet; +import java.util.Set; + +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/pet") + +@Tag(name = "pet") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class PetApi { + + @POST + @Consumes({ "application/json", "application/xml" }) + @Operation(summary = "Add a new pet to the store", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successful operation"), + @ApiResponse(responseCode = "405", description = "Invalid input") + }) + public Response addPet(@Valid @NotNull Pet pet) { + return Response.ok().entity("magic!").build(); + } + + @DELETE + @Path("/{petId}") + @Operation(summary = "Deletes a pet", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid pet value") + }) + public Response deletePet(@PathParam("petId") Long petId) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/findByStatus") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Finds Pets by status", description = "Multiple status values can be provided with comma separated strings") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid status value") + }) + public Response findPetsByStatus(@QueryParam("status") @NotNull List status) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/findByTags") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Finds Pets by tags", description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid tag value") + }) + public Response findPetsByTags(@QueryParam("tags") @NotNull Set tags) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/{petId}") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Find pet by ID", description = "Returns a single pet") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), + @ApiResponse(responseCode = "404", description = "Pet not found") + }) + public Response getPetById(@PathParam("petId") Long petId) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Consumes({ "application/json", "application/xml" }) + @Operation(summary = "Update an existing pet", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), + @ApiResponse(responseCode = "404", description = "Pet not found"), + @ApiResponse(responseCode = "405", description = "Validation exception") + }) + public Response updatePet(@Valid @NotNull Pet pet) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "Updates a pet in the store with form data", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successful operation"), + @ApiResponse(responseCode = "405", description = "Invalid input") + }) + public Response updatePetWithForm(@PathParam("petId") Long petId,@FormParam(value = "name") String name,@FormParam(value = "status") String status) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @Operation(summary = "uploads an image", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response uploadFile(@PathParam("petId") Long petId,@FormParam(value = "additionalMetadata") String additionalMetadata, @FormParam(value = "file") InputStream _fileInputStream) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/RestApplication.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/RestApplication.java new file mode 100644 index 000000000000..f6d53b4501db --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/RestApplication.java @@ -0,0 +1,9 @@ +package org.openapitools.api; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +@ApplicationPath(RestResourceRoot.APPLICATION_PATH) +public class RestApplication extends Application { + +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/RestResourceRoot.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/RestResourceRoot.java new file mode 100644 index 000000000000..96ba6c8d8e40 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/RestResourceRoot.java @@ -0,0 +1,5 @@ +package org.openapitools.api; + +public class RestResourceRoot { + public static final String APPLICATION_PATH = "/v2"; +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/StoreApi.java new file mode 100644 index 000000000000..a9b3fe629ad9 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/StoreApi.java @@ -0,0 +1,76 @@ +package org.openapitools.api; + +import java.util.Map; +import org.openapitools.model.Order; + +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/store") + +@Tag(name = "store") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class StoreApi { + + @DELETE + @Path("/order/{order_id}") + @Operation(summary = "Delete purchase order by ID", description = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), + @ApiResponse(responseCode = "404", description = "Order not found") + }) + public Response deleteOrder(@PathParam("order_id") String orderId) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/inventory") + @Produces({ "application/json" }) + @Operation(summary = "Returns pet inventories by status", description = "Returns a map of status codes to quantities") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response getInventory() { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/order/{order_id}") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Find purchase order by ID", description = "For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), + @ApiResponse(responseCode = "404", description = "Order not found") + }) + public Response getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) Long orderId) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/order") + @Consumes({ "application/json" }) + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Place an order for a pet", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid Order") + }) + public Response placeOrder(@Valid @NotNull Order order) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/UserApi.java new file mode 100644 index 000000000000..9df9a0c4de1b --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/api/UserApi.java @@ -0,0 +1,118 @@ +package org.openapitools.api; + +import java.util.Date; +import org.openapitools.model.User; + +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/user") + +@Tag(name = "user") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class UserApi { + + @POST + @Consumes({ "application/json" }) + @Operation(summary = "Create user", description = "This can only be done by the logged in user.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response createUser(@Valid @NotNull User user) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/createWithArray") + @Consumes({ "application/json" }) + @Operation(summary = "Creates list of users with given input array", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response createUsersWithArrayInput(@Valid @NotNull List<@Valid User> user) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/createWithList") + @Consumes({ "application/json" }) + @Operation(summary = "Creates list of users with given input array", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response createUsersWithListInput(@Valid @NotNull List<@Valid User> user) { + return Response.ok().entity("magic!").build(); + } + + @DELETE + @Path("/{username}") + @Operation(summary = "Delete user", description = "This can only be done by the logged in user.") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Invalid username supplied"), + @ApiResponse(responseCode = "404", description = "User not found") + }) + public Response deleteUser(@PathParam("username") String username) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/{username}") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Get user by user name", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid username supplied"), + @ApiResponse(responseCode = "404", description = "User not found") + }) + public Response getUserByName(@PathParam("username") String username) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/login") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Logs user into the system", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid username/password supplied") + }) + public Response loginUser(@QueryParam("username") @NotNull String username,@QueryParam("password") @NotNull String password) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/logout") + @Operation(summary = "Logs out current logged in user session", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response logoutUser() { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/{username}") + @Consumes({ "application/json" }) + @Operation(summary = "Updated user", description = "This can only be done by the logged in user.") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Invalid user supplied"), + @ApiResponse(responseCode = "404", description = "User not found") + }) + public Response updateUser(@PathParam("username") String username,@Valid @NotNull User user) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..572a9047c853 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -0,0 +1,179 @@ +package org.openapitools.model; + +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("AdditionalPropertiesClass") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class AdditionalPropertiesClass implements Serializable { + private @Valid Map mapProperty = new HashMap<>(); + private @Valid Map> mapOfMapProperty = new HashMap<>(); + + protected AdditionalPropertiesClass(AdditionalPropertiesClassBuilder b) { + this.mapProperty = b.mapProperty; + this.mapOfMapProperty = b.mapOfMapProperty; + } + + public AdditionalPropertiesClass() { + } + + /** + **/ + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + + @Schema(description = "") + @JsonProperty("map_property") + public Map getMapProperty() { + return mapProperty; + } + + @JsonProperty("map_property") + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<>(); + } + + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + public AdditionalPropertiesClass removeMapPropertyItem(String key) { + if (this.mapProperty != null) { + this.mapProperty.remove(key); + } + + return this; + } + /** + **/ + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + + @Schema(description = "") + @JsonProperty("map_of_map_property") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + @JsonProperty("map_of_map_property") + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<>(); + } + + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + public AdditionalPropertiesClass removeMapOfMapPropertyItem(String key) { + if (this.mapOfMapProperty != null) { + this.mapOfMapProperty.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static AdditionalPropertiesClassBuilder builder() { + return new AdditionalPropertiesClassBuilderImpl(); + } + + private static final class AdditionalPropertiesClassBuilderImpl extends AdditionalPropertiesClassBuilder { + + @Override + protected AdditionalPropertiesClassBuilderImpl self() { + return this; + } + + @Override + public AdditionalPropertiesClass build() { + return new AdditionalPropertiesClass(this); + } + } + + public static abstract class AdditionalPropertiesClassBuilder> { + private Map mapProperty = new HashMap<>(); + private Map> mapOfMapProperty = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return self(); + } + public B mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java new file mode 100644 index 000000000000..17cf3b463527 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java @@ -0,0 +1,146 @@ +package org.openapitools.model; + +import org.openapitools.model.SingleRefType; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("AllOfWithSingleRef") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class AllOfWithSingleRef implements Serializable { + private String username; + private SingleRefType singleRefType; + + protected AllOfWithSingleRef(AllOfWithSingleRefBuilder b) { + this.username = b.username; + this.singleRefType = b.singleRefType; + } + + public AllOfWithSingleRef() { + } + + /** + **/ + public AllOfWithSingleRef username(String username) { + this.username = username; + return this; + } + + + @Schema(description = "") + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonProperty("username") + public void setUsername(String username) { + this.username = username; + } + + /** + **/ + public AllOfWithSingleRef singleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + return this; + } + + + @Schema(description = "") + @JsonProperty("SingleRefType") + public SingleRefType getSingleRefType() { + return singleRefType; + } + + @JsonProperty("SingleRefType") + public void setSingleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfWithSingleRef allOfWithSingleRef = (AllOfWithSingleRef) o; + return Objects.equals(this.username, allOfWithSingleRef.username) && + Objects.equals(this.singleRefType, allOfWithSingleRef.singleRefType); + } + + @Override + public int hashCode() { + return Objects.hash(username, singleRefType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfWithSingleRef {\n"); + + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" singleRefType: ").append(toIndentedString(singleRefType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static AllOfWithSingleRefBuilder builder() { + return new AllOfWithSingleRefBuilderImpl(); + } + + private static final class AllOfWithSingleRefBuilderImpl extends AllOfWithSingleRefBuilder { + + @Override + protected AllOfWithSingleRefBuilderImpl self() { + return this; + } + + @Override + public AllOfWithSingleRef build() { + return new AllOfWithSingleRef(this); + } + } + + public static abstract class AllOfWithSingleRefBuilder> { + private String username; + private SingleRefType singleRefType; + protected abstract B self(); + + public abstract C build(); + + public B username(String username) { + this.username = username; + return self(); + } + public B singleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Animal.java new file mode 100644 index 000000000000..58f03001a091 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Animal.java @@ -0,0 +1,160 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) + + +@Schema(description="") +@JsonTypeName("Animal") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Animal implements Serializable { + private String className; + private String color = "red"; + + protected Animal(AnimalBuilder b) { + this.className = b.className; + this.color = b.color; + } + + public Animal() { + } + + @JsonCreator + public Animal( + @JsonProperty(required = true, value = "className") String className + ) { + this.className = className; + } + + /** + **/ + public Animal className(String className) { + this.className = className; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "className") + @NotNull public String getClassName() { + return className; + } + + @JsonProperty(required = true, value = "className") + public void setClassName(String className) { + this.className = className; + } + + /** + **/ + public Animal color(String color) { + this.color = color; + return this; + } + + + @Schema(description = "") + @JsonProperty("color") + public String getColor() { + return color; + } + + @JsonProperty("color") + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static AnimalBuilder builder() { + return new AnimalBuilderImpl(); + } + + private static final class AnimalBuilderImpl extends AnimalBuilder { + + @Override + protected AnimalBuilderImpl self() { + return this; + } + + @Override + public Animal build() { + return new Animal(this); + } + } + + public static abstract class AnimalBuilder> { + private String className; + private String color = "red"; + protected abstract B self(); + + public abstract C build(); + + public B className(String className) { + this.className = className; + return self(); + } + public B color(String color) { + this.color = color; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..56f450820cdf --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,137 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ArrayOfArrayOfNumberOnly") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ArrayOfArrayOfNumberOnly implements Serializable { + private @Valid List> arrayArrayNumber = new ArrayList<>(); + + protected ArrayOfArrayOfNumberOnly(ArrayOfArrayOfNumberOnlyBuilder b) { + this.arrayArrayNumber = b.arrayArrayNumber; + } + + public ArrayOfArrayOfNumberOnly() { + } + + /** + **/ + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + + @Schema(description = "") + @JsonProperty("ArrayArrayNumber") + @Valid public List<@Valid List<@Valid BigDecimal>> getArrayArrayNumber() { + return arrayArrayNumber; + } + + @JsonProperty("ArrayArrayNumber") + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList<>(); + } + + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + public ArrayOfArrayOfNumberOnly removeArrayArrayNumberItem(List arrayArrayNumberItem) { + if (arrayArrayNumberItem != null && this.arrayArrayNumber != null) { + this.arrayArrayNumber.remove(arrayArrayNumberItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ArrayOfArrayOfNumberOnlyBuilder builder() { + return new ArrayOfArrayOfNumberOnlyBuilderImpl(); + } + + private static final class ArrayOfArrayOfNumberOnlyBuilderImpl extends ArrayOfArrayOfNumberOnlyBuilder { + + @Override + protected ArrayOfArrayOfNumberOnlyBuilderImpl self() { + return this; + } + + @Override + public ArrayOfArrayOfNumberOnly build() { + return new ArrayOfArrayOfNumberOnly(this); + } + } + + public static abstract class ArrayOfArrayOfNumberOnlyBuilder> { + private List> arrayArrayNumber = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..510b41b48cf1 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -0,0 +1,137 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ArrayOfNumberOnly") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ArrayOfNumberOnly implements Serializable { + private @Valid List arrayNumber = new ArrayList<>(); + + protected ArrayOfNumberOnly(ArrayOfNumberOnlyBuilder b) { + this.arrayNumber = b.arrayNumber; + } + + public ArrayOfNumberOnly() { + } + + /** + **/ + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + + @Schema(description = "") + @JsonProperty("ArrayNumber") + @Valid public List<@Valid BigDecimal> getArrayNumber() { + return arrayNumber; + } + + @JsonProperty("ArrayNumber") + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList<>(); + } + + this.arrayNumber.add(arrayNumberItem); + return this; + } + + public ArrayOfNumberOnly removeArrayNumberItem(BigDecimal arrayNumberItem) { + if (arrayNumberItem != null && this.arrayNumber != null) { + this.arrayNumber.remove(arrayNumberItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ArrayOfNumberOnlyBuilder builder() { + return new ArrayOfNumberOnlyBuilderImpl(); + } + + private static final class ArrayOfNumberOnlyBuilderImpl extends ArrayOfNumberOnlyBuilder { + + @Override + protected ArrayOfNumberOnlyBuilderImpl self() { + return this; + } + + @Override + public ArrayOfNumberOnly build() { + return new ArrayOfNumberOnly(this); + } + } + + public static abstract class ArrayOfNumberOnlyBuilder> { + private List arrayNumber = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ArrayTest.java new file mode 100644 index 000000000000..c4e3c9f0c461 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ArrayTest.java @@ -0,0 +1,225 @@ +package org.openapitools.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.ReadOnlyFirst; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ArrayTest") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ArrayTest implements Serializable { + private @Valid List arrayOfString = new ArrayList<>(); + private @Valid List> arrayArrayOfInteger = new ArrayList<>(); + private @Valid List> arrayArrayOfModel = new ArrayList<>(); + + protected ArrayTest(ArrayTestBuilder b) { + this.arrayOfString = b.arrayOfString; + this.arrayArrayOfInteger = b.arrayArrayOfInteger; + this.arrayArrayOfModel = b.arrayArrayOfModel; + } + + public ArrayTest() { + } + + /** + **/ + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_of_string") + @Size(min=0,max=3)public List getArrayOfString() { + return arrayOfString; + } + + @JsonProperty("array_of_string") + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList<>(); + } + + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + public ArrayTest removeArrayOfStringItem(String arrayOfStringItem) { + if (arrayOfStringItem != null && this.arrayOfString != null) { + this.arrayOfString.remove(arrayOfStringItem); + } + + return this; + } + /** + **/ + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_array_of_integer") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + @JsonProperty("array_array_of_integer") + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList<>(); + } + + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + public ArrayTest removeArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (arrayArrayOfIntegerItem != null && this.arrayArrayOfInteger != null) { + this.arrayArrayOfInteger.remove(arrayArrayOfIntegerItem); + } + + return this; + } + /** + **/ + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_array_of_model") + @Valid public List<@Valid List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + @JsonProperty("array_array_of_model") + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + public ArrayTest addArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList<>(); + } + + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + public ArrayTest removeArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) { + if (arrayArrayOfModelItem != null && this.arrayArrayOfModel != null) { + this.arrayArrayOfModel.remove(arrayArrayOfModelItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ArrayTestBuilder builder() { + return new ArrayTestBuilderImpl(); + } + + private static final class ArrayTestBuilderImpl extends ArrayTestBuilder { + + @Override + protected ArrayTestBuilderImpl self() { + return this; + } + + @Override + public ArrayTest build() { + return new ArrayTest(this); + } + } + + public static abstract class ArrayTestBuilder> { + private List arrayOfString = new ArrayList<>(); + private List> arrayArrayOfInteger = new ArrayList<>(); + private List> arrayArrayOfModel = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return self(); + } + public B arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return self(); + } + public B arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Capitalization.java new file mode 100644 index 000000000000..1afe1773507f --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Capitalization.java @@ -0,0 +1,258 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Capitalization") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Capitalization implements Serializable { + private String smallCamel; + private String capitalCamel; + private String smallSnake; + private String capitalSnake; + private String scAETHFlowPoints; + private String ATT_NAME; + + protected Capitalization(CapitalizationBuilder b) { + this.smallCamel = b.smallCamel; + this.capitalCamel = b.capitalCamel; + this.smallSnake = b.smallSnake; + this.capitalSnake = b.capitalSnake; + this.scAETHFlowPoints = b.scAETHFlowPoints; + this.ATT_NAME = b.ATT_NAME; + } + + public Capitalization() { + } + + /** + **/ + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + + @Schema(description = "") + @JsonProperty("smallCamel") + public String getSmallCamel() { + return smallCamel; + } + + @JsonProperty("smallCamel") + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + /** + **/ + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + + @Schema(description = "") + @JsonProperty("CapitalCamel") + public String getCapitalCamel() { + return capitalCamel; + } + + @JsonProperty("CapitalCamel") + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + /** + **/ + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + + @Schema(description = "") + @JsonProperty("small_Snake") + public String getSmallSnake() { + return smallSnake; + } + + @JsonProperty("small_Snake") + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + /** + **/ + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + + @Schema(description = "") + @JsonProperty("Capital_Snake") + public String getCapitalSnake() { + return capitalSnake; + } + + @JsonProperty("Capital_Snake") + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + /** + **/ + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + + @Schema(description = "") + @JsonProperty("SCA_ETH_Flow_Points") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + @JsonProperty("SCA_ETH_Flow_Points") + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + /** + * Name of the pet + **/ + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + + @Schema(description = "Name of the pet ") + @JsonProperty("ATT_NAME") + public String getATTNAME() { + return ATT_NAME; + } + + @JsonProperty("ATT_NAME") + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static CapitalizationBuilder builder() { + return new CapitalizationBuilderImpl(); + } + + private static final class CapitalizationBuilderImpl extends CapitalizationBuilder { + + @Override + protected CapitalizationBuilderImpl self() { + return this; + } + + @Override + public Capitalization build() { + return new Capitalization(this); + } + } + + public static abstract class CapitalizationBuilder> { + private String smallCamel; + private String capitalCamel; + private String smallSnake; + private String capitalSnake; + private String scAETHFlowPoints; + private String ATT_NAME; + protected abstract B self(); + + public abstract C build(); + + public B smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return self(); + } + public B capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return self(); + } + public B smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return self(); + } + public B capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return self(); + } + public B scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return self(); + } + public B ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Cat.java new file mode 100644 index 000000000000..a3a1cc80f042 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Cat.java @@ -0,0 +1,126 @@ +package org.openapitools.model; + +import org.openapitools.model.Animal; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Cat") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Cat extends Animal implements Serializable { + private Boolean declawed; + + protected Cat(CatBuilder b) { + super(b); + this.declawed = b.declawed; + } + + public Cat() { + } + + @JsonCreator + public Cat( + @JsonProperty(required = true, value = "className") String className + ) { + super( + className + ); + } + + /** + **/ + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + + @Schema(description = "") + @JsonProperty("declawed") + public Boolean getDeclawed() { + return declawed; + } + + @JsonProperty("declawed") + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static CatBuilder builder() { + return new CatBuilderImpl(); + } + + private static final class CatBuilderImpl extends CatBuilder { + + @Override + protected CatBuilderImpl self() { + return this; + } + + @Override + public Cat build() { + return new Cat(this); + } + } + + public static abstract class CatBuilder> extends AnimalBuilder { + private Boolean declawed; + + public B declawed(Boolean declawed) { + this.declawed = declawed; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Category.java new file mode 100644 index 000000000000..4fdb24f7f44c --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Category.java @@ -0,0 +1,152 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Category") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Category implements Serializable { + private Long id; + private String name = "default-name"; + + protected Category(CategoryBuilder b) { + this.id = b.id; + this.name = b.name; + } + + public Category() { + } + + @JsonCreator + public Category( + @JsonProperty(required = true, value = "name") String name + ) { + this.name = name; + } + + /** + **/ + public Category id(Long id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Category name(String name) { + this.name = name; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "name") + @NotNull public String getName() { + return name; + } + + @JsonProperty(required = true, value = "name") + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static CategoryBuilder builder() { + return new CategoryBuilderImpl(); + } + + private static final class CategoryBuilderImpl extends CategoryBuilder { + + @Override + protected CategoryBuilderImpl self() { + return this; + } + + @Override + public Category build() { + return new Category(this); + } + } + + public static abstract class CategoryBuilder> { + private Long id; + private String name = "default-name"; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B name(String name) { + this.name = name; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ChildWithNullable.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ChildWithNullable.java new file mode 100644 index 000000000000..57097d65fa75 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ChildWithNullable.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import org.openapitools.jackson.nullable.JsonNullable; +import org.openapitools.model.ParentWithNullable; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ChildWithNullable") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ChildWithNullable extends ParentWithNullable implements Serializable { + private String otherProperty; + + protected ChildWithNullable(ChildWithNullableBuilder b) { + super(b); + this.otherProperty = b.otherProperty; + } + + public ChildWithNullable() { + } + + /** + **/ + public ChildWithNullable otherProperty(String otherProperty) { + this.otherProperty = otherProperty; + return this; + } + + + @Schema(description = "") + @JsonProperty("otherProperty") + public String getOtherProperty() { + return otherProperty; + } + + @JsonProperty("otherProperty") + public void setOtherProperty(String otherProperty) { + this.otherProperty = otherProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChildWithNullable childWithNullable = (ChildWithNullable) o; + return Objects.equals(this.otherProperty, childWithNullable.otherProperty) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(otherProperty, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChildWithNullable {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" otherProperty: ").append(toIndentedString(otherProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ChildWithNullableBuilder builder() { + return new ChildWithNullableBuilderImpl(); + } + + private static final class ChildWithNullableBuilderImpl extends ChildWithNullableBuilder { + + @Override + protected ChildWithNullableBuilderImpl self() { + return this; + } + + @Override + public ChildWithNullable build() { + return new ChildWithNullable(this); + } + } + + public static abstract class ChildWithNullableBuilder> extends ParentWithNullableBuilder { + private String otherProperty; + + public B otherProperty(String otherProperty) { + this.otherProperty = otherProperty; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ClassModel.java new file mode 100644 index 000000000000..c3efb9f5891a --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ClassModel.java @@ -0,0 +1,119 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing model with \"_class\" property + **/ + +@Schema(description="Model for testing model with \"_class\" property") +@JsonTypeName("ClassModel") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ClassModel implements Serializable { + private String propertyClass; + + protected ClassModel(ClassModelBuilder b) { + this.propertyClass = b.propertyClass; + } + + public ClassModel() { + } + + /** + **/ + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + + @Schema(description = "") + @JsonProperty("_class") + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty("_class") + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ClassModelBuilder builder() { + return new ClassModelBuilderImpl(); + } + + private static final class ClassModelBuilderImpl extends ClassModelBuilder { + + @Override + protected ClassModelBuilderImpl self() { + return this; + } + + @Override + public ClassModel build() { + return new ClassModel(this); + } + } + + public static abstract class ClassModelBuilder> { + private String propertyClass; + protected abstract B self(); + + public abstract C build(); + + public B propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Client.java new file mode 100644 index 000000000000..200395b16f58 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Client.java @@ -0,0 +1,117 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Client") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Client implements Serializable { + private String client; + + protected Client(ClientBuilder b) { + this.client = b.client; + } + + public Client() { + } + + /** + **/ + public Client client(String client) { + this.client = client; + return this; + } + + + @Schema(description = "") + @JsonProperty("client") + public String getClient() { + return client; + } + + @JsonProperty("client") + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ClientBuilder builder() { + return new ClientBuilderImpl(); + } + + private static final class ClientBuilderImpl extends ClientBuilder { + + @Override + protected ClientBuilderImpl self() { + return this; + } + + @Override + public Client build() { + return new Client(this); + } + } + + public static abstract class ClientBuilder> { + private String client; + protected abstract B self(); + + public abstract C build(); + + public B client(String client) { + this.client = client; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/DeprecatedObject.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/DeprecatedObject.java new file mode 100644 index 000000000000..e316c80794c8 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/DeprecatedObject.java @@ -0,0 +1,117 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("DeprecatedObject") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class DeprecatedObject implements Serializable { + private String name; + + protected DeprecatedObject(DeprecatedObjectBuilder b) { + this.name = b.name; + } + + public DeprecatedObject() { + } + + /** + **/ + public DeprecatedObject name(String name) { + this.name = name; + return this; + } + + + @Schema(description = "") + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeprecatedObject deprecatedObject = (DeprecatedObject) o; + return Objects.equals(this.name, deprecatedObject.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeprecatedObject {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static DeprecatedObjectBuilder builder() { + return new DeprecatedObjectBuilderImpl(); + } + + private static final class DeprecatedObjectBuilderImpl extends DeprecatedObjectBuilder { + + @Override + protected DeprecatedObjectBuilderImpl self() { + return this; + } + + @Override + public DeprecatedObject build() { + return new DeprecatedObject(this); + } + } + + public static abstract class DeprecatedObjectBuilder> { + private String name; + protected abstract B self(); + + public abstract C build(); + + public B name(String name) { + this.name = name; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Dog.java new file mode 100644 index 000000000000..fd0386dd4e50 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Dog.java @@ -0,0 +1,126 @@ +package org.openapitools.model; + +import org.openapitools.model.Animal; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Dog") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Dog extends Animal implements Serializable { + private String breed; + + protected Dog(DogBuilder b) { + super(b); + this.breed = b.breed; + } + + public Dog() { + } + + @JsonCreator + public Dog( + @JsonProperty(required = true, value = "className") String className + ) { + super( + className + ); + } + + /** + **/ + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + + @Schema(description = "") + @JsonProperty("breed") + public String getBreed() { + return breed; + } + + @JsonProperty("breed") + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static DogBuilder builder() { + return new DogBuilderImpl(); + } + + private static final class DogBuilderImpl extends DogBuilder { + + @Override + protected DogBuilderImpl self() { + return this; + } + + @Override + public Dog build() { + return new Dog(this); + } + } + + public static abstract class DogBuilder> extends AnimalBuilder { + private String breed; + + public B breed(String breed) { + this.breed = breed; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/EnumArrays.java new file mode 100644 index 000000000000..393f627ed9bd --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/EnumArrays.java @@ -0,0 +1,258 @@ +package org.openapitools.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("EnumArrays") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class EnumArrays implements Serializable { + public enum JustSymbolEnum { + + GREATER_THAN_OR_EQUAL_TO(String.valueOf(">=")), DOLLAR(String.valueOf("$")); + + + private String value; + + JustSymbolEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static JustSymbolEnum fromString(String s) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String value) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private JustSymbolEnum justSymbol; + public enum ArrayEnumEnum { + + FISH(String.valueOf("fish")), CRAB(String.valueOf("crab")); + + + private String value; + + ArrayEnumEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static ArrayEnumEnum fromString(String s) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String value) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private @Valid List arrayEnum = new ArrayList<>(); + + protected EnumArrays(EnumArraysBuilder b) { + this.justSymbol = b.justSymbol; + this.arrayEnum = b.arrayEnum; + } + + public EnumArrays() { + } + + /** + **/ + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + + @Schema(description = "") + @JsonProperty("just_symbol") + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + @JsonProperty("just_symbol") + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + /** + **/ + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_enum") + public List getArrayEnum() { + return arrayEnum; + } + + @JsonProperty("array_enum") + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList<>(); + } + + this.arrayEnum.add(arrayEnumItem); + return this; + } + + public EnumArrays removeArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (arrayEnumItem != null && this.arrayEnum != null) { + this.arrayEnum.remove(arrayEnumItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static EnumArraysBuilder builder() { + return new EnumArraysBuilderImpl(); + } + + private static final class EnumArraysBuilderImpl extends EnumArraysBuilder { + + @Override + protected EnumArraysBuilderImpl self() { + return this; + } + + @Override + public EnumArrays build() { + return new EnumArrays(this); + } + } + + public static abstract class EnumArraysBuilder> { + private JustSymbolEnum justSymbol; + private List arrayEnum = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return self(); + } + public B arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/EnumClass.java new file mode 100644 index 000000000000..67abab2ebdfc --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/EnumClass.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumClass fromString(String s) { + for (EnumClass b : EnumClass.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/EnumTest.java new file mode 100644 index 000000000000..9e49ad8e7060 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/EnumTest.java @@ -0,0 +1,514 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import org.openapitools.model.OuterEnum; +import org.openapitools.model.OuterEnumDefaultValue; +import org.openapitools.model.OuterEnumInteger; +import org.openapitools.model.OuterEnumIntegerDefaultValue; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Enum_Test") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class EnumTest implements Serializable { + public enum EnumStringEnum { + + UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")), EMPTY(String.valueOf("")); + + + private String value; + + EnumStringEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumStringEnum fromString(String s) { + for (EnumStringEnum b : EnumStringEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumStringEnum fromValue(String value) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumStringEnum enumString; + public enum EnumStringRequiredEnum { + + UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")), EMPTY(String.valueOf("")); + + + private String value; + + EnumStringRequiredEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumStringRequiredEnum fromString(String s) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String value) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumStringRequiredEnum enumStringRequired; + public enum EnumIntegerEnum { + + NUMBER_1(Integer.valueOf(1)), NUMBER_MINUS_1(Integer.valueOf(-1)); + + + private Integer value; + + EnumIntegerEnum (Integer v) { + value = v; + } + + public Integer value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumIntegerEnum fromString(String s) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(Integer value) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumIntegerEnum enumInteger; + public enum EnumNumberEnum { + + NUMBER_1_DOT_1(Double.valueOf(1.1)), NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2)); + + + private Double value; + + EnumNumberEnum (Double v) { + value = v; + } + + public Double value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into Double, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumNumberEnum fromString(String s) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumNumberEnum fromValue(Double value) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumNumberEnum enumNumber; + private OuterEnum outerEnum; + private OuterEnumInteger outerEnumInteger; + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + + protected EnumTest(EnumTestBuilder b) { + this.enumString = b.enumString; + this.enumStringRequired = b.enumStringRequired; + this.enumInteger = b.enumInteger; + this.enumNumber = b.enumNumber; + this.outerEnum = b.outerEnum; + this.outerEnumInteger = b.outerEnumInteger; + this.outerEnumDefaultValue = b.outerEnumDefaultValue; + this.outerEnumIntegerDefaultValue = b.outerEnumIntegerDefaultValue; + } + + public EnumTest() { + } + + @JsonCreator + public EnumTest( + @JsonProperty(required = true, value = "enum_string_required") EnumStringRequiredEnum enumStringRequired + ) { + this.enumStringRequired = enumStringRequired; + } + + /** + **/ + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + + @Schema(description = "") + @JsonProperty("enum_string") + public EnumStringEnum getEnumString() { + return enumString; + } + + @JsonProperty("enum_string") + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + /** + **/ + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "enum_string_required") + @NotNull public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + @JsonProperty(required = true, value = "enum_string_required") + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + /** + **/ + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + + @Schema(description = "") + @JsonProperty("enum_integer") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + @JsonProperty("enum_integer") + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + /** + **/ + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + + @Schema(description = "") + @JsonProperty("enum_number") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + @JsonProperty("enum_number") + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + /** + **/ + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + + @Schema(description = "") + @JsonProperty("outerEnum") + public OuterEnum getOuterEnum() { + return outerEnum; + } + + @JsonProperty("outerEnum") + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + /** + **/ + public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return this; + } + + + @Schema(description = "") + @JsonProperty("outerEnumInteger") + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + @JsonProperty("outerEnumInteger") + public void setOuterEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + /** + **/ + public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + + @Schema(description = "") + @JsonProperty("outerEnumDefaultValue") + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + @JsonProperty("outerEnumDefaultValue") + public void setOuterEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + /** + **/ + public EnumTest outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + + @Schema(description = "") + @JsonProperty("outerEnumIntegerDefaultValue") + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + @JsonProperty("outerEnumIntegerDefaultValue") + public void setOuterEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum) && + Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) && + Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) && + Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static EnumTestBuilder builder() { + return new EnumTestBuilderImpl(); + } + + private static final class EnumTestBuilderImpl extends EnumTestBuilder { + + @Override + protected EnumTestBuilderImpl self() { + return this; + } + + @Override + public EnumTest build() { + return new EnumTest(this); + } + } + + public static abstract class EnumTestBuilder> { + private EnumStringEnum enumString; + private EnumStringRequiredEnum enumStringRequired; + private EnumIntegerEnum enumInteger; + private EnumNumberEnum enumNumber; + private OuterEnum outerEnum; + private OuterEnumInteger outerEnumInteger; + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + protected abstract B self(); + + public abstract C build(); + + public B enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return self(); + } + public B enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return self(); + } + public B enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return self(); + } + public B enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return self(); + } + public B outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return self(); + } + public B outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return self(); + } + public B outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return self(); + } + public B outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java new file mode 100644 index 000000000000..3e1be0fc9cb1 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,165 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("fakeBigDecimalMap_200_response") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeBigDecimalMap200Response implements Serializable { + private BigDecimal someId; + private @Valid Map someMap = new HashMap<>(); + + protected FakeBigDecimalMap200Response(FakeBigDecimalMap200ResponseBuilder b) { + this.someId = b.someId; + this.someMap = b.someMap; + } + + public FakeBigDecimalMap200Response() { + } + + /** + **/ + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + this.someId = someId; + return this; + } + + + @Schema(description = "") + @JsonProperty("someId") + @Valid public BigDecimal getSomeId() { + return someId; + } + + @JsonProperty("someId") + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + /** + **/ + public FakeBigDecimalMap200Response someMap(Map someMap) { + this.someMap = someMap; + return this; + } + + + @Schema(description = "") + @JsonProperty("someMap") + @Valid public Map getSomeMap() { + return someMap; + } + + @JsonProperty("someMap") + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + + this.someMap.put(key, someMapItem); + return this; + } + + public FakeBigDecimalMap200Response removeSomeMapItem(String key) { + if (this.someMap != null) { + this.someMap.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FakeBigDecimalMap200ResponseBuilder builder() { + return new FakeBigDecimalMap200ResponseBuilderImpl(); + } + + private static final class FakeBigDecimalMap200ResponseBuilderImpl extends FakeBigDecimalMap200ResponseBuilder { + + @Override + protected FakeBigDecimalMap200ResponseBuilderImpl self() { + return this; + } + + @Override + public FakeBigDecimalMap200Response build() { + return new FakeBigDecimalMap200Response(this); + } + } + + public static abstract class FakeBigDecimalMap200ResponseBuilder> { + private BigDecimal someId; + private Map someMap = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B someId(BigDecimal someId) { + this.someId = someId; + return self(); + } + public B someMap(Map someMap) { + this.someMap = someMap; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java new file mode 100644 index 000000000000..04b9f8e8cfbe --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java @@ -0,0 +1,298 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.IntegerEnum; +import org.openapitools.model.StringEnum; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("fake_tests_defaults_default_response") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeTestsDefaultsDefaultResponse implements Serializable { + private StringEnum stringEnum = StringEnum.FOO; + private IntegerEnum integerEnum = IntegerEnum.NUMBER_1; + public enum StringEnumInlineEnum { + + FOO(String.valueOf("foo")), BAR(String.valueOf("bar")), BAZ(String.valueOf("baz")); + + + private String value; + + StringEnumInlineEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StringEnumInlineEnum fromString(String s) { + for (StringEnumInlineEnum b : StringEnumInlineEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static StringEnumInlineEnum fromValue(String value) { + for (StringEnumInlineEnum b : StringEnumInlineEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private StringEnumInlineEnum stringEnumInline = StringEnumInlineEnum.FOO; + public enum IntegerEnumInlineEnum { + + NUMBER_1(Integer.valueOf(1)), NUMBER_2(Integer.valueOf(2)), NUMBER_3(Integer.valueOf(3)); + + + private Integer value; + + IntegerEnumInlineEnum (Integer v) { + value = v; + } + + public Integer value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static IntegerEnumInlineEnum fromString(String s) { + for (IntegerEnumInlineEnum b : IntegerEnumInlineEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static IntegerEnumInlineEnum fromValue(Integer value) { + for (IntegerEnumInlineEnum b : IntegerEnumInlineEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private IntegerEnumInlineEnum integerEnumInline = IntegerEnumInlineEnum.NUMBER_1; + + protected FakeTestsDefaultsDefaultResponse(FakeTestsDefaultsDefaultResponseBuilder b) { + this.stringEnum = b.stringEnum; + this.integerEnum = b.integerEnum; + this.stringEnumInline = b.stringEnumInline; + this.integerEnumInline = b.integerEnumInline; + } + + public FakeTestsDefaultsDefaultResponse() { + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse stringEnum(StringEnum stringEnum) { + this.stringEnum = stringEnum; + return this; + } + + + @Schema(description = "") + @JsonProperty("stringEnum") + public StringEnum getStringEnum() { + return stringEnum; + } + + @JsonProperty("stringEnum") + public void setStringEnum(StringEnum stringEnum) { + this.stringEnum = stringEnum; + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse integerEnum(IntegerEnum integerEnum) { + this.integerEnum = integerEnum; + return this; + } + + + @Schema(description = "") + @JsonProperty("integerEnum") + public IntegerEnum getIntegerEnum() { + return integerEnum; + } + + @JsonProperty("integerEnum") + public void setIntegerEnum(IntegerEnum integerEnum) { + this.integerEnum = integerEnum; + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse stringEnumInline(StringEnumInlineEnum stringEnumInline) { + this.stringEnumInline = stringEnumInline; + return this; + } + + + @Schema(description = "") + @JsonProperty("stringEnumInline") + public StringEnumInlineEnum getStringEnumInline() { + return stringEnumInline; + } + + @JsonProperty("stringEnumInline") + public void setStringEnumInline(StringEnumInlineEnum stringEnumInline) { + this.stringEnumInline = stringEnumInline; + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse integerEnumInline(IntegerEnumInlineEnum integerEnumInline) { + this.integerEnumInline = integerEnumInline; + return this; + } + + + @Schema(description = "") + @JsonProperty("integerEnumInline") + public IntegerEnumInlineEnum getIntegerEnumInline() { + return integerEnumInline; + } + + @JsonProperty("integerEnumInline") + public void setIntegerEnumInline(IntegerEnumInlineEnum integerEnumInline) { + this.integerEnumInline = integerEnumInline; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeTestsDefaultsDefaultResponse fakeTestsDefaultsDefaultResponse = (FakeTestsDefaultsDefaultResponse) o; + return Objects.equals(this.stringEnum, fakeTestsDefaultsDefaultResponse.stringEnum) && + Objects.equals(this.integerEnum, fakeTestsDefaultsDefaultResponse.integerEnum) && + Objects.equals(this.stringEnumInline, fakeTestsDefaultsDefaultResponse.stringEnumInline) && + Objects.equals(this.integerEnumInline, fakeTestsDefaultsDefaultResponse.integerEnumInline); + } + + @Override + public int hashCode() { + return Objects.hash(stringEnum, integerEnum, stringEnumInline, integerEnumInline); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeTestsDefaultsDefaultResponse {\n"); + + sb.append(" stringEnum: ").append(toIndentedString(stringEnum)).append("\n"); + sb.append(" integerEnum: ").append(toIndentedString(integerEnum)).append("\n"); + sb.append(" stringEnumInline: ").append(toIndentedString(stringEnumInline)).append("\n"); + sb.append(" integerEnumInline: ").append(toIndentedString(integerEnumInline)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FakeTestsDefaultsDefaultResponseBuilder builder() { + return new FakeTestsDefaultsDefaultResponseBuilderImpl(); + } + + private static final class FakeTestsDefaultsDefaultResponseBuilderImpl extends FakeTestsDefaultsDefaultResponseBuilder { + + @Override + protected FakeTestsDefaultsDefaultResponseBuilderImpl self() { + return this; + } + + @Override + public FakeTestsDefaultsDefaultResponse build() { + return new FakeTestsDefaultsDefaultResponse(this); + } + } + + public static abstract class FakeTestsDefaultsDefaultResponseBuilder> { + private StringEnum stringEnum = StringEnum.FOO; + private IntegerEnum integerEnum = IntegerEnum.NUMBER_1; + private StringEnumInlineEnum stringEnumInline = StringEnumInlineEnum.FOO; + private IntegerEnumInlineEnum integerEnumInline = IntegerEnumInlineEnum.NUMBER_1; + protected abstract B self(); + + public abstract C build(); + + public B stringEnum(StringEnum stringEnum) { + this.stringEnum = stringEnum; + return self(); + } + public B integerEnum(IntegerEnum integerEnum) { + this.integerEnum = integerEnum; + return self(); + } + public B stringEnumInline(StringEnumInlineEnum stringEnumInline) { + this.stringEnumInline = stringEnumInline; + return self(); + } + public B integerEnumInline(IntegerEnumInlineEnum integerEnumInline) { + this.integerEnumInline = integerEnumInline; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..28ee5c23b271 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -0,0 +1,165 @@ +package org.openapitools.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.ModelFile; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("FileSchemaTestClass") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FileSchemaTestClass implements Serializable { + private ModelFile _file; + private @Valid List<@Valid ModelFile> files = new ArrayList<>(); + + protected FileSchemaTestClass(FileSchemaTestClassBuilder b) { + this._file = b._file; + this.files = b.files; + } + + public FileSchemaTestClass() { + } + + /** + **/ + public FileSchemaTestClass _file(ModelFile _file) { + this._file = _file; + return this; + } + + + @Schema(description = "") + @JsonProperty("file") + @Valid public ModelFile getFile() { + return _file; + } + + @JsonProperty("file") + public void setFile(ModelFile _file) { + this._file = _file; + } + + /** + **/ + public FileSchemaTestClass files(List<@Valid ModelFile> files) { + this.files = files; + return this; + } + + + @Schema(description = "") + @JsonProperty("files") + @Valid public List<@Valid ModelFile> getFiles() { + return files; + } + + @JsonProperty("files") + public void setFiles(List<@Valid ModelFile> files) { + this.files = files; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + + this.files.add(filesItem); + return this; + } + + public FileSchemaTestClass removeFilesItem(ModelFile filesItem) { + if (filesItem != null && this.files != null) { + this.files.remove(filesItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this._file, fileSchemaTestClass._file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(_file, files); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FileSchemaTestClassBuilder builder() { + return new FileSchemaTestClassBuilderImpl(); + } + + private static final class FileSchemaTestClassBuilderImpl extends FileSchemaTestClassBuilder { + + @Override + protected FileSchemaTestClassBuilderImpl self() { + return this; + } + + @Override + public FileSchemaTestClass build() { + return new FileSchemaTestClass(this); + } + } + + public static abstract class FileSchemaTestClassBuilder> { + private ModelFile _file; + private List files = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B _file(ModelFile _file) { + this._file = _file; + return self(); + } + public B files(List files) { + this.files = files; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Foo.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Foo.java new file mode 100644 index 000000000000..a7a3387c5593 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Foo.java @@ -0,0 +1,117 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Foo") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Foo implements Serializable { + private String bar = "bar"; + + protected Foo(FooBuilder b) { + this.bar = b.bar; + } + + public Foo() { + } + + /** + **/ + public Foo bar(String bar) { + this.bar = bar; + return this; + } + + + @Schema(description = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + + @JsonProperty("bar") + public void setBar(String bar) { + this.bar = bar; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Foo foo = (Foo) o; + return Objects.equals(this.bar, foo.bar); + } + + @Override + public int hashCode() { + return Objects.hash(bar); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FooBuilder builder() { + return new FooBuilderImpl(); + } + + private static final class FooBuilderImpl extends FooBuilder { + + @Override + protected FooBuilderImpl self() { + return this; + } + + @Override + public Foo build() { + return new Foo(this); + } + } + + public static abstract class FooBuilder> { + private String bar = "bar"; + protected abstract B self(); + + public abstract C build(); + + public B bar(String bar) { + this.bar = bar; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java new file mode 100644 index 000000000000..c08f51b6ac1a --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java @@ -0,0 +1,119 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.Foo; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("_foo_get_default_response") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FooGetDefaultResponse implements Serializable { + private Foo string; + + protected FooGetDefaultResponse(FooGetDefaultResponseBuilder b) { + this.string = b.string; + } + + public FooGetDefaultResponse() { + } + + /** + **/ + public FooGetDefaultResponse string(Foo string) { + this.string = string; + return this; + } + + + @Schema(description = "") + @JsonProperty("string") + @Valid public Foo getString() { + return string; + } + + @JsonProperty("string") + public void setString(Foo string) { + this.string = string; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FooGetDefaultResponseBuilder builder() { + return new FooGetDefaultResponseBuilderImpl(); + } + + private static final class FooGetDefaultResponseBuilderImpl extends FooGetDefaultResponseBuilder { + + @Override + protected FooGetDefaultResponseBuilderImpl self() { + return this; + } + + @Override + public FooGetDefaultResponse build() { + return new FooGetDefaultResponse(this); + } + } + + public static abstract class FooGetDefaultResponseBuilder> { + private Foo string; + protected abstract B self(); + + public abstract C build(); + + public B string(Foo string) { + this.string = string; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FormatTest.java new file mode 100644 index 000000000000..4b778c9dff4f --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/FormatTest.java @@ -0,0 +1,569 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.File; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.Date; +import java.util.UUID; +import org.joda.time.LocalDate; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("format_test") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FormatTest implements Serializable { + private Integer integer; + private Integer int32; + private Long int64; + private BigDecimal number; + private Float _float; + private Double _double; + private BigDecimal decimal; + private String string; + private byte[] _byte; + private File binary; + private LocalDate date; + private Date dateTime; + private UUID uuid; + private String password; + private String patternWithDigits; + private String patternWithDigitsAndDelimiter; + + protected FormatTest(FormatTestBuilder b) { + this.integer = b.integer; + this.int32 = b.int32; + this.int64 = b.int64; + this.number = b.number; + this._float = b._float; + this._double = b._double; + this.decimal = b.decimal; + this.string = b.string; + this._byte = b._byte; + this.binary = b.binary; + this.date = b.date; + this.dateTime = b.dateTime; + this.uuid = b.uuid; + this.password = b.password; + this.patternWithDigits = b.patternWithDigits; + this.patternWithDigitsAndDelimiter = b.patternWithDigitsAndDelimiter; + } + + public FormatTest() { + } + + @JsonCreator + public FormatTest( + @JsonProperty(required = true, value = "number") BigDecimal number, + @JsonProperty(required = true, value = "byte") byte[] _byte, + @JsonProperty(required = true, value = "date") LocalDate date, + @JsonProperty(required = true, value = "password") String password + ) { + this.number = number; + this._byte = _byte; + this.date = date; + this.password = password; + } + + /** + * minimum: 10 + * maximum: 100 + **/ + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + + @Schema(description = "") + @JsonProperty("integer") + @Min(10) @Max(100)public Integer getInteger() { + return integer; + } + + @JsonProperty("integer") + public void setInteger(Integer integer) { + this.integer = integer; + } + + /** + * minimum: 20 + * maximum: 200 + **/ + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + + @Schema(description = "") + @JsonProperty("int32") + @Min(20) @Max(200)public Integer getInt32() { + return int32; + } + + @JsonProperty("int32") + public void setInt32(Integer int32) { + this.int32 = int32; + } + + /** + **/ + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + + @Schema(description = "") + @JsonProperty("int64") + public Long getInt64() { + return int64; + } + + @JsonProperty("int64") + public void setInt64(Long int64) { + this.int64 = int64; + } + + /** + * minimum: 32.1 + * maximum: 543.2 + **/ + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "number") + @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2")public BigDecimal getNumber() { + return number; + } + + @JsonProperty(required = true, value = "number") + public void setNumber(BigDecimal number) { + this.number = number; + } + + /** + * minimum: 54.3 + * maximum: 987.6 + **/ + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + + @Schema(description = "") + @JsonProperty("float") + @DecimalMin("54.3") @DecimalMax("987.6")public Float getFloat() { + return _float; + } + + @JsonProperty("float") + public void setFloat(Float _float) { + this._float = _float; + } + + /** + * minimum: 67.8 + * maximum: 123.4 + **/ + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + + @Schema(description = "") + @JsonProperty("double") + @DecimalMin("67.8") @DecimalMax("123.4")public Double getDouble() { + return _double; + } + + @JsonProperty("double") + public void setDouble(Double _double) { + this._double = _double; + } + + /** + **/ + public FormatTest decimal(BigDecimal decimal) { + this.decimal = decimal; + return this; + } + + + @Schema(description = "") + @JsonProperty("decimal") + @Valid public BigDecimal getDecimal() { + return decimal; + } + + @JsonProperty("decimal") + public void setDecimal(BigDecimal decimal) { + this.decimal = decimal; + } + + /** + **/ + public FormatTest string(String string) { + this.string = string; + return this; + } + + + @Schema(description = "") + @JsonProperty("string") + @Pattern(regexp="/[a-z]/i")public String getString() { + return string; + } + + @JsonProperty("string") + public void setString(String string) { + this.string = string; + } + + /** + **/ + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "byte") + @NotNull public byte[] getByte() { + return _byte; + } + + @JsonProperty(required = true, value = "byte") + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + /** + **/ + public FormatTest binary(File binary) { + this.binary = binary; + return this; + } + + + @Schema(description = "") + @JsonProperty("binary") + public File getBinary() { + return binary; + } + + @JsonProperty("binary") + public void setBinary(File binary) { + this.binary = binary; + } + + /** + **/ + public FormatTest date(LocalDate date) { + this.date = date; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "date") + @NotNull public LocalDate getDate() { + return date; + } + + @JsonProperty(required = true, value = "date") + public void setDate(LocalDate date) { + this.date = date; + } + + /** + **/ + public FormatTest dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + + @Schema(description = "") + @JsonProperty("dateTime") + public Date getDateTime() { + return dateTime; + } + + @JsonProperty("dateTime") + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + + @Schema(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", description = "") + @JsonProperty("uuid") + public UUID getUuid() { + return uuid; + } + + @JsonProperty("uuid") + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + /** + **/ + public FormatTest password(String password) { + this.password = password; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "password") + @NotNull @Size(min=10,max=64)public String getPassword() { + return password; + } + + @JsonProperty(required = true, value = "password") + public void setPassword(String password) { + this.password = password; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + **/ + public FormatTest patternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return this; + } + + + @Schema(description = "A string that is a 10 digit number. Can have leading zeros.") + @JsonProperty("pattern_with_digits") + @Pattern(regexp="^\\d{10}$")public String getPatternWithDigits() { + return patternWithDigits; + } + + @JsonProperty("pattern_with_digits") + public void setPatternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + **/ + public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + + @Schema(description = "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + @JsonProperty("pattern_with_digits_and_delimiter") + @Pattern(regexp="/^image_\\d{1,3}$/i")public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + @JsonProperty("pattern_with_digits_and_delimiter") + public void setPatternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.decimal, formatTest.decimal) && + Objects.equals(this.string, formatTest.string) && + Arrays.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password) && + Objects.equals(this.patternWithDigits, formatTest.patternWithDigits) && + Objects.equals(this.patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, decimal, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" decimal: ").append(toIndentedString(decimal)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append("*").append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FormatTestBuilder builder() { + return new FormatTestBuilderImpl(); + } + + private static final class FormatTestBuilderImpl extends FormatTestBuilder { + + @Override + protected FormatTestBuilderImpl self() { + return this; + } + + @Override + public FormatTest build() { + return new FormatTest(this); + } + } + + public static abstract class FormatTestBuilder> { + private Integer integer; + private Integer int32; + private Long int64; + private BigDecimal number; + private Float _float; + private Double _double; + private BigDecimal decimal; + private String string; + private byte[] _byte; + private File binary; + private LocalDate date; + private Date dateTime; + private UUID uuid; + private String password; + private String patternWithDigits; + private String patternWithDigitsAndDelimiter; + protected abstract B self(); + + public abstract C build(); + + public B integer(Integer integer) { + this.integer = integer; + return self(); + } + public B int32(Integer int32) { + this.int32 = int32; + return self(); + } + public B int64(Long int64) { + this.int64 = int64; + return self(); + } + public B number(BigDecimal number) { + this.number = number; + return self(); + } + public B _float(Float _float) { + this._float = _float; + return self(); + } + public B _double(Double _double) { + this._double = _double; + return self(); + } + public B decimal(BigDecimal decimal) { + this.decimal = decimal; + return self(); + } + public B string(String string) { + this.string = string; + return self(); + } + public B _byte(byte[] _byte) { + this._byte = _byte; + return self(); + } + public B binary(File binary) { + this.binary = binary; + return self(); + } + public B date(LocalDate date) { + this.date = date; + return self(); + } + public B dateTime(Date dateTime) { + this.dateTime = dateTime; + return self(); + } + public B uuid(UUID uuid) { + this.uuid = uuid; + return self(); + } + public B password(String password) { + this.password = password; + return self(); + } + public B patternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return self(); + } + public B patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..097f215e4002 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -0,0 +1,146 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("hasOnlyReadOnly") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class HasOnlyReadOnly implements Serializable { + private String bar; + private String foo; + + protected HasOnlyReadOnly(HasOnlyReadOnlyBuilder b) { + this.bar = b.bar; + this.foo = b.foo; + } + + public HasOnlyReadOnly() { + } + + /** + **/ + public HasOnlyReadOnly bar(String bar) { + this.bar = bar; + return this; + } + + + @Schema(description = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + + @JsonProperty("bar") + public void setBar(String bar) { + this.bar = bar; + } + + /** + **/ + public HasOnlyReadOnly foo(String foo) { + this.foo = foo; + return this; + } + + + @Schema(description = "") + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + @JsonProperty("foo") + public void setFoo(String foo) { + this.foo = foo; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HasOnlyReadOnlyBuilder builder() { + return new HasOnlyReadOnlyBuilderImpl(); + } + + private static final class HasOnlyReadOnlyBuilderImpl extends HasOnlyReadOnlyBuilder { + + @Override + protected HasOnlyReadOnlyBuilderImpl self() { + return this; + } + + @Override + public HasOnlyReadOnly build() { + return new HasOnlyReadOnly(this); + } + } + + public static abstract class HasOnlyReadOnlyBuilder> { + private String bar; + private String foo; + protected abstract B self(); + + public abstract C build(); + + public B bar(String bar) { + this.bar = bar; + return self(); + } + public B foo(String foo) { + this.foo = foo; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/HealthCheckResult.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/HealthCheckResult.java new file mode 100644 index 000000000000..7239283a0895 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/HealthCheckResult.java @@ -0,0 +1,120 @@ +package org.openapitools.model; + +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + **/ + +@Schema(description="Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.") +@JsonTypeName("HealthCheckResult") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class HealthCheckResult implements Serializable { + private String nullableMessage; + + protected HealthCheckResult(HealthCheckResultBuilder b) { + this.nullableMessage = b.nullableMessage; + } + + public HealthCheckResult() { + } + + /** + **/ + public HealthCheckResult nullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + return this; + } + + + @Schema(description = "") + @JsonProperty("NullableMessage") + public String getNullableMessage() { + return nullableMessage; + } + + @JsonProperty("NullableMessage") + public void setNullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return Objects.equals(this.nullableMessage, healthCheckResult.nullableMessage); + } + + @Override + public int hashCode() { + return Objects.hash(nullableMessage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HealthCheckResultBuilder builder() { + return new HealthCheckResultBuilderImpl(); + } + + private static final class HealthCheckResultBuilderImpl extends HealthCheckResultBuilder { + + @Override + protected HealthCheckResultBuilderImpl self() { + return this; + } + + @Override + public HealthCheckResult build() { + return new HealthCheckResult(this); + } + } + + public static abstract class HealthCheckResultBuilder> { + private String nullableMessage; + protected abstract B self(); + + public abstract C build(); + + public B nullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/IntegerEnum.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/IntegerEnum.java new file mode 100644 index 000000000000..9088bda557ef --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/IntegerEnum.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets IntegerEnum + */ +public enum IntegerEnum { + + NUMBER_1(1), + + NUMBER_2(2), + + NUMBER_3(3); + + private Integer value; + + IntegerEnum(Integer value) { + this.value = value; + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static IntegerEnum fromString(String s) { + for (IntegerEnum b : IntegerEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static IntegerEnum fromValue(Integer value) { + for (IntegerEnum b : IntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/MapTest.java new file mode 100644 index 000000000000..4ff129e77d26 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/MapTest.java @@ -0,0 +1,314 @@ +package org.openapitools.model; + +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("MapTest") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class MapTest implements Serializable { + private @Valid Map> mapMapOfString = new HashMap<>(); + public enum InnerEnum { + + UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")); + + + private String value; + + InnerEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static InnerEnum fromString(String s) { + for (InnerEnum b : InnerEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static InnerEnum fromValue(String value) { + for (InnerEnum b : InnerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private @Valid Map mapOfEnumString = new HashMap<>(); + private @Valid Map directMap = new HashMap<>(); + private @Valid Map indirectMap = new HashMap<>(); + + protected MapTest(MapTestBuilder b) { + this.mapMapOfString = b.mapMapOfString; + this.mapOfEnumString = b.mapOfEnumString; + this.directMap = b.directMap; + this.indirectMap = b.indirectMap; + } + + public MapTest() { + } + + /** + **/ + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + + @Schema(description = "") + @JsonProperty("map_map_of_string") + public Map> getMapMapOfString() { + return mapMapOfString; + } + + @JsonProperty("map_map_of_string") + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap<>(); + } + + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + public MapTest removeMapMapOfStringItem(String key) { + if (this.mapMapOfString != null) { + this.mapMapOfString.remove(key); + } + + return this; + } + /** + **/ + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + + @Schema(description = "") + @JsonProperty("map_of_enum_string") + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + @JsonProperty("map_of_enum_string") + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap<>(); + } + + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + public MapTest removeMapOfEnumStringItem(String key) { + if (this.mapOfEnumString != null) { + this.mapOfEnumString.remove(key); + } + + return this; + } + /** + **/ + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + + @Schema(description = "") + @JsonProperty("direct_map") + public Map getDirectMap() { + return directMap; + } + + @JsonProperty("direct_map") + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap<>(); + } + + this.directMap.put(key, directMapItem); + return this; + } + + public MapTest removeDirectMapItem(String key) { + if (this.directMap != null) { + this.directMap.remove(key); + } + + return this; + } + /** + **/ + public MapTest indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + + @Schema(description = "") + @JsonProperty("indirect_map") + public Map getIndirectMap() { + return indirectMap; + } + + @JsonProperty("indirect_map") + public void setIndirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + + this.indirectMap.put(key, indirectMapItem); + return this; + } + + public MapTest removeIndirectMapItem(String key) { + if (this.indirectMap != null) { + this.indirectMap.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static MapTestBuilder builder() { + return new MapTestBuilderImpl(); + } + + private static final class MapTestBuilderImpl extends MapTestBuilder { + + @Override + protected MapTestBuilderImpl self() { + return this; + } + + @Override + public MapTest build() { + return new MapTest(this); + } + } + + public static abstract class MapTestBuilder> { + private Map> mapMapOfString = new HashMap<>(); + private Map mapOfEnumString = new HashMap<>(); + private Map directMap = new HashMap<>(); + private Map indirectMap = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return self(); + } + public B mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return self(); + } + public B directMap(Map directMap) { + this.directMap = directMap; + return self(); + } + public B indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..83520d738599 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,194 @@ +package org.openapitools.model; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.model.Animal; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("MixedPropertiesAndAdditionalPropertiesClass") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class MixedPropertiesAndAdditionalPropertiesClass implements Serializable { + private UUID uuid; + private Date dateTime; + private @Valid Map map = new HashMap<>(); + + protected MixedPropertiesAndAdditionalPropertiesClass(MixedPropertiesAndAdditionalPropertiesClassBuilder b) { + this.uuid = b.uuid; + this.dateTime = b.dateTime; + this.map = b.map; + } + + public MixedPropertiesAndAdditionalPropertiesClass() { + } + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + + @Schema(description = "") + @JsonProperty("uuid") + public UUID getUuid() { + return uuid; + } + + @JsonProperty("uuid") + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + + @Schema(description = "") + @JsonProperty("dateTime") + public Date getDateTime() { + return dateTime; + } + + @JsonProperty("dateTime") + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + + @Schema(description = "") + @JsonProperty("map") + @Valid public Map getMap() { + return map; + } + + @JsonProperty("map") + public void setMap(Map map) { + this.map = map; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap<>(); + } + + this.map.put(key, mapItem); + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(String key) { + if (this.map != null) { + this.map.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static MixedPropertiesAndAdditionalPropertiesClassBuilder builder() { + return new MixedPropertiesAndAdditionalPropertiesClassBuilderImpl(); + } + + private static final class MixedPropertiesAndAdditionalPropertiesClassBuilderImpl extends MixedPropertiesAndAdditionalPropertiesClassBuilder { + + @Override + protected MixedPropertiesAndAdditionalPropertiesClassBuilderImpl self() { + return this; + } + + @Override + public MixedPropertiesAndAdditionalPropertiesClass build() { + return new MixedPropertiesAndAdditionalPropertiesClass(this); + } + } + + public static abstract class MixedPropertiesAndAdditionalPropertiesClassBuilder> { + private UUID uuid; + private Date dateTime; + private Map map = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B uuid(UUID uuid) { + this.uuid = uuid; + return self(); + } + public B dateTime(Date dateTime) { + this.dateTime = dateTime; + return self(); + } + public B map(Map map) { + this.map = map; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Model200Response.java new file mode 100644 index 000000000000..1ee640912918 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Model200Response.java @@ -0,0 +1,148 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing model name starting with number + **/ + +@Schema(description="Model for testing model name starting with number") +@JsonTypeName("200_response") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Model200Response implements Serializable { + private Integer name; + private String propertyClass; + + protected Model200Response(Model200ResponseBuilder b) { + this.name = b.name; + this.propertyClass = b.propertyClass; + } + + public Model200Response() { + } + + /** + **/ + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + + @Schema(description = "") + @JsonProperty("name") + public Integer getName() { + return name; + } + + @JsonProperty("name") + public void setName(Integer name) { + this.name = name; + } + + /** + **/ + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + + @Schema(description = "") + @JsonProperty("class") + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty("class") + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static Model200ResponseBuilder builder() { + return new Model200ResponseBuilderImpl(); + } + + private static final class Model200ResponseBuilderImpl extends Model200ResponseBuilder { + + @Override + protected Model200ResponseBuilderImpl self() { + return this; + } + + @Override + public Model200Response build() { + return new Model200Response(this); + } + } + + public static abstract class Model200ResponseBuilder> { + private Integer name; + private String propertyClass; + protected abstract B self(); + + public abstract C build(); + + public B name(Integer name) { + this.name = name; + return self(); + } + public B propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelApiResponse.java new file mode 100644 index 000000000000..ba8efa0a16a1 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -0,0 +1,174 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ApiResponse") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelApiResponse implements Serializable { + private Integer code; + private String type; + private String message; + + protected ModelApiResponse(ModelApiResponseBuilder b) { + this.code = b.code; + this.type = b.type; + this.message = b.message; + } + + public ModelApiResponse() { + } + + /** + **/ + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + + @Schema(description = "") + @JsonProperty("code") + public Integer getCode() { + return code; + } + + @JsonProperty("code") + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + + @Schema(description = "") + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + /** + **/ + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + + @Schema(description = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + + @JsonProperty("message") + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelApiResponseBuilder builder() { + return new ModelApiResponseBuilderImpl(); + } + + private static final class ModelApiResponseBuilderImpl extends ModelApiResponseBuilder { + + @Override + protected ModelApiResponseBuilderImpl self() { + return this; + } + + @Override + public ModelApiResponse build() { + return new ModelApiResponse(this); + } + } + + public static abstract class ModelApiResponseBuilder> { + private Integer code; + private String type; + private String message; + protected abstract B self(); + + public abstract C build(); + + public B code(Integer code) { + this.code = code; + return self(); + } + public B type(String type) { + this.type = type; + return self(); + } + public B message(String message) { + this.message = message; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelFile.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelFile.java new file mode 100644 index 000000000000..f813e6b9c2fe --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelFile.java @@ -0,0 +1,121 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Must be named `File` for test. + **/ + +@Schema(description="Must be named `File` for test.") +@JsonTypeName("File") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelFile implements Serializable { + private String sourceURI; + + protected ModelFile(ModelFileBuilder b) { + this.sourceURI = b.sourceURI; + } + + public ModelFile() { + } + + /** + * Test capitalization + **/ + public ModelFile sourceURI(String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + + @Schema(description = "Test capitalization") + @JsonProperty("sourceURI") + public String getSourceURI() { + return sourceURI; + } + + @JsonProperty("sourceURI") + public void setSourceURI(String sourceURI) { + this.sourceURI = sourceURI; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelFile _file = (ModelFile) o; + return Objects.equals(this.sourceURI, _file.sourceURI); + } + + @Override + public int hashCode() { + return Objects.hash(sourceURI); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelFileBuilder builder() { + return new ModelFileBuilderImpl(); + } + + private static final class ModelFileBuilderImpl extends ModelFileBuilder { + + @Override + protected ModelFileBuilderImpl self() { + return this; + } + + @Override + public ModelFile build() { + return new ModelFile(this); + } + } + + public static abstract class ModelFileBuilder> { + private String sourceURI; + protected abstract B self(); + + public abstract C build(); + + public B sourceURI(String sourceURI) { + this.sourceURI = sourceURI; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelList.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelList.java new file mode 100644 index 000000000000..715a840e82d9 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelList.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("List") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelList implements Serializable { + private String _123list; + + protected ModelList(ModelListBuilder b) { + this._123list = b._123list; + } + + public ModelList() { + } + + /** + **/ + public ModelList _123list(String _123list) { + this._123list = _123list; + return this; + } + + + @Schema(description = "") + @JsonProperty("123-list") + public String get123list() { + return _123list; + } + + @JsonProperty("123-list") + public void set123list(String _123list) { + this._123list = _123list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelList _list = (ModelList) o; + return Objects.equals(this._123list, _list._123list); + } + + @Override + public int hashCode() { + return Objects.hash(_123list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + + sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelListBuilder builder() { + return new ModelListBuilderImpl(); + } + + private static final class ModelListBuilderImpl extends ModelListBuilder { + + @Override + protected ModelListBuilderImpl self() { + return this; + } + + @Override + public ModelList build() { + return new ModelList(this); + } + } + + public static abstract class ModelListBuilder> { + private String _123list; + protected abstract B self(); + + public abstract C build(); + + public B _123list(String _123list) { + this._123list = _123list; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelReturn.java new file mode 100644 index 000000000000..6382984af112 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ModelReturn.java @@ -0,0 +1,120 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing reserved words + **/ + +@Schema(description="Model for testing reserved words") +@JsonTypeName("Return") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelReturn implements Serializable { + private Integer _return; + + protected ModelReturn(ModelReturnBuilder b) { + this._return = b._return; + } + + public ModelReturn() { + } + + /** + **/ + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + + @Schema(description = "") + @JsonProperty("return") + public Integer getReturn() { + return _return; + } + + @JsonProperty("return") + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelReturnBuilder builder() { + return new ModelReturnBuilderImpl(); + } + + private static final class ModelReturnBuilderImpl extends ModelReturnBuilder { + + @Override + protected ModelReturnBuilderImpl self() { + return this; + } + + @Override + public ModelReturn build() { + return new ModelReturn(this); + } + } + + public static abstract class ModelReturnBuilder> { + private Integer _return; + protected abstract B self(); + + public abstract C build(); + + public B _return(Integer _return) { + this._return = _return; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Name.java new file mode 100644 index 000000000000..3e3abc2fa325 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Name.java @@ -0,0 +1,210 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing model name same as property name + **/ + +@Schema(description="Model for testing model name same as property name") +@JsonTypeName("Name") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Name implements Serializable { + private Integer name; + private Integer snakeCase; + private String property; + private Integer _123number; + + protected Name(NameBuilder b) { + this.name = b.name; + this.snakeCase = b.snakeCase; + this.property = b.property; + this._123number = b._123number; + } + + public Name() { + } + + @JsonCreator + public Name( + @JsonProperty(required = true, value = "name") Integer name + ) { + this.name = name; + } + + /** + **/ + public Name name(Integer name) { + this.name = name; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "name") + @NotNull public Integer getName() { + return name; + } + + @JsonProperty(required = true, value = "name") + public void setName(Integer name) { + this.name = name; + } + + /** + **/ + public Name snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return this; + } + + + @Schema(description = "") + @JsonProperty("snake_case") + public Integer getSnakeCase() { + return snakeCase; + } + + @JsonProperty("snake_case") + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + + /** + **/ + public Name property(String property) { + this.property = property; + return this; + } + + + @Schema(description = "") + @JsonProperty("property") + public String getProperty() { + return property; + } + + @JsonProperty("property") + public void setProperty(String property) { + this.property = property; + } + + /** + **/ + public Name _123number(Integer _123number) { + this._123number = _123number; + return this; + } + + + @Schema(description = "") + @JsonProperty("123Number") + public Integer get123number() { + return _123number; + } + + @JsonProperty("123Number") + public void set123number(Integer _123number) { + this._123number = _123number; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static NameBuilder builder() { + return new NameBuilderImpl(); + } + + private static final class NameBuilderImpl extends NameBuilder { + + @Override + protected NameBuilderImpl self() { + return this; + } + + @Override + public Name build() { + return new Name(this); + } + } + + public static abstract class NameBuilder> { + private Integer name; + private Integer snakeCase; + private String property; + private Integer _123number; + protected abstract B self(); + + public abstract C build(); + + public B name(Integer name) { + this.name = name; + return self(); + } + public B snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return self(); + } + public B property(String property) { + this.property = property; + return self(); + } + public B _123number(Integer _123number) { + this._123number = _123number; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/NullableClass.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/NullableClass.java new file mode 100644 index 000000000000..4d131695e54b --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/NullableClass.java @@ -0,0 +1,433 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.joda.time.LocalDate; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("NullableClass") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class NullableClass extends HashMap implements Serializable { + private Integer integerProp; + private BigDecimal numberProp; + private Boolean booleanProp; + private String stringProp; + private LocalDate dateProp; + private Date datetimeProp; + private @Valid List arrayNullableProp; + private @Valid List arrayAndItemsNullableProp; + private @Valid List arrayItemsNullable = new ArrayList<>(); + private @Valid Map objectNullableProp; + private @Valid Map objectAndItemsNullableProp; + private @Valid Map objectItemsNullable = new HashMap<>(); + + public NullableClass() { + } + + /** + **/ + public NullableClass integerProp(Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("integer_prop") + public Integer getIntegerProp() { + return integerProp; + } + + @JsonProperty("integer_prop") + public void setIntegerProp(Integer integerProp) { + this.integerProp = integerProp; + } + + /** + **/ + public NullableClass numberProp(BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("number_prop") + @Valid public BigDecimal getNumberProp() { + return numberProp; + } + + @JsonProperty("number_prop") + public void setNumberProp(BigDecimal numberProp) { + this.numberProp = numberProp; + } + + /** + **/ + public NullableClass booleanProp(Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("boolean_prop") + public Boolean getBooleanProp() { + return booleanProp; + } + + @JsonProperty("boolean_prop") + public void setBooleanProp(Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + /** + **/ + public NullableClass stringProp(String stringProp) { + this.stringProp = stringProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("string_prop") + public String getStringProp() { + return stringProp; + } + + @JsonProperty("string_prop") + public void setStringProp(String stringProp) { + this.stringProp = stringProp; + } + + /** + **/ + public NullableClass dateProp(LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("date_prop") + public LocalDate getDateProp() { + return dateProp; + } + + @JsonProperty("date_prop") + public void setDateProp(LocalDate dateProp) { + this.dateProp = dateProp; + } + + /** + **/ + public NullableClass datetimeProp(Date datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("datetime_prop") + public Date getDatetimeProp() { + return datetimeProp; + } + + @JsonProperty("datetime_prop") + public void setDatetimeProp(Date datetimeProp) { + this.datetimeProp = datetimeProp; + } + + /** + **/ + public NullableClass arrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_nullable_prop") + public List getArrayNullableProp() { + return arrayNullableProp; + } + + @JsonProperty("array_nullable_prop") + public void setArrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + public NullableClass removeArrayNullablePropItem(Object arrayNullablePropItem) { + if (arrayNullablePropItem != null && this.arrayNullableProp != null) { + this.arrayNullableProp.remove(arrayNullablePropItem); + } + + return this; + } + /** + **/ + public NullableClass arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_and_items_nullable_prop") + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + @JsonProperty("array_and_items_nullable_prop") + public void setArrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + public NullableClass removeArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (arrayAndItemsNullablePropItem != null && this.arrayAndItemsNullableProp != null) { + this.arrayAndItemsNullableProp.remove(arrayAndItemsNullablePropItem); + } + + return this; + } + /** + **/ + public NullableClass arrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_items_nullable") + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + @JsonProperty("array_items_nullable") + public void setArrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + public NullableClass removeArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (arrayItemsNullableItem != null && this.arrayItemsNullable != null) { + this.arrayItemsNullable.remove(arrayItemsNullableItem); + } + + return this; + } + /** + **/ + public NullableClass objectNullableProp(Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("object_nullable_prop") + public Map getObjectNullableProp() { + return objectNullableProp; + } + + @JsonProperty("object_nullable_prop") + public void setObjectNullableProp(Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + public NullableClass removeObjectNullablePropItem(String key) { + if (this.objectNullableProp != null) { + this.objectNullableProp.remove(key); + } + + return this; + } + /** + **/ + public NullableClass objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("object_and_items_nullable_prop") + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + @JsonProperty("object_and_items_nullable_prop") + public void setObjectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + public NullableClass removeObjectAndItemsNullablePropItem(String key) { + if (this.objectAndItemsNullableProp != null) { + this.objectAndItemsNullableProp.remove(key); + } + + return this; + } + /** + **/ + public NullableClass objectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + return this; + } + + + @Schema(description = "") + @JsonProperty("object_items_nullable") + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + @JsonProperty("object_items_nullable") + public void setObjectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + if (this.objectItemsNullable == null) { + this.objectItemsNullable = new HashMap<>(); + } + + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + public NullableClass removeObjectItemsNullableItem(String key) { + if (this.objectItemsNullable != null) { + this.objectItemsNullable.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableClass nullableClass = (NullableClass) o; + return Objects.equals(this.integerProp, nullableClass.integerProp) && + Objects.equals(this.numberProp, nullableClass.numberProp) && + Objects.equals(this.booleanProp, nullableClass.booleanProp) && + Objects.equals(this.stringProp, nullableClass.stringProp) && + Objects.equals(this.dateProp, nullableClass.dateProp) && + Objects.equals(this.datetimeProp, nullableClass.datetimeProp) && + Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) && + Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) && + Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) && + Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) && + Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && + Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); + sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); + sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); + sb.append(" stringProp: ").append(toIndentedString(stringProp)).append("\n"); + sb.append(" dateProp: ").append(toIndentedString(dateProp)).append("\n"); + sb.append(" datetimeProp: ").append(toIndentedString(datetimeProp)).append("\n"); + sb.append(" arrayNullableProp: ").append(toIndentedString(arrayNullableProp)).append("\n"); + sb.append(" arrayAndItemsNullableProp: ").append(toIndentedString(arrayAndItemsNullableProp)).append("\n"); + sb.append(" arrayItemsNullable: ").append(toIndentedString(arrayItemsNullable)).append("\n"); + sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); + sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); + sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/NumberOnly.java new file mode 100644 index 000000000000..75e682baf206 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/NumberOnly.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("NumberOnly") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class NumberOnly implements Serializable { + private BigDecimal justNumber; + + protected NumberOnly(NumberOnlyBuilder b) { + this.justNumber = b.justNumber; + } + + public NumberOnly() { + } + + /** + **/ + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + + @Schema(description = "") + @JsonProperty("JustNumber") + @Valid public BigDecimal getJustNumber() { + return justNumber; + } + + @JsonProperty("JustNumber") + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static NumberOnlyBuilder builder() { + return new NumberOnlyBuilderImpl(); + } + + private static final class NumberOnlyBuilderImpl extends NumberOnlyBuilder { + + @Override + protected NumberOnlyBuilderImpl self() { + return this; + } + + @Override + public NumberOnly build() { + return new NumberOnly(this); + } + } + + public static abstract class NumberOnlyBuilder> { + private BigDecimal justNumber; + protected abstract B self(); + + public abstract C build(); + + public B justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java new file mode 100644 index 000000000000..849a00776b54 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java @@ -0,0 +1,222 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.DeprecatedObject; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ObjectWithDeprecatedFields") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ObjectWithDeprecatedFields implements Serializable { + private String uuid; + private BigDecimal id; + private DeprecatedObject deprecatedRef; + private @Valid List bars = new ArrayList<>(); + + protected ObjectWithDeprecatedFields(ObjectWithDeprecatedFieldsBuilder b) { + this.uuid = b.uuid; + this.id = b.id; + this.deprecatedRef = b.deprecatedRef; + this.bars = b.bars; + } + + public ObjectWithDeprecatedFields() { + } + + /** + **/ + public ObjectWithDeprecatedFields uuid(String uuid) { + this.uuid = uuid; + return this; + } + + + @Schema(description = "") + @JsonProperty("uuid") + public String getUuid() { + return uuid; + } + + @JsonProperty("uuid") + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + **/ + public ObjectWithDeprecatedFields id(BigDecimal id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + @Valid public BigDecimal getId() { + return id; + } + + @JsonProperty("id") + public void setId(BigDecimal id) { + this.id = id; + } + + /** + **/ + public ObjectWithDeprecatedFields deprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return this; + } + + + @Schema(description = "") + @JsonProperty("deprecatedRef") + @Valid public DeprecatedObject getDeprecatedRef() { + return deprecatedRef; + } + + @JsonProperty("deprecatedRef") + public void setDeprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + } + + /** + **/ + public ObjectWithDeprecatedFields bars(List bars) { + this.bars = bars; + return this; + } + + + @Schema(description = "") + @JsonProperty("bars") + public List getBars() { + return bars; + } + + @JsonProperty("bars") + public void setBars(List bars) { + this.bars = bars; + } + + public ObjectWithDeprecatedFields addBarsItem(String barsItem) { + if (this.bars == null) { + this.bars = new ArrayList<>(); + } + + this.bars.add(barsItem); + return this; + } + + public ObjectWithDeprecatedFields removeBarsItem(String barsItem) { + if (barsItem != null && this.bars != null) { + this.bars.remove(barsItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObjectWithDeprecatedFields objectWithDeprecatedFields = (ObjectWithDeprecatedFields) o; + return Objects.equals(this.uuid, objectWithDeprecatedFields.uuid) && + Objects.equals(this.id, objectWithDeprecatedFields.id) && + Objects.equals(this.deprecatedRef, objectWithDeprecatedFields.deprecatedRef) && + Objects.equals(this.bars, objectWithDeprecatedFields.bars); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, id, deprecatedRef, bars); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObjectWithDeprecatedFields {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" deprecatedRef: ").append(toIndentedString(deprecatedRef)).append("\n"); + sb.append(" bars: ").append(toIndentedString(bars)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ObjectWithDeprecatedFieldsBuilder builder() { + return new ObjectWithDeprecatedFieldsBuilderImpl(); + } + + private static final class ObjectWithDeprecatedFieldsBuilderImpl extends ObjectWithDeprecatedFieldsBuilder { + + @Override + protected ObjectWithDeprecatedFieldsBuilderImpl self() { + return this; + } + + @Override + public ObjectWithDeprecatedFields build() { + return new ObjectWithDeprecatedFields(this); + } + } + + public static abstract class ObjectWithDeprecatedFieldsBuilder> { + private String uuid; + private BigDecimal id; + private DeprecatedObject deprecatedRef; + private List bars = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B uuid(String uuid) { + this.uuid = uuid; + return self(); + } + public B id(BigDecimal id) { + this.id = id; + return self(); + } + public B deprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return self(); + } + public B bars(List bars) { + this.bars = bars; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Order.java new file mode 100644 index 000000000000..887639544ff0 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Order.java @@ -0,0 +1,306 @@ +package org.openapitools.model; + +import java.util.Date; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Order") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Order implements Serializable { + private Long id; + private Long petId; + private Integer quantity; + private Date shipDate; + public enum StatusEnum { + + PLACED(String.valueOf("placed")), APPROVED(String.valueOf("approved")), DELIVERED(String.valueOf("delivered")); + + + private String value; + + StatusEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StatusEnum fromString(String s) { + for (StatusEnum b : StatusEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private StatusEnum status; + private Boolean complete = false; + + protected Order(OrderBuilder b) { + this.id = b.id; + this.petId = b.petId; + this.quantity = b.quantity; + this.shipDate = b.shipDate; + this.status = b.status; + this.complete = b.complete; + } + + public Order() { + } + + /** + **/ + public Order id(Long id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + + @Schema(description = "") + @JsonProperty("petId") + public Long getPetId() { + return petId; + } + + @JsonProperty("petId") + public void setPetId(Long petId) { + this.petId = petId; + } + + /** + **/ + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + + @Schema(description = "") + @JsonProperty("quantity") + public Integer getQuantity() { + return quantity; + } + + @JsonProperty("quantity") + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + /** + **/ + public Order shipDate(Date shipDate) { + this.shipDate = shipDate; + return this; + } + + + @Schema(description = "") + @JsonProperty("shipDate") + public Date getShipDate() { + return shipDate; + } + + @JsonProperty("shipDate") + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + /** + * Order Status + **/ + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + + @Schema(description = "Order Status") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + + @JsonProperty("status") + public void setStatus(StatusEnum status) { + this.status = status; + } + + /** + **/ + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + + @Schema(description = "") + @JsonProperty("complete") + public Boolean getComplete() { + return complete; + } + + @JsonProperty("complete") + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static OrderBuilder builder() { + return new OrderBuilderImpl(); + } + + private static final class OrderBuilderImpl extends OrderBuilder { + + @Override + protected OrderBuilderImpl self() { + return this; + } + + @Override + public Order build() { + return new Order(this); + } + } + + public static abstract class OrderBuilder> { + private Long id; + private Long petId; + private Integer quantity; + private Date shipDate; + private StatusEnum status; + private Boolean complete = false; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B petId(Long petId) { + this.petId = petId; + return self(); + } + public B quantity(Integer quantity) { + this.quantity = quantity; + return self(); + } + public B shipDate(Date shipDate) { + this.shipDate = shipDate; + return self(); + } + public B status(StatusEnum status) { + this.status = status; + return self(); + } + public B complete(Boolean complete) { + this.complete = complete; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterComposite.java new file mode 100644 index 000000000000..4252a318c02e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterComposite.java @@ -0,0 +1,174 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("OuterComposite") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class OuterComposite implements Serializable { + private BigDecimal myNumber; + private String myString; + private Boolean myBoolean; + + protected OuterComposite(OuterCompositeBuilder b) { + this.myNumber = b.myNumber; + this.myString = b.myString; + this.myBoolean = b.myBoolean; + } + + public OuterComposite() { + } + + /** + **/ + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + + @Schema(description = "") + @JsonProperty("my_number") + @Valid public BigDecimal getMyNumber() { + return myNumber; + } + + @JsonProperty("my_number") + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + /** + **/ + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + + @Schema(description = "") + @JsonProperty("my_string") + public String getMyString() { + return myString; + } + + @JsonProperty("my_string") + public void setMyString(String myString) { + this.myString = myString; + } + + /** + **/ + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + + @Schema(description = "") + @JsonProperty("my_boolean") + public Boolean getMyBoolean() { + return myBoolean; + } + + @JsonProperty("my_boolean") + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static OuterCompositeBuilder builder() { + return new OuterCompositeBuilderImpl(); + } + + private static final class OuterCompositeBuilderImpl extends OuterCompositeBuilder { + + @Override + protected OuterCompositeBuilderImpl self() { + return this; + } + + @Override + public OuterComposite build() { + return new OuterComposite(this); + } + } + + public static abstract class OuterCompositeBuilder> { + private BigDecimal myNumber; + private String myString; + private Boolean myBoolean; + protected abstract B self(); + + public abstract C build(); + + public B myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return self(); + } + public B myString(String myString) { + this.myString = myString; + return self(); + } + public B myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnum.java new file mode 100644 index 000000000000..001c708516a7 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnum.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnum fromString(String s) { + for (OuterEnum b : OuterEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + return null; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..6d7342e85429 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumDefaultValue + */ +public enum OuterEnumDefaultValue { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnumDefaultValue(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumDefaultValue fromString(String s) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumDefaultValue fromValue(String value) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnumInteger.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnumInteger.java new file mode 100644 index 000000000000..8b77ac18385c --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnumInteger.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumInteger + */ +public enum OuterEnumInteger { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumInteger(Integer value) { + this.value = value; + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumInteger fromString(String s) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumInteger fromValue(Integer value) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..24a134960523 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumIntegerDefaultValue + */ +public enum OuterEnumIntegerDefaultValue { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumIntegerDefaultValue(Integer value) { + this.value = value; + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumIntegerDefaultValue fromString(String s) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumIntegerDefaultValue fromValue(Integer value) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java new file mode 100644 index 000000000000..8f9c2b9eb2c9 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java @@ -0,0 +1,125 @@ +package org.openapitools.model; + +import org.openapitools.model.OuterEnumInteger; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("OuterObjectWithEnumProperty") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class OuterObjectWithEnumProperty implements Serializable { + private OuterEnumInteger value; + + protected OuterObjectWithEnumProperty(OuterObjectWithEnumPropertyBuilder b) { + this.value = b.value; + } + + public OuterObjectWithEnumProperty() { + } + + @JsonCreator + public OuterObjectWithEnumProperty( + @JsonProperty(required = true, value = "value") OuterEnumInteger value + ) { + this.value = value; + } + + /** + **/ + public OuterObjectWithEnumProperty value(OuterEnumInteger value) { + this.value = value; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "value") + @NotNull public OuterEnumInteger getValue() { + return value; + } + + @JsonProperty(required = true, value = "value") + public void setValue(OuterEnumInteger value) { + this.value = value; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterObjectWithEnumProperty outerObjectWithEnumProperty = (OuterObjectWithEnumProperty) o; + return Objects.equals(this.value, outerObjectWithEnumProperty.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterObjectWithEnumProperty {\n"); + + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static OuterObjectWithEnumPropertyBuilder builder() { + return new OuterObjectWithEnumPropertyBuilderImpl(); + } + + private static final class OuterObjectWithEnumPropertyBuilderImpl extends OuterObjectWithEnumPropertyBuilder { + + @Override + protected OuterObjectWithEnumPropertyBuilderImpl self() { + return this; + } + + @Override + public OuterObjectWithEnumProperty build() { + return new OuterObjectWithEnumProperty(this); + } + } + + public static abstract class OuterObjectWithEnumPropertyBuilder> { + private OuterEnumInteger value; + protected abstract B self(); + + public abstract C build(); + + public B value(OuterEnumInteger value) { + this.value = value; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ParentWithNullable.java new file mode 100644 index 000000000000..0204c0dbf136 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ParentWithNullable.java @@ -0,0 +1,200 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChildWithNullable.class, name = "ChildWithNullable"), +}) + + +@Schema(description="") +@JsonTypeName("ParentWithNullable") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ParentWithNullable implements Serializable { + public enum TypeEnum { + + CHILD_WITH_NULLABLE(String.valueOf("ChildWithNullable")); + + + private String value; + + TypeEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static TypeEnum fromString(String s) { + for (TypeEnum b : TypeEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private TypeEnum type; + private String nullableProperty; + + protected ParentWithNullable(ParentWithNullableBuilder b) { + this.type = b.type; + this.nullableProperty = b.nullableProperty; + } + + public ParentWithNullable() { + } + + /** + **/ + public ParentWithNullable type(TypeEnum type) { + this.type = type; + return this; + } + + + @Schema(description = "") + @JsonProperty("type") + public TypeEnum getType() { + return type; + } + + @JsonProperty("type") + public void setType(TypeEnum type) { + this.type = type; + } + + /** + **/ + public ParentWithNullable nullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + return this; + } + + + @Schema(description = "") + @JsonProperty("nullableProperty") + public String getNullableProperty() { + return nullableProperty; + } + + @JsonProperty("nullableProperty") + public void setNullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParentWithNullable parentWithNullable = (ParentWithNullable) o; + return Objects.equals(this.type, parentWithNullable.type) && + Objects.equals(this.nullableProperty, parentWithNullable.nullableProperty); + } + + @Override + public int hashCode() { + return Objects.hash(type, nullableProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParentWithNullable {\n"); + + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" nullableProperty: ").append(toIndentedString(nullableProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ParentWithNullableBuilder builder() { + return new ParentWithNullableBuilderImpl(); + } + + private static final class ParentWithNullableBuilderImpl extends ParentWithNullableBuilder { + + @Override + protected ParentWithNullableBuilderImpl self() { + return this; + } + + @Override + public ParentWithNullable build() { + return new ParentWithNullable(this); + } + } + + public static abstract class ParentWithNullableBuilder> { + private TypeEnum type; + private String nullableProperty; + protected abstract B self(); + + public abstract C build(); + + public B type(TypeEnum type) { + this.type = type; + return self(); + } + public B nullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Pet.java new file mode 100644 index 000000000000..6e8fe3cb22a6 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Pet.java @@ -0,0 +1,355 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.model.Category; +import org.openapitools.model.Tag; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Pet") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Pet implements Serializable { + private Long id; + private Category category; + private String name; + private @Valid Set photoUrls = new LinkedHashSet<>(); + private @Valid List<@Valid Tag> tags = new ArrayList<>(); + public enum StatusEnum { + + AVAILABLE(String.valueOf("available")), PENDING(String.valueOf("pending")), SOLD(String.valueOf("sold")); + + + private String value; + + StatusEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StatusEnum fromString(String s) { + for (StatusEnum b : StatusEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private StatusEnum status; + + protected Pet(PetBuilder b) { + this.id = b.id; + this.category = b.category; + this.name = b.name; + this.photoUrls = b.photoUrls; + this.tags = b.tags; + this.status = b.status; + } + + public Pet() { + } + + @JsonCreator + public Pet( + @JsonProperty(required = true, value = "name") String name, + @JsonProperty(required = true, value = "photoUrls") Set photoUrls + ) { + this.name = name; + this.photoUrls = photoUrls; + } + + /** + **/ + public Pet id(Long id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Pet category(Category category) { + this.category = category; + return this; + } + + + @Schema(description = "") + @JsonProperty("category") + @Valid public Category getCategory() { + return category; + } + + @JsonProperty("category") + public void setCategory(Category category) { + this.category = category; + } + + /** + **/ + public Pet name(String name) { + this.name = name; + return this; + } + + + @Schema(example = "doggie", required = true, description = "") + @JsonProperty(required = true, value = "name") + @NotNull public String getName() { + return name; + } + + @JsonProperty(required = true, value = "name") + public void setName(String name) { + this.name = name; + } + + /** + **/ + public Pet photoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "photoUrls") + @NotNull public Set getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(required = true, value = "photoUrls") + @JsonDeserialize(as = LinkedHashSet.class) + public void setPhotoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new LinkedHashSet<>(); + } + + this.photoUrls.add(photoUrlsItem); + return this; + } + + public Pet removePhotoUrlsItem(String photoUrlsItem) { + if (photoUrlsItem != null && this.photoUrls != null) { + this.photoUrls.remove(photoUrlsItem); + } + + return this; + } + /** + **/ + public Pet tags(List<@Valid Tag> tags) { + this.tags = tags; + return this; + } + + + @Schema(description = "") + @JsonProperty("tags") + @Valid public List<@Valid Tag> getTags() { + return tags; + } + + @JsonProperty("tags") + public void setTags(List<@Valid Tag> tags) { + this.tags = tags; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + + this.tags.add(tagsItem); + return this; + } + + public Pet removeTagsItem(Tag tagsItem) { + if (tagsItem != null && this.tags != null) { + this.tags.remove(tagsItem); + } + + return this; + } + /** + * pet status in the store + **/ + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + + @Schema(description = "pet status in the store") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + + @JsonProperty("status") + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static PetBuilder builder() { + return new PetBuilderImpl(); + } + + private static final class PetBuilderImpl extends PetBuilder { + + @Override + protected PetBuilderImpl self() { + return this; + } + + @Override + public Pet build() { + return new Pet(this); + } + } + + public static abstract class PetBuilder> { + private Long id; + private Category category; + private String name; + private Set photoUrls = new LinkedHashSet<>(); + private List tags = new ArrayList<>(); + private StatusEnum status; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B category(Category category) { + this.category = category; + return self(); + } + public B name(String name) { + this.name = name; + return self(); + } + public B photoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + return self(); + } + public B tags(List tags) { + this.tags = tags; + return self(); + } + public B status(StatusEnum status) { + this.status = status; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..df92ae9af53c --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -0,0 +1,145 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ReadOnlyFirst") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ReadOnlyFirst implements Serializable { + private String bar; + private String baz; + + protected ReadOnlyFirst(ReadOnlyFirstBuilder b) { + this.bar = b.bar; + this.baz = b.baz; + } + + public ReadOnlyFirst() { + } + + /** + **/ + public ReadOnlyFirst bar(String bar) { + this.bar = bar; + return this; + } + + + @Schema(description = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + + @JsonProperty("bar") + public void setBar(String bar) { + this.bar = bar; + } + + /** + **/ + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + + @Schema(description = "") + @JsonProperty("baz") + public String getBaz() { + return baz; + } + + @JsonProperty("baz") + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ReadOnlyFirstBuilder builder() { + return new ReadOnlyFirstBuilderImpl(); + } + + private static final class ReadOnlyFirstBuilderImpl extends ReadOnlyFirstBuilder { + + @Override + protected ReadOnlyFirstBuilderImpl self() { + return this; + } + + @Override + public ReadOnlyFirst build() { + return new ReadOnlyFirst(this); + } + } + + public static abstract class ReadOnlyFirstBuilder> { + private String bar; + private String baz; + protected abstract B self(); + + public abstract C build(); + + public B bar(String bar) { + this.bar = bar; + return self(); + } + public B baz(String baz) { + this.baz = baz; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/SingleRefType.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/SingleRefType.java new file mode 100644 index 000000000000..15bee7583b1b --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/SingleRefType.java @@ -0,0 +1,57 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets SingleRefType + */ +public enum SingleRefType { + + ADMIN("admin"), + + USER("user"); + + private String value; + + SingleRefType(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static SingleRefType fromString(String s) { + for (SingleRefType b : SingleRefType.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SingleRefType fromValue(String value) { + for (SingleRefType b : SingleRefType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/SpecialModelName.java new file mode 100644 index 000000000000..88f1e41fc8b0 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("_special_model.name_") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class SpecialModelName implements Serializable { + private Long $specialPropertyName; + + protected SpecialModelName(SpecialModelNameBuilder b) { + this.$specialPropertyName = b.$specialPropertyName; + } + + public SpecialModelName() { + } + + /** + **/ + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + + @Schema(description = "") + @JsonProperty("$special[property.name]") + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + @JsonProperty("$special[property.name]") + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static SpecialModelNameBuilder builder() { + return new SpecialModelNameBuilderImpl(); + } + + private static final class SpecialModelNameBuilderImpl extends SpecialModelNameBuilder { + + @Override + protected SpecialModelNameBuilderImpl self() { + return this; + } + + @Override + public SpecialModelName build() { + return new SpecialModelName(this); + } + } + + public static abstract class SpecialModelNameBuilder> { + private Long $specialPropertyName; + protected abstract B self(); + + public abstract C build(); + + public B $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/StringEnum.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/StringEnum.java new file mode 100644 index 000000000000..cc6c86a1161e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/StringEnum.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets StringEnum + */ +public enum StringEnum { + + FOO("foo"), + + BAR("bar"), + + BAZ("baz"); + + private String value; + + StringEnum(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StringEnum fromString(String s) { + for (StringEnum b : StringEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StringEnum fromValue(String value) { + for (StringEnum b : StringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Tag.java new file mode 100644 index 000000000000..e94bf00580af --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/Tag.java @@ -0,0 +1,145 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Tag") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Tag implements Serializable { + private Long id; + private String name; + + protected Tag(TagBuilder b) { + this.id = b.id; + this.name = b.name; + } + + public Tag() { + } + + /** + **/ + public Tag id(Long id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Tag name(String name) { + this.name = name; + return this; + } + + + @Schema(description = "") + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static TagBuilder builder() { + return new TagBuilderImpl(); + } + + private static final class TagBuilderImpl extends TagBuilder { + + @Override + protected TagBuilderImpl self() { + return this; + } + + @Override + public Tag build() { + return new Tag(this); + } + } + + public static abstract class TagBuilder> { + private Long id; + private String name; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B name(String name) { + this.name = name; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java new file mode 100644 index 000000000000..c68f26ff2c58 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -0,0 +1,89 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("testInlineFreeformAdditionalProperties_request") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap implements Serializable { + private String someProperty; + + public TestInlineFreeformAdditionalPropertiesRequest() { + } + + /** + **/ + public TestInlineFreeformAdditionalPropertiesRequest someProperty(String someProperty) { + this.someProperty = someProperty; + return this; + } + + + @Schema(description = "") + @JsonProperty("someProperty") + public String getSomeProperty() { + return someProperty; + } + + @JsonProperty("someProperty") + public void setSomeProperty(String someProperty) { + this.someProperty = someProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = (TestInlineFreeformAdditionalPropertiesRequest) o; + return Objects.equals(this.someProperty, testInlineFreeformAdditionalPropertiesRequest.someProperty) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(someProperty, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" someProperty: ").append(toIndentedString(someProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/User.java new file mode 100644 index 000000000000..1cf8c6524290 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/gen/java/org/openapitools/model/User.java @@ -0,0 +1,314 @@ +package org.openapitools.model; + +import java.io.Serializable; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("User") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class User implements Serializable { + private Long id; + private String username; + private String firstName; + private String lastName; + private String email; + private String password; + private String phone; + private Integer userStatus; + + protected User(UserBuilder b) { + this.id = b.id; + this.username = b.username; + this.firstName = b.firstName; + this.lastName = b.lastName; + this.email = b.email; + this.password = b.password; + this.phone = b.phone; + this.userStatus = b.userStatus; + } + + public User() { + } + + /** + **/ + public User id(Long id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public User username(String username) { + this.username = username; + return this; + } + + + @Schema(description = "") + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonProperty("username") + public void setUsername(String username) { + this.username = username; + } + + /** + **/ + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + + @Schema(description = "") + @JsonProperty("firstName") + public String getFirstName() { + return firstName; + } + + @JsonProperty("firstName") + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + **/ + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + + @Schema(description = "") + @JsonProperty("lastName") + public String getLastName() { + return lastName; + } + + @JsonProperty("lastName") + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + **/ + public User email(String email) { + this.email = email; + return this; + } + + + @Schema(description = "") + @JsonProperty("email") + public String getEmail() { + return email; + } + + @JsonProperty("email") + public void setEmail(String email) { + this.email = email; + } + + /** + **/ + public User password(String password) { + this.password = password; + return this; + } + + + @Schema(description = "") + @JsonProperty("password") + public String getPassword() { + return password; + } + + @JsonProperty("password") + public void setPassword(String password) { + this.password = password; + } + + /** + **/ + public User phone(String phone) { + this.phone = phone; + return this; + } + + + @Schema(description = "") + @JsonProperty("phone") + public String getPhone() { + return phone; + } + + @JsonProperty("phone") + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * User Status + **/ + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + + @Schema(description = "User Status") + @JsonProperty("userStatus") + public Integer getUserStatus() { + return userStatus; + } + + @JsonProperty("userStatus") + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static UserBuilder builder() { + return new UserBuilderImpl(); + } + + private static final class UserBuilderImpl extends UserBuilder { + + @Override + protected UserBuilderImpl self() { + return this; + } + + @Override + public User build() { + return new User(this); + } + } + + public static abstract class UserBuilder> { + private Long id; + private String username; + private String firstName; + private String lastName; + private String email; + private String password; + private String phone; + private Integer userStatus; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B username(String username) { + this.username = username; + return self(); + } + public B firstName(String firstName) { + this.firstName = firstName; + return self(); + } + public B lastName(String lastName) { + this.lastName = lastName; + return self(); + } + public B email(String email) { + this.email = email; + return self(); + } + public B password(String password) { + this.password = password; + return self(); + } + public B phone(String phone) { + this.phone = phone; + return self(); + } + public B userStatus(Integer userStatus) { + this.userStatus = userStatus; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/main/openapi/openapi.yaml new file mode 100644 index 000000000000..e8ba4f7ffd4e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations-jakarta/src/main/openapi/openapi.yaml @@ -0,0 +1,2508 @@ +openapi: 3.0.0 +info: + description: "This spec is mainly for testing Petstore server and contains fake\ + \ endpoints, models. Please do not use this for any other purpose. Special characters:\ + \ \" \\" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- description: petstore server + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: "https://localhost:8080/{version}" + variables: + version: + default: v2 + enum: + - v1 + - v2 +- description: The local server without variables + url: https://127.0.0.1/no_varaible +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/_foo_get_default_response" + description: response + x-accepts: + - application/json + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + description: Successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: pet + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + description: Successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-webclient-blocking: true + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: pet + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 + - description: test server with variables + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + description: target server + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + x-tags: + - tag: pet + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + uniqueItems: true + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + uniqueItems: true + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + uniqueItems: true + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + x-tags: + - tag: pet + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + description: Successful operation + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + x-tags: + - tag: pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + x-tags: + - tag: pet + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "200": + description: Successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: pet + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-webclient-blocking: false + x-accepts: + - application/json + x-tags: + - tag: store + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + x-tags: + - tag: store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + x-tags: + - tag: store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + x-tags: + - tag: store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + x-tags: + - tag: user + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + x-tags: + - tag: user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Delete user + tags: + - user + x-accepts: + - application/json + x-tags: + - tag: user + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + x-tags: + - tag: user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake_classname_tags 123#$%^ + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + "400": + description: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: + - application/json + x-tags: + - tag: fake + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + - explode: true + in: query + name: enum_query_model_array + required: false + schema: + items: + $ref: "#/components/schemas/EnumClass" + type: array + style: form + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEnumParameters_request" + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test "client" model + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEndpointParameters_request" + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterNumber" + description: Input number as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterNumber" + description: Output number + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/property/enum-int: + post: + description: Test serialization of enum (int) properties with examples + operationId: fakePropertyEnumIntegerSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterObjectWithEnumProperty" + description: Input enum (int) as post body + required: true + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterObjectWithEnumProperty" + description: Output enum (int) + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterString" + description: Input string as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterString" + description: Output string + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Input boolean as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Output boolean + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterComposite" + description: Input composite as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterComposite" + description: Output composite + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/fakeBigDecimalMap_200_response" + description: successful operation + tags: + - fake + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testJsonFormData_request" + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FreeFormObject" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/MapOfString" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/inline-additionalProperties: + post: + description: "" + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/testInlineFreeformAdditionalProperties_request" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/nullable: + post: + description: "" + operationId: testNullable + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ChildWithNullable" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test nullable parent property + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: $another-fake? + /fake/body-with-file-schema: + put: + description: "For this test, the body for this request must reference a schema\ + \ named `File`." + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FileSchemaTestClass" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/body-with-binary: + put: + description: "For this test, the body has to be a binary file." + operationId: testBodyWithBinary + requestBody: + content: + image/png: + schema: + format: binary + nullable: true + type: string + description: image to upload + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: image/png + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: false + in: query + name: pipe + required: true + schema: + items: + type: string + type: array + style: pipeDelimited + - explode: false + in: query + name: ioutil + required: true + schema: + items: + type: string + type: array + style: form + - explode: false + in: query + name: http + required: true + schema: + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: language + required: false + schema: + additionalProperties: + format: string + type: string + type: object + style: form + - allowEmptyValue: true + explode: true + in: query + name: allowEmpty + required: true + schema: + type: string + style: form + responses: + "200": + description: Success + tags: + - fake + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFileWithRequiredFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: pet + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/HealthCheckResult" + description: The instance started successfully + summary: Health check endpoint + tags: + - fake + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/http-signature-test: + get: + operationId: fake-http-signature-test + parameters: + - description: query parameter + explode: true + in: query + name: query_1 + required: false + schema: + type: string + style: form + - description: header parameter + explode: false + in: header + name: header_1 + required: false + schema: + type: string + style: simple + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + description: The instance started successfully + security: + - http_signature_test: [] + summary: test http signature authentication + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/tests/defaults: + get: + operationId: fake-tests-defaults + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/fake_tests_defaults_default_response" + description: response + summary: test enum default in request body + tags: + - fake + x-accepts: + - application/json + x-tags: + - tag: fake +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + name: default-name + id: 6 + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: default-name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + uniqueItems: true + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + declawed: + type: boolean + type: object + Animal: + discriminator: + mapping: + DOG: "#/components/schemas/Dog" + CAT: "#/components/schemas/Cat" + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: "#/components/schemas/Animal" + type: array + format_test: + properties: + integer: + maximum: 100 + minimum: 10 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + decimal: + format: number + type: string + string: + pattern: "/[a-z]/i" + type: string + byte: + format: byte + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: "^\\d{10}$" + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: "/^image_\\d{1,3}$/i" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: "#/components/schemas/OuterEnum" + outerEnumInteger: + $ref: "#/components/schemas/OuterEnumInteger" + outerEnumDefaultValue: + $ref: "#/components/schemas/OuterEnumDefaultValue" + outerEnumIntegerDefaultValue: + $ref: "#/components/schemas/OuterEnumIntegerDefaultValue" + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: "#/components/schemas/Animal" + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + type: object + ArrayTest: + properties: + array_of_string: + items: + type: string + maxItems: 3 + minItems: 0 + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: "#/components/schemas/ReadOnlyFirst" + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + nullable: true + type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 2 + example: 2 + type: integer + OuterEnumDefaultValue: + default: placed + enum: + - placed + - approved + - delivered + type: string + OuterEnumIntegerDefaultValue: + default: 0 + enum: + - 0 + - 1 + - 2 + type: integer + OuterComposite: + example: + my_string: my_string + my_number: 0.8008281904610115 + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + ParentWithNullable: + discriminator: + propertyName: type + properties: + type: + enum: + - ChildWithNullable + type: string + nullableProperty: + nullable: true + type: string + type: object + ChildWithNullable: + allOf: + - $ref: "#/components/schemas/ParentWithNullable" + - properties: + otherProperty: + type: string + type: object + example: + otherProperty: otherProperty + nullableProperty: nullableProperty + type: ChildWithNullable + StringBooleanMap: + additionalProperties: + type: boolean + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: "#/components/schemas/File" + files: + items: + $ref: "#/components/schemas/File" + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + xml: + name: "$special[model.name]" + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage + properties: + NullableMessage: + nullable: true + type: string + type: object + NullableClass: + additionalProperties: + nullable: true + type: object + properties: + integer_prop: + nullable: true + type: integer + number_prop: + nullable: true + type: number + boolean_prop: + nullable: true + type: boolean + string_prop: + nullable: true + type: string + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: + items: + type: object + nullable: true + type: array + array_and_items_nullable_prop: + items: + nullable: true + type: object + nullable: true + type: array + array_items_nullable: + items: + nullable: true + type: object + type: array + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + type: object + type: object + OuterObjectWithEnumProperty: + example: + value: 2 + properties: + value: + $ref: "#/components/schemas/OuterEnumInteger" + required: + - value + type: object + DeprecatedObject: + deprecated: true + properties: + name: + type: string + type: object + ObjectWithDeprecatedFields: + properties: + uuid: + type: string + id: + deprecated: true + type: number + deprecatedRef: + $ref: "#/components/schemas/DeprecatedObject" + bars: + deprecated: true + items: + $ref: "#/components/schemas/Bar" + type: array + type: object + AllOfWithSingleRef: + properties: + username: + type: string + SingleRefType: + allOf: + - $ref: "#/components/schemas/SingleRefType" + type: object + SingleRefType: + enum: + - admin + - user + title: SingleRefType + type: string + StringEnum: + default: foo + enum: + - foo + - bar + - baz + type: string + IntegerEnum: + default: 1 + enum: + - 1 + - 2 + - 3 + type: integer + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: "#/components/schemas/Foo" + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + testEndpointParameters_request: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + fake_tests_defaults_default_response: + example: + stringEnum: foo + integerEnum: 0 + stringEnumInline: foo + integerEnumInline: 6 + properties: + stringEnum: + $ref: "#/components/schemas/StringEnum" + integerEnum: + $ref: "#/components/schemas/IntegerEnum" + stringEnumInline: + default: foo + enum: + - foo + - bar + - baz + type: string + integerEnumInline: + default: 1 + enum: + - 1 + - 2 + - 3 + type: integer + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + http_signature_test: + scheme: signature + type: http diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/.openapi-generator-ignore b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/.openapi-generator/FILES b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/.openapi-generator/FILES new file mode 100644 index 000000000000..7155b1df8e89 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/.openapi-generator/FILES @@ -0,0 +1,65 @@ +README.md +pom.xml +src/gen/java/org/openapitools/api/AnotherFakeApi.java +src/gen/java/org/openapitools/api/FakeApi.java +src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +src/gen/java/org/openapitools/api/FooApi.java +src/gen/java/org/openapitools/api/PetApi.java +src/gen/java/org/openapitools/api/RestApplication.java +src/gen/java/org/openapitools/api/RestResourceRoot.java +src/gen/java/org/openapitools/api/StoreApi.java +src/gen/java/org/openapitools/api/UserApi.java +src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +src/gen/java/org/openapitools/model/AllOfWithSingleRef.java +src/gen/java/org/openapitools/model/Animal.java +src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java +src/gen/java/org/openapitools/model/ArrayTest.java +src/gen/java/org/openapitools/model/Capitalization.java +src/gen/java/org/openapitools/model/Cat.java +src/gen/java/org/openapitools/model/Category.java +src/gen/java/org/openapitools/model/ChildWithNullable.java +src/gen/java/org/openapitools/model/ClassModel.java +src/gen/java/org/openapitools/model/Client.java +src/gen/java/org/openapitools/model/DeprecatedObject.java +src/gen/java/org/openapitools/model/Dog.java +src/gen/java/org/openapitools/model/EnumArrays.java +src/gen/java/org/openapitools/model/EnumClass.java +src/gen/java/org/openapitools/model/EnumTest.java +src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java +src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java +src/gen/java/org/openapitools/model/FileSchemaTestClass.java +src/gen/java/org/openapitools/model/Foo.java +src/gen/java/org/openapitools/model/FooGetDefaultResponse.java +src/gen/java/org/openapitools/model/FormatTest.java +src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +src/gen/java/org/openapitools/model/HealthCheckResult.java +src/gen/java/org/openapitools/model/IntegerEnum.java +src/gen/java/org/openapitools/model/MapTest.java +src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/gen/java/org/openapitools/model/Model200Response.java +src/gen/java/org/openapitools/model/ModelApiResponse.java +src/gen/java/org/openapitools/model/ModelFile.java +src/gen/java/org/openapitools/model/ModelList.java +src/gen/java/org/openapitools/model/ModelReturn.java +src/gen/java/org/openapitools/model/Name.java +src/gen/java/org/openapitools/model/NullableClass.java +src/gen/java/org/openapitools/model/NumberOnly.java +src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java +src/gen/java/org/openapitools/model/Order.java +src/gen/java/org/openapitools/model/OuterComposite.java +src/gen/java/org/openapitools/model/OuterEnum.java +src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java +src/gen/java/org/openapitools/model/OuterEnumInteger.java +src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java +src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java +src/gen/java/org/openapitools/model/ParentWithNullable.java +src/gen/java/org/openapitools/model/Pet.java +src/gen/java/org/openapitools/model/ReadOnlyFirst.java +src/gen/java/org/openapitools/model/SingleRefType.java +src/gen/java/org/openapitools/model/SpecialModelName.java +src/gen/java/org/openapitools/model/StringEnum.java +src/gen/java/org/openapitools/model/Tag.java +src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java +src/gen/java/org/openapitools/model/User.java +src/main/openapi/openapi.yaml diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/.openapi-generator/VERSION b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/.openapi-generator/VERSION new file mode 100644 index 000000000000..2fb556b60635 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.18.0-SNAPSHOT diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/README.md b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/README.md new file mode 100644 index 000000000000..da90cb71c166 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/README.md @@ -0,0 +1,27 @@ +# JAX-RS server with OpenAPI + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. + +This is an example of building a OpenAPI-enabled JAX-RS server. +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + + +The JAX-RS implementation needs to be provided by the application server you are deploying on. + +To run the server from the command line, you can use maven to provision and start a TomEE Server. +Please execute the following: + +``` +mvn -Dtomee-embedded-plugin.http=80 package org.apache.tomee.maven:tomee-embedded-maven-plugin:7.0.5:run +``` + +You can then call your server endpoints under: + +``` +http://localhost:80/v2/ +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/pom.xml b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/pom.xml new file mode 100644 index 000000000000..bda392827e61 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/pom.xml @@ -0,0 +1,146 @@ + + 4.0.0 + org.openapitools + jaxrs-spec-petstore-server + war + jaxrs-spec-petstore-server + 1.0.0 + + + + src/main/java + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + false + + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + + + + jakarta.ws.rs + jakarta.ws.rs-api + ${jakarta.ws.rs-version} + provided + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson-version} + + + joda-time + joda-time + ${joda-version} + + + javax.annotation + javax.annotation-api + ${javax.annotation-api-version} + + + io.swagger.core.v3 + swagger-annotations + provided + ${io.swagger.v3.annotations.version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + junit + junit + ${junit-version} + test + + + org.testng + testng + 6.8.8 + test + + + junit + junit + + + snakeyaml + org.yaml + + + bsh + org.beanshell + + + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + + 1.8 + ${java.version} + ${java.version} + UTF-8 + 2.19.2 + 4.13.2 + 2.10.13 + 1.3.2 + 2.0.2 + 2.1.6 + 0.2.8 + 2.2.21 + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/AnotherFakeApi.java new file mode 100644 index 000000000000..a5724bf54889 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -0,0 +1,38 @@ +package org.openapitools.api; + +import org.openapitools.model.Client; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/another-fake/dummy") + +@Tag(name = "another-fake") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class AnotherFakeApi { + + @PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @Operation(summary = "To test special tags", description = "To test special tags and operation ID starting with number") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response call123testSpecialTags(@Valid @NotNull Client client) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/FakeApi.java new file mode 100644 index 000000000000..40495138b78e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/FakeApi.java @@ -0,0 +1,311 @@ +package org.openapitools.api; + +import java.math.BigDecimal; +import org.openapitools.model.ChildWithNullable; +import org.openapitools.model.Client; +import java.util.Date; +import org.openapitools.model.EnumClass; +import org.openapitools.model.FakeBigDecimalMap200Response; +import org.openapitools.model.FakeTestsDefaultsDefaultResponse; +import java.io.File; +import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; +import org.joda.time.LocalDate; +import java.util.Map; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.OuterComposite; +import org.openapitools.model.OuterObjectWithEnumProperty; +import org.openapitools.model.Pet; +import org.openapitools.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.model.User; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/fake") + +@Tag(name = "fake") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeApi { + + @GET + @Path("/BigDecimalMap") + @Produces({ "*/*" }) + @Operation(summary = "", description = "for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response fakeBigDecimalMap() { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/health") + @Produces({ "application/json" }) + @Operation(summary = "Health check endpoint", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "The instance started successfully") + }) + public Response fakeHealthGet() { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/http-signature-test") + @Consumes({ "application/json", "application/xml" }) + @Operation(summary = "test http signature authentication", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "The instance started successfully") + }) + public Response fakeHttpSignatureTest(@Valid @NotNull Pet pet,@QueryParam("query_1") String query1,@HeaderParam("header_1") String header1) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/boolean") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "Test serialization of outer boolean types") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Output boolean") + }) + public Response fakeOuterBooleanSerialize(@Valid Boolean body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/composite") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "Test serialization of object with outer number type") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Output composite") + }) + public Response fakeOuterCompositeSerialize(@Valid OuterComposite outerComposite) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/number") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "Test serialization of outer number types") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Output number") + }) + public Response fakeOuterNumberSerialize(@Valid BigDecimal body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/string") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "Test serialization of outer string types") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Output string") + }) + public Response fakeOuterStringSerialize(@Valid String body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/property/enum-int") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "Test serialization of enum (int) properties with examples") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Output enum (int)") + }) + public Response fakePropertyEnumIntegerSerialize(@Valid @NotNull OuterObjectWithEnumProperty outerObjectWithEnumProperty) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/tests/defaults") + @Produces({ "application/json" }) + @Operation(summary = "test enum default in request body", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "response") + }) + public Response fakeTestsDefaults() { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/additionalProperties-reference") + @Consumes({ "application/json" }) + @Operation(summary = "test referenced additionalProperties", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testAdditionalPropertiesReference(@Valid @NotNull Map requestBody) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/body-with-binary") + @Consumes({ "image/png" }) + @Operation(summary = "", description = "For this test, the body has to be a binary file.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Success") + }) + public Response testBodyWithBinary(@Valid File body) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/body-with-file-schema") + @Consumes({ "application/json" }) + @Operation(summary = "", description = "For this test, the body for this request must reference a schema named `File`.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Success") + }) + public Response testBodyWithFileSchema(@Valid @NotNull FileSchemaTestClass fileSchemaTestClass) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/body-with-query-params") + @Consumes({ "application/json" }) + @Operation(summary = "", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Success") + }) + public Response testBodyWithQueryParams(@QueryParam("query") @NotNull String query,@Valid @NotNull User user) { + return Response.ok().entity("magic!").build(); + } + + @PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @Operation(summary = "To test \"client\" model", description = "To test \"client\" model") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testClientModel(@Valid @NotNull Client client) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", description = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Invalid username supplied"), + @ApiResponse(responseCode = "404", description = "User not found") + }) + public Response testEndpointParameters(@FormParam(value = "number") BigDecimal number,@FormParam(value = "double") Double _double,@FormParam(value = "pattern_without_delimiter") String patternWithoutDelimiter,@FormParam(value = "byte") byte[] _byte,@FormParam(value = "integer") Integer integer,@FormParam(value = "int32") Integer int32,@FormParam(value = "int64") Long int64,@FormParam(value = "float") Float _float,@FormParam(value = "string") String string, @FormParam(value = "binary") InputStream binaryInputStream,@FormParam(value = "date") LocalDate date,@FormParam(value = "dateTime") Date dateTime,@FormParam(value = "password") String password,@FormParam(value = "callback") String paramCallback) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "To test enum parameters", description = "To test enum parameters") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Invalid request"), + @ApiResponse(responseCode = "404", description = "Not found") + }) + public Response testEnumParameters(@HeaderParam("enum_header_string_array") List enumHeaderStringArray,@QueryParam("enum_query_string_array") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") String enumQueryString,@QueryParam("enum_query_integer") Integer enumQueryInteger,@QueryParam("enum_query_double") Double enumQueryDouble,@QueryParam("enum_query_model_array") List enumQueryModelArray,@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) { + return Response.ok().entity("magic!").build(); + } + + @DELETE + @Operation(summary = "Fake endpoint to test group parameters (optional)", description = "Fake endpoint to test group parameters (optional)") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Something wrong") + }) + public Response testGroupParameters(@QueryParam("required_string_group") @NotNull Integer requiredStringGroup,@HeaderParam("required_boolean_group") @NotNull Boolean requiredBooleanGroup,@QueryParam("required_int64_group") @NotNull Long requiredInt64Group,@QueryParam("string_group") Integer stringGroup,@HeaderParam("boolean_group") Boolean booleanGroup,@QueryParam("int64_group") Long int64Group) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/inline-additionalProperties") + @Consumes({ "application/json" }) + @Operation(summary = "test inline additionalProperties", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testInlineAdditionalProperties(@Valid @NotNull Map requestBody) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/inline-freeform-additionalProperties") + @Consumes({ "application/json" }) + @Operation(summary = "test inline free-form additionalProperties", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testInlineFreeformAdditionalProperties(@Valid @NotNull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/jsonFormData") + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "test json serialization of form data", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testJsonFormData(@FormParam(value = "param") String param,@FormParam(value = "param2") String param2) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/nullable") + @Consumes({ "application/json" }) + @Operation(summary = "test nullable parent property", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testNullable(@Valid @NotNull ChildWithNullable childWithNullable) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/test-query-parameters") + @Operation(summary = "", description = "To test the collection format in query parameters") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Success") + }) + public Response testQueryParameterCollectionFormat(@QueryParam("pipe") @NotNull List pipe,@QueryParam("ioutil") @NotNull List ioutil,@QueryParam("http") @NotNull List http,@QueryParam("url") @NotNull List url,@QueryParam("context") @NotNull List context,@QueryParam("allowEmpty") @NotNull String allowEmpty,@QueryParam("language") Map language) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/stringMap-reference") + @Consumes({ "application/json" }) + @Operation(summary = "test referenced string map", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testStringMapReference(@Valid @NotNull Map requestBody) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/{petId}/uploadImageWithRequiredFile") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @Operation(summary = "uploads an image (required)", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response uploadFileWithRequiredFile(@PathParam("petId") Long petId, @FormParam(value = "requiredFile") InputStream requiredFileInputStream,@FormParam(value = "additionalMetadata") String additionalMetadata) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java new file mode 100644 index 000000000000..a9ffa10ebad0 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -0,0 +1,38 @@ +package org.openapitools.api; + +import org.openapitools.model.Client; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/fake_classname_test") + +@Tag(name = "fake_classname_test") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeClassnameTestApi { + + @PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @Operation(summary = "To test class name in snake case", description = "To test class name in snake case") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response testClassname(@Valid @NotNull Client client) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/FooApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/FooApi.java new file mode 100644 index 000000000000..c10bd0a8f323 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/FooApi.java @@ -0,0 +1,37 @@ +package org.openapitools.api; + +import org.openapitools.model.FooGetDefaultResponse; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/foo") + +@Tag(name = "foo") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FooApi { + + @GET + @Produces({ "application/json" }) + @Operation(summary = "", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "response") + }) + public Response fooGet() { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/PetApi.java new file mode 100644 index 000000000000..e31b085d570c --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/PetApi.java @@ -0,0 +1,126 @@ +package org.openapitools.api; + +import java.io.File; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.Pet; +import java.util.Set; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/pet") + +@Tag(name = "pet") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class PetApi { + + @POST + @Consumes({ "application/json", "application/xml" }) + @Operation(summary = "Add a new pet to the store", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successful operation"), + @ApiResponse(responseCode = "405", description = "Invalid input") + }) + public Response addPet(@Valid @NotNull Pet pet) { + return Response.ok().entity("magic!").build(); + } + + @DELETE + @Path("/{petId}") + @Operation(summary = "Deletes a pet", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid pet value") + }) + public Response deletePet(@PathParam("petId") Long petId) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/findByStatus") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Finds Pets by status", description = "Multiple status values can be provided with comma separated strings") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid status value") + }) + public Response findPetsByStatus(@QueryParam("status") @NotNull List status) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/findByTags") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Finds Pets by tags", description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid tag value") + }) + public Response findPetsByTags(@QueryParam("tags") @NotNull Set tags) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/{petId}") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Find pet by ID", description = "Returns a single pet") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), + @ApiResponse(responseCode = "404", description = "Pet not found") + }) + public Response getPetById(@PathParam("petId") Long petId) { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Consumes({ "application/json", "application/xml" }) + @Operation(summary = "Update an existing pet", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), + @ApiResponse(responseCode = "404", description = "Pet not found"), + @ApiResponse(responseCode = "405", description = "Validation exception") + }) + public Response updatePet(@Valid @NotNull Pet pet) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "Updates a pet in the store with form data", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successful operation"), + @ApiResponse(responseCode = "405", description = "Invalid input") + }) + public Response updatePetWithForm(@PathParam("petId") Long petId,@FormParam(value = "name") String name,@FormParam(value = "status") String status) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @Operation(summary = "uploads an image", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response uploadFile(@PathParam("petId") Long petId,@FormParam(value = "additionalMetadata") String additionalMetadata, @FormParam(value = "file") InputStream _fileInputStream) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/RestApplication.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/RestApplication.java new file mode 100644 index 000000000000..7df2d0fe3334 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/RestApplication.java @@ -0,0 +1,9 @@ +package org.openapitools.api; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath(RestResourceRoot.APPLICATION_PATH) +public class RestApplication extends Application { + +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/RestResourceRoot.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/RestResourceRoot.java new file mode 100644 index 000000000000..96ba6c8d8e40 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/RestResourceRoot.java @@ -0,0 +1,5 @@ +package org.openapitools.api; + +public class RestResourceRoot { + public static final String APPLICATION_PATH = "/v2"; +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/StoreApi.java new file mode 100644 index 000000000000..468162a73898 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/StoreApi.java @@ -0,0 +1,76 @@ +package org.openapitools.api; + +import java.util.Map; +import org.openapitools.model.Order; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/store") + +@Tag(name = "store") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class StoreApi { + + @DELETE + @Path("/order/{order_id}") + @Operation(summary = "Delete purchase order by ID", description = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), + @ApiResponse(responseCode = "404", description = "Order not found") + }) + public Response deleteOrder(@PathParam("order_id") String orderId) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/inventory") + @Produces({ "application/json" }) + @Operation(summary = "Returns pet inventories by status", description = "Returns a map of status codes to quantities") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response getInventory() { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/order/{order_id}") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Find purchase order by ID", description = "For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid ID supplied"), + @ApiResponse(responseCode = "404", description = "Order not found") + }) + public Response getOrderById(@PathParam("order_id") @Min(1L) @Max(5L) Long orderId) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/order") + @Consumes({ "application/json" }) + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Place an order for a pet", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid Order") + }) + public Response placeOrder(@Valid @NotNull Order order) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/UserApi.java new file mode 100644 index 000000000000..3d9640cf996e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/api/UserApi.java @@ -0,0 +1,118 @@ +package org.openapitools.api; + +import java.util.Date; +import org.openapitools.model.User; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import io.swagger.v3.oas.annotations.responses.*; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.InputStream; +import java.util.Map; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** +* Represents a collection of functions to interact with the API endpoints. +*/ +@Path("/user") + +@Tag(name = "user") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class UserApi { + + @POST + @Consumes({ "application/json" }) + @Operation(summary = "Create user", description = "This can only be done by the logged in user.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response createUser(@Valid @NotNull User user) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/createWithArray") + @Consumes({ "application/json" }) + @Operation(summary = "Creates list of users with given input array", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response createUsersWithArrayInput(@Valid @NotNull List<@Valid User> user) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/createWithList") + @Consumes({ "application/json" }) + @Operation(summary = "Creates list of users with given input array", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response createUsersWithListInput(@Valid @NotNull List<@Valid User> user) { + return Response.ok().entity("magic!").build(); + } + + @DELETE + @Path("/{username}") + @Operation(summary = "Delete user", description = "This can only be done by the logged in user.") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Invalid username supplied"), + @ApiResponse(responseCode = "404", description = "User not found") + }) + public Response deleteUser(@PathParam("username") String username) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/{username}") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Get user by user name", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid username supplied"), + @ApiResponse(responseCode = "404", description = "User not found") + }) + public Response getUserByName(@PathParam("username") String username) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/login") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Logs user into the system", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation"), + @ApiResponse(responseCode = "400", description = "Invalid username/password supplied") + }) + public Response loginUser(@QueryParam("username") @NotNull String username,@QueryParam("password") @NotNull String password) { + return Response.ok().entity("magic!").build(); + } + + @GET + @Path("/logout") + @Operation(summary = "Logs out current logged in user session", description = "") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful operation") + }) + public Response logoutUser() { + return Response.ok().entity("magic!").build(); + } + + @PUT + @Path("/{username}") + @Consumes({ "application/json" }) + @Operation(summary = "Updated user", description = "This can only be done by the logged in user.") + @ApiResponses(value = { + @ApiResponse(responseCode = "400", description = "Invalid user supplied"), + @ApiResponse(responseCode = "404", description = "User not found") + }) + public Response updateUser(@PathParam("username") String username,@Valid @NotNull User user) { + return Response.ok().entity("magic!").build(); + } +} diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..09556eb4391a --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -0,0 +1,179 @@ +package org.openapitools.model; + +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("AdditionalPropertiesClass") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class AdditionalPropertiesClass implements Serializable { + private @Valid Map mapProperty = new HashMap<>(); + private @Valid Map> mapOfMapProperty = new HashMap<>(); + + protected AdditionalPropertiesClass(AdditionalPropertiesClassBuilder b) { + this.mapProperty = b.mapProperty; + this.mapOfMapProperty = b.mapOfMapProperty; + } + + public AdditionalPropertiesClass() { + } + + /** + **/ + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + + @Schema(description = "") + @JsonProperty("map_property") + public Map getMapProperty() { + return mapProperty; + } + + @JsonProperty("map_property") + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<>(); + } + + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + public AdditionalPropertiesClass removeMapPropertyItem(String key) { + if (this.mapProperty != null) { + this.mapProperty.remove(key); + } + + return this; + } + /** + **/ + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + + @Schema(description = "") + @JsonProperty("map_of_map_property") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + @JsonProperty("map_of_map_property") + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<>(); + } + + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + public AdditionalPropertiesClass removeMapOfMapPropertyItem(String key) { + if (this.mapOfMapProperty != null) { + this.mapOfMapProperty.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static AdditionalPropertiesClassBuilder builder() { + return new AdditionalPropertiesClassBuilderImpl(); + } + + private static final class AdditionalPropertiesClassBuilderImpl extends AdditionalPropertiesClassBuilder { + + @Override + protected AdditionalPropertiesClassBuilderImpl self() { + return this; + } + + @Override + public AdditionalPropertiesClass build() { + return new AdditionalPropertiesClass(this); + } + } + + public static abstract class AdditionalPropertiesClassBuilder> { + private Map mapProperty = new HashMap<>(); + private Map> mapOfMapProperty = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return self(); + } + public B mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java new file mode 100644 index 000000000000..9a9d2013d449 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java @@ -0,0 +1,146 @@ +package org.openapitools.model; + +import org.openapitools.model.SingleRefType; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("AllOfWithSingleRef") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class AllOfWithSingleRef implements Serializable { + private String username; + private SingleRefType singleRefType; + + protected AllOfWithSingleRef(AllOfWithSingleRefBuilder b) { + this.username = b.username; + this.singleRefType = b.singleRefType; + } + + public AllOfWithSingleRef() { + } + + /** + **/ + public AllOfWithSingleRef username(String username) { + this.username = username; + return this; + } + + + @Schema(description = "") + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonProperty("username") + public void setUsername(String username) { + this.username = username; + } + + /** + **/ + public AllOfWithSingleRef singleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + return this; + } + + + @Schema(description = "") + @JsonProperty("SingleRefType") + public SingleRefType getSingleRefType() { + return singleRefType; + } + + @JsonProperty("SingleRefType") + public void setSingleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfWithSingleRef allOfWithSingleRef = (AllOfWithSingleRef) o; + return Objects.equals(this.username, allOfWithSingleRef.username) && + Objects.equals(this.singleRefType, allOfWithSingleRef.singleRefType); + } + + @Override + public int hashCode() { + return Objects.hash(username, singleRefType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfWithSingleRef {\n"); + + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" singleRefType: ").append(toIndentedString(singleRefType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static AllOfWithSingleRefBuilder builder() { + return new AllOfWithSingleRefBuilderImpl(); + } + + private static final class AllOfWithSingleRefBuilderImpl extends AllOfWithSingleRefBuilder { + + @Override + protected AllOfWithSingleRefBuilderImpl self() { + return this; + } + + @Override + public AllOfWithSingleRef build() { + return new AllOfWithSingleRef(this); + } + } + + public static abstract class AllOfWithSingleRefBuilder> { + private String username; + private SingleRefType singleRefType; + protected abstract B self(); + + public abstract C build(); + + public B username(String username) { + this.username = username; + return self(); + } + public B singleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Animal.java new file mode 100644 index 000000000000..c531dafe3d43 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Animal.java @@ -0,0 +1,160 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) + + +@Schema(description="") +@JsonTypeName("Animal") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Animal implements Serializable { + private String className; + private String color = "red"; + + protected Animal(AnimalBuilder b) { + this.className = b.className; + this.color = b.color; + } + + public Animal() { + } + + @JsonCreator + public Animal( + @JsonProperty(required = true, value = "className") String className + ) { + this.className = className; + } + + /** + **/ + public Animal className(String className) { + this.className = className; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "className") + @NotNull public String getClassName() { + return className; + } + + @JsonProperty(required = true, value = "className") + public void setClassName(String className) { + this.className = className; + } + + /** + **/ + public Animal color(String color) { + this.color = color; + return this; + } + + + @Schema(description = "") + @JsonProperty("color") + public String getColor() { + return color; + } + + @JsonProperty("color") + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static AnimalBuilder builder() { + return new AnimalBuilderImpl(); + } + + private static final class AnimalBuilderImpl extends AnimalBuilder { + + @Override + protected AnimalBuilderImpl self() { + return this; + } + + @Override + public Animal build() { + return new Animal(this); + } + } + + public static abstract class AnimalBuilder> { + private String className; + private String color = "red"; + protected abstract B self(); + + public abstract C build(); + + public B className(String className) { + this.className = className; + return self(); + } + public B color(String color) { + this.color = color; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..847d3bbb882d --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,137 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ArrayOfArrayOfNumberOnly") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ArrayOfArrayOfNumberOnly implements Serializable { + private @Valid List> arrayArrayNumber = new ArrayList<>(); + + protected ArrayOfArrayOfNumberOnly(ArrayOfArrayOfNumberOnlyBuilder b) { + this.arrayArrayNumber = b.arrayArrayNumber; + } + + public ArrayOfArrayOfNumberOnly() { + } + + /** + **/ + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + + @Schema(description = "") + @JsonProperty("ArrayArrayNumber") + @Valid public List<@Valid List<@Valid BigDecimal>> getArrayArrayNumber() { + return arrayArrayNumber; + } + + @JsonProperty("ArrayArrayNumber") + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList<>(); + } + + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + public ArrayOfArrayOfNumberOnly removeArrayArrayNumberItem(List arrayArrayNumberItem) { + if (arrayArrayNumberItem != null && this.arrayArrayNumber != null) { + this.arrayArrayNumber.remove(arrayArrayNumberItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ArrayOfArrayOfNumberOnlyBuilder builder() { + return new ArrayOfArrayOfNumberOnlyBuilderImpl(); + } + + private static final class ArrayOfArrayOfNumberOnlyBuilderImpl extends ArrayOfArrayOfNumberOnlyBuilder { + + @Override + protected ArrayOfArrayOfNumberOnlyBuilderImpl self() { + return this; + } + + @Override + public ArrayOfArrayOfNumberOnly build() { + return new ArrayOfArrayOfNumberOnly(this); + } + } + + public static abstract class ArrayOfArrayOfNumberOnlyBuilder> { + private List> arrayArrayNumber = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..29ea779583ad --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -0,0 +1,137 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ArrayOfNumberOnly") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ArrayOfNumberOnly implements Serializable { + private @Valid List arrayNumber = new ArrayList<>(); + + protected ArrayOfNumberOnly(ArrayOfNumberOnlyBuilder b) { + this.arrayNumber = b.arrayNumber; + } + + public ArrayOfNumberOnly() { + } + + /** + **/ + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + + @Schema(description = "") + @JsonProperty("ArrayNumber") + @Valid public List<@Valid BigDecimal> getArrayNumber() { + return arrayNumber; + } + + @JsonProperty("ArrayNumber") + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList<>(); + } + + this.arrayNumber.add(arrayNumberItem); + return this; + } + + public ArrayOfNumberOnly removeArrayNumberItem(BigDecimal arrayNumberItem) { + if (arrayNumberItem != null && this.arrayNumber != null) { + this.arrayNumber.remove(arrayNumberItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ArrayOfNumberOnlyBuilder builder() { + return new ArrayOfNumberOnlyBuilderImpl(); + } + + private static final class ArrayOfNumberOnlyBuilderImpl extends ArrayOfNumberOnlyBuilder { + + @Override + protected ArrayOfNumberOnlyBuilderImpl self() { + return this; + } + + @Override + public ArrayOfNumberOnly build() { + return new ArrayOfNumberOnly(this); + } + } + + public static abstract class ArrayOfNumberOnlyBuilder> { + private List arrayNumber = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ArrayTest.java new file mode 100644 index 000000000000..6e6e9d3dd2fc --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ArrayTest.java @@ -0,0 +1,225 @@ +package org.openapitools.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.ReadOnlyFirst; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ArrayTest") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ArrayTest implements Serializable { + private @Valid List arrayOfString = new ArrayList<>(); + private @Valid List> arrayArrayOfInteger = new ArrayList<>(); + private @Valid List> arrayArrayOfModel = new ArrayList<>(); + + protected ArrayTest(ArrayTestBuilder b) { + this.arrayOfString = b.arrayOfString; + this.arrayArrayOfInteger = b.arrayArrayOfInteger; + this.arrayArrayOfModel = b.arrayArrayOfModel; + } + + public ArrayTest() { + } + + /** + **/ + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_of_string") + @Size(min=0,max=3)public List getArrayOfString() { + return arrayOfString; + } + + @JsonProperty("array_of_string") + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList<>(); + } + + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + public ArrayTest removeArrayOfStringItem(String arrayOfStringItem) { + if (arrayOfStringItem != null && this.arrayOfString != null) { + this.arrayOfString.remove(arrayOfStringItem); + } + + return this; + } + /** + **/ + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_array_of_integer") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + @JsonProperty("array_array_of_integer") + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList<>(); + } + + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + public ArrayTest removeArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (arrayArrayOfIntegerItem != null && this.arrayArrayOfInteger != null) { + this.arrayArrayOfInteger.remove(arrayArrayOfIntegerItem); + } + + return this; + } + /** + **/ + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_array_of_model") + @Valid public List<@Valid List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + @JsonProperty("array_array_of_model") + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + public ArrayTest addArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList<>(); + } + + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + public ArrayTest removeArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) { + if (arrayArrayOfModelItem != null && this.arrayArrayOfModel != null) { + this.arrayArrayOfModel.remove(arrayArrayOfModelItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ArrayTestBuilder builder() { + return new ArrayTestBuilderImpl(); + } + + private static final class ArrayTestBuilderImpl extends ArrayTestBuilder { + + @Override + protected ArrayTestBuilderImpl self() { + return this; + } + + @Override + public ArrayTest build() { + return new ArrayTest(this); + } + } + + public static abstract class ArrayTestBuilder> { + private List arrayOfString = new ArrayList<>(); + private List> arrayArrayOfInteger = new ArrayList<>(); + private List> arrayArrayOfModel = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return self(); + } + public B arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return self(); + } + public B arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Capitalization.java new file mode 100644 index 000000000000..9ea63b2d30b2 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Capitalization.java @@ -0,0 +1,258 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Capitalization") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Capitalization implements Serializable { + private String smallCamel; + private String capitalCamel; + private String smallSnake; + private String capitalSnake; + private String scAETHFlowPoints; + private String ATT_NAME; + + protected Capitalization(CapitalizationBuilder b) { + this.smallCamel = b.smallCamel; + this.capitalCamel = b.capitalCamel; + this.smallSnake = b.smallSnake; + this.capitalSnake = b.capitalSnake; + this.scAETHFlowPoints = b.scAETHFlowPoints; + this.ATT_NAME = b.ATT_NAME; + } + + public Capitalization() { + } + + /** + **/ + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + + @Schema(description = "") + @JsonProperty("smallCamel") + public String getSmallCamel() { + return smallCamel; + } + + @JsonProperty("smallCamel") + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + /** + **/ + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + + @Schema(description = "") + @JsonProperty("CapitalCamel") + public String getCapitalCamel() { + return capitalCamel; + } + + @JsonProperty("CapitalCamel") + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + /** + **/ + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + + @Schema(description = "") + @JsonProperty("small_Snake") + public String getSmallSnake() { + return smallSnake; + } + + @JsonProperty("small_Snake") + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + /** + **/ + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + + @Schema(description = "") + @JsonProperty("Capital_Snake") + public String getCapitalSnake() { + return capitalSnake; + } + + @JsonProperty("Capital_Snake") + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + /** + **/ + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + + @Schema(description = "") + @JsonProperty("SCA_ETH_Flow_Points") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + @JsonProperty("SCA_ETH_Flow_Points") + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + /** + * Name of the pet + **/ + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + + @Schema(description = "Name of the pet ") + @JsonProperty("ATT_NAME") + public String getATTNAME() { + return ATT_NAME; + } + + @JsonProperty("ATT_NAME") + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static CapitalizationBuilder builder() { + return new CapitalizationBuilderImpl(); + } + + private static final class CapitalizationBuilderImpl extends CapitalizationBuilder { + + @Override + protected CapitalizationBuilderImpl self() { + return this; + } + + @Override + public Capitalization build() { + return new Capitalization(this); + } + } + + public static abstract class CapitalizationBuilder> { + private String smallCamel; + private String capitalCamel; + private String smallSnake; + private String capitalSnake; + private String scAETHFlowPoints; + private String ATT_NAME; + protected abstract B self(); + + public abstract C build(); + + public B smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return self(); + } + public B capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return self(); + } + public B smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return self(); + } + public B capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return self(); + } + public B scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return self(); + } + public B ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Cat.java new file mode 100644 index 000000000000..dcb069429389 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Cat.java @@ -0,0 +1,126 @@ +package org.openapitools.model; + +import org.openapitools.model.Animal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Cat") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Cat extends Animal implements Serializable { + private Boolean declawed; + + protected Cat(CatBuilder b) { + super(b); + this.declawed = b.declawed; + } + + public Cat() { + } + + @JsonCreator + public Cat( + @JsonProperty(required = true, value = "className") String className + ) { + super( + className + ); + } + + /** + **/ + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + + @Schema(description = "") + @JsonProperty("declawed") + public Boolean getDeclawed() { + return declawed; + } + + @JsonProperty("declawed") + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static CatBuilder builder() { + return new CatBuilderImpl(); + } + + private static final class CatBuilderImpl extends CatBuilder { + + @Override + protected CatBuilderImpl self() { + return this; + } + + @Override + public Cat build() { + return new Cat(this); + } + } + + public static abstract class CatBuilder> extends AnimalBuilder { + private Boolean declawed; + + public B declawed(Boolean declawed) { + this.declawed = declawed; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Category.java new file mode 100644 index 000000000000..28e68450d531 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Category.java @@ -0,0 +1,152 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Category") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Category implements Serializable { + private Long id; + private String name = "default-name"; + + protected Category(CategoryBuilder b) { + this.id = b.id; + this.name = b.name; + } + + public Category() { + } + + @JsonCreator + public Category( + @JsonProperty(required = true, value = "name") String name + ) { + this.name = name; + } + + /** + **/ + public Category id(Long id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Category name(String name) { + this.name = name; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "name") + @NotNull public String getName() { + return name; + } + + @JsonProperty(required = true, value = "name") + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static CategoryBuilder builder() { + return new CategoryBuilderImpl(); + } + + private static final class CategoryBuilderImpl extends CategoryBuilder { + + @Override + protected CategoryBuilderImpl self() { + return this; + } + + @Override + public Category build() { + return new Category(this); + } + } + + public static abstract class CategoryBuilder> { + private Long id; + private String name = "default-name"; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B name(String name) { + this.name = name; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ChildWithNullable.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ChildWithNullable.java new file mode 100644 index 000000000000..8f15e6f0df51 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ChildWithNullable.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import org.openapitools.jackson.nullable.JsonNullable; +import org.openapitools.model.ParentWithNullable; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ChildWithNullable") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ChildWithNullable extends ParentWithNullable implements Serializable { + private String otherProperty; + + protected ChildWithNullable(ChildWithNullableBuilder b) { + super(b); + this.otherProperty = b.otherProperty; + } + + public ChildWithNullable() { + } + + /** + **/ + public ChildWithNullable otherProperty(String otherProperty) { + this.otherProperty = otherProperty; + return this; + } + + + @Schema(description = "") + @JsonProperty("otherProperty") + public String getOtherProperty() { + return otherProperty; + } + + @JsonProperty("otherProperty") + public void setOtherProperty(String otherProperty) { + this.otherProperty = otherProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChildWithNullable childWithNullable = (ChildWithNullable) o; + return Objects.equals(this.otherProperty, childWithNullable.otherProperty) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(otherProperty, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChildWithNullable {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" otherProperty: ").append(toIndentedString(otherProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ChildWithNullableBuilder builder() { + return new ChildWithNullableBuilderImpl(); + } + + private static final class ChildWithNullableBuilderImpl extends ChildWithNullableBuilder { + + @Override + protected ChildWithNullableBuilderImpl self() { + return this; + } + + @Override + public ChildWithNullable build() { + return new ChildWithNullable(this); + } + } + + public static abstract class ChildWithNullableBuilder> extends ParentWithNullableBuilder { + private String otherProperty; + + public B otherProperty(String otherProperty) { + this.otherProperty = otherProperty; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ClassModel.java new file mode 100644 index 000000000000..65b40894b7e2 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ClassModel.java @@ -0,0 +1,119 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing model with \"_class\" property + **/ + +@Schema(description="Model for testing model with \"_class\" property") +@JsonTypeName("ClassModel") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ClassModel implements Serializable { + private String propertyClass; + + protected ClassModel(ClassModelBuilder b) { + this.propertyClass = b.propertyClass; + } + + public ClassModel() { + } + + /** + **/ + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + + @Schema(description = "") + @JsonProperty("_class") + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty("_class") + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ClassModelBuilder builder() { + return new ClassModelBuilderImpl(); + } + + private static final class ClassModelBuilderImpl extends ClassModelBuilder { + + @Override + protected ClassModelBuilderImpl self() { + return this; + } + + @Override + public ClassModel build() { + return new ClassModel(this); + } + } + + public static abstract class ClassModelBuilder> { + private String propertyClass; + protected abstract B self(); + + public abstract C build(); + + public B propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Client.java new file mode 100644 index 000000000000..2002b99e32ca --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Client.java @@ -0,0 +1,117 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Client") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Client implements Serializable { + private String client; + + protected Client(ClientBuilder b) { + this.client = b.client; + } + + public Client() { + } + + /** + **/ + public Client client(String client) { + this.client = client; + return this; + } + + + @Schema(description = "") + @JsonProperty("client") + public String getClient() { + return client; + } + + @JsonProperty("client") + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ClientBuilder builder() { + return new ClientBuilderImpl(); + } + + private static final class ClientBuilderImpl extends ClientBuilder { + + @Override + protected ClientBuilderImpl self() { + return this; + } + + @Override + public Client build() { + return new Client(this); + } + } + + public static abstract class ClientBuilder> { + private String client; + protected abstract B self(); + + public abstract C build(); + + public B client(String client) { + this.client = client; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/DeprecatedObject.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/DeprecatedObject.java new file mode 100644 index 000000000000..d46a439df2f6 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/DeprecatedObject.java @@ -0,0 +1,117 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("DeprecatedObject") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class DeprecatedObject implements Serializable { + private String name; + + protected DeprecatedObject(DeprecatedObjectBuilder b) { + this.name = b.name; + } + + public DeprecatedObject() { + } + + /** + **/ + public DeprecatedObject name(String name) { + this.name = name; + return this; + } + + + @Schema(description = "") + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeprecatedObject deprecatedObject = (DeprecatedObject) o; + return Objects.equals(this.name, deprecatedObject.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeprecatedObject {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static DeprecatedObjectBuilder builder() { + return new DeprecatedObjectBuilderImpl(); + } + + private static final class DeprecatedObjectBuilderImpl extends DeprecatedObjectBuilder { + + @Override + protected DeprecatedObjectBuilderImpl self() { + return this; + } + + @Override + public DeprecatedObject build() { + return new DeprecatedObject(this); + } + } + + public static abstract class DeprecatedObjectBuilder> { + private String name; + protected abstract B self(); + + public abstract C build(); + + public B name(String name) { + this.name = name; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Dog.java new file mode 100644 index 000000000000..e4dad61f7a19 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Dog.java @@ -0,0 +1,126 @@ +package org.openapitools.model; + +import org.openapitools.model.Animal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Dog") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Dog extends Animal implements Serializable { + private String breed; + + protected Dog(DogBuilder b) { + super(b); + this.breed = b.breed; + } + + public Dog() { + } + + @JsonCreator + public Dog( + @JsonProperty(required = true, value = "className") String className + ) { + super( + className + ); + } + + /** + **/ + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + + @Schema(description = "") + @JsonProperty("breed") + public String getBreed() { + return breed; + } + + @JsonProperty("breed") + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static DogBuilder builder() { + return new DogBuilderImpl(); + } + + private static final class DogBuilderImpl extends DogBuilder { + + @Override + protected DogBuilderImpl self() { + return this; + } + + @Override + public Dog build() { + return new Dog(this); + } + } + + public static abstract class DogBuilder> extends AnimalBuilder { + private String breed; + + public B breed(String breed) { + this.breed = breed; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/EnumArrays.java new file mode 100644 index 000000000000..cca78144e5e6 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/EnumArrays.java @@ -0,0 +1,258 @@ +package org.openapitools.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("EnumArrays") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class EnumArrays implements Serializable { + public enum JustSymbolEnum { + + GREATER_THAN_OR_EQUAL_TO(String.valueOf(">=")), DOLLAR(String.valueOf("$")); + + + private String value; + + JustSymbolEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static JustSymbolEnum fromString(String s) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String value) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private JustSymbolEnum justSymbol; + public enum ArrayEnumEnum { + + FISH(String.valueOf("fish")), CRAB(String.valueOf("crab")); + + + private String value; + + ArrayEnumEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static ArrayEnumEnum fromString(String s) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String value) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private @Valid List arrayEnum = new ArrayList<>(); + + protected EnumArrays(EnumArraysBuilder b) { + this.justSymbol = b.justSymbol; + this.arrayEnum = b.arrayEnum; + } + + public EnumArrays() { + } + + /** + **/ + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + + @Schema(description = "") + @JsonProperty("just_symbol") + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + @JsonProperty("just_symbol") + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + /** + **/ + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_enum") + public List getArrayEnum() { + return arrayEnum; + } + + @JsonProperty("array_enum") + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList<>(); + } + + this.arrayEnum.add(arrayEnumItem); + return this; + } + + public EnumArrays removeArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (arrayEnumItem != null && this.arrayEnum != null) { + this.arrayEnum.remove(arrayEnumItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static EnumArraysBuilder builder() { + return new EnumArraysBuilderImpl(); + } + + private static final class EnumArraysBuilderImpl extends EnumArraysBuilder { + + @Override + protected EnumArraysBuilderImpl self() { + return this; + } + + @Override + public EnumArrays build() { + return new EnumArrays(this); + } + } + + public static abstract class EnumArraysBuilder> { + private JustSymbolEnum justSymbol; + private List arrayEnum = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return self(); + } + public B arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/EnumClass.java new file mode 100644 index 000000000000..089a69da6da5 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/EnumClass.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumClass fromString(String s) { + for (EnumClass b : EnumClass.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/EnumTest.java new file mode 100644 index 000000000000..d1774f19ef5f --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/EnumTest.java @@ -0,0 +1,514 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.jackson.nullable.JsonNullable; +import org.openapitools.model.OuterEnum; +import org.openapitools.model.OuterEnumDefaultValue; +import org.openapitools.model.OuterEnumInteger; +import org.openapitools.model.OuterEnumIntegerDefaultValue; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Enum_Test") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class EnumTest implements Serializable { + public enum EnumStringEnum { + + UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")), EMPTY(String.valueOf("")); + + + private String value; + + EnumStringEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumStringEnum fromString(String s) { + for (EnumStringEnum b : EnumStringEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumStringEnum fromValue(String value) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumStringEnum enumString; + public enum EnumStringRequiredEnum { + + UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")), EMPTY(String.valueOf("")); + + + private String value; + + EnumStringRequiredEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumStringRequiredEnum fromString(String s) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String value) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumStringRequiredEnum enumStringRequired; + public enum EnumIntegerEnum { + + NUMBER_1(Integer.valueOf(1)), NUMBER_MINUS_1(Integer.valueOf(-1)); + + + private Integer value; + + EnumIntegerEnum (Integer v) { + value = v; + } + + public Integer value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumIntegerEnum fromString(String s) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(Integer value) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumIntegerEnum enumInteger; + public enum EnumNumberEnum { + + NUMBER_1_DOT_1(Double.valueOf(1.1)), NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2)); + + + private Double value; + + EnumNumberEnum (Double v) { + value = v; + } + + public Double value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into Double, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static EnumNumberEnum fromString(String s) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static EnumNumberEnum fromValue(Double value) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private EnumNumberEnum enumNumber; + private OuterEnum outerEnum; + private OuterEnumInteger outerEnumInteger; + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + + protected EnumTest(EnumTestBuilder b) { + this.enumString = b.enumString; + this.enumStringRequired = b.enumStringRequired; + this.enumInteger = b.enumInteger; + this.enumNumber = b.enumNumber; + this.outerEnum = b.outerEnum; + this.outerEnumInteger = b.outerEnumInteger; + this.outerEnumDefaultValue = b.outerEnumDefaultValue; + this.outerEnumIntegerDefaultValue = b.outerEnumIntegerDefaultValue; + } + + public EnumTest() { + } + + @JsonCreator + public EnumTest( + @JsonProperty(required = true, value = "enum_string_required") EnumStringRequiredEnum enumStringRequired + ) { + this.enumStringRequired = enumStringRequired; + } + + /** + **/ + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + + @Schema(description = "") + @JsonProperty("enum_string") + public EnumStringEnum getEnumString() { + return enumString; + } + + @JsonProperty("enum_string") + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + /** + **/ + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "enum_string_required") + @NotNull public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + @JsonProperty(required = true, value = "enum_string_required") + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + /** + **/ + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + + @Schema(description = "") + @JsonProperty("enum_integer") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + @JsonProperty("enum_integer") + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + /** + **/ + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + + @Schema(description = "") + @JsonProperty("enum_number") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + @JsonProperty("enum_number") + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + /** + **/ + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + + @Schema(description = "") + @JsonProperty("outerEnum") + public OuterEnum getOuterEnum() { + return outerEnum; + } + + @JsonProperty("outerEnum") + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + /** + **/ + public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return this; + } + + + @Schema(description = "") + @JsonProperty("outerEnumInteger") + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + @JsonProperty("outerEnumInteger") + public void setOuterEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + /** + **/ + public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + + @Schema(description = "") + @JsonProperty("outerEnumDefaultValue") + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + @JsonProperty("outerEnumDefaultValue") + public void setOuterEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + /** + **/ + public EnumTest outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + + @Schema(description = "") + @JsonProperty("outerEnumIntegerDefaultValue") + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + @JsonProperty("outerEnumIntegerDefaultValue") + public void setOuterEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum) && + Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) && + Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) && + Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static EnumTestBuilder builder() { + return new EnumTestBuilderImpl(); + } + + private static final class EnumTestBuilderImpl extends EnumTestBuilder { + + @Override + protected EnumTestBuilderImpl self() { + return this; + } + + @Override + public EnumTest build() { + return new EnumTest(this); + } + } + + public static abstract class EnumTestBuilder> { + private EnumStringEnum enumString; + private EnumStringRequiredEnum enumStringRequired; + private EnumIntegerEnum enumInteger; + private EnumNumberEnum enumNumber; + private OuterEnum outerEnum; + private OuterEnumInteger outerEnumInteger; + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + protected abstract B self(); + + public abstract C build(); + + public B enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return self(); + } + public B enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return self(); + } + public B enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return self(); + } + public B enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return self(); + } + public B outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return self(); + } + public B outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return self(); + } + public B outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return self(); + } + public B outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java new file mode 100644 index 000000000000..aafda9f9fe9c --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,165 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("fakeBigDecimalMap_200_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeBigDecimalMap200Response implements Serializable { + private BigDecimal someId; + private @Valid Map someMap = new HashMap<>(); + + protected FakeBigDecimalMap200Response(FakeBigDecimalMap200ResponseBuilder b) { + this.someId = b.someId; + this.someMap = b.someMap; + } + + public FakeBigDecimalMap200Response() { + } + + /** + **/ + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + this.someId = someId; + return this; + } + + + @Schema(description = "") + @JsonProperty("someId") + @Valid public BigDecimal getSomeId() { + return someId; + } + + @JsonProperty("someId") + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + /** + **/ + public FakeBigDecimalMap200Response someMap(Map someMap) { + this.someMap = someMap; + return this; + } + + + @Schema(description = "") + @JsonProperty("someMap") + @Valid public Map getSomeMap() { + return someMap; + } + + @JsonProperty("someMap") + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + + this.someMap.put(key, someMapItem); + return this; + } + + public FakeBigDecimalMap200Response removeSomeMapItem(String key) { + if (this.someMap != null) { + this.someMap.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FakeBigDecimalMap200ResponseBuilder builder() { + return new FakeBigDecimalMap200ResponseBuilderImpl(); + } + + private static final class FakeBigDecimalMap200ResponseBuilderImpl extends FakeBigDecimalMap200ResponseBuilder { + + @Override + protected FakeBigDecimalMap200ResponseBuilderImpl self() { + return this; + } + + @Override + public FakeBigDecimalMap200Response build() { + return new FakeBigDecimalMap200Response(this); + } + } + + public static abstract class FakeBigDecimalMap200ResponseBuilder> { + private BigDecimal someId; + private Map someMap = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B someId(BigDecimal someId) { + this.someId = someId; + return self(); + } + public B someMap(Map someMap) { + this.someMap = someMap; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java new file mode 100644 index 000000000000..3d236bb4b425 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FakeTestsDefaultsDefaultResponse.java @@ -0,0 +1,298 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.IntegerEnum; +import org.openapitools.model.StringEnum; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("fake_tests_defaults_default_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FakeTestsDefaultsDefaultResponse implements Serializable { + private StringEnum stringEnum = StringEnum.FOO; + private IntegerEnum integerEnum = IntegerEnum.NUMBER_1; + public enum StringEnumInlineEnum { + + FOO(String.valueOf("foo")), BAR(String.valueOf("bar")), BAZ(String.valueOf("baz")); + + + private String value; + + StringEnumInlineEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StringEnumInlineEnum fromString(String s) { + for (StringEnumInlineEnum b : StringEnumInlineEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static StringEnumInlineEnum fromValue(String value) { + for (StringEnumInlineEnum b : StringEnumInlineEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private StringEnumInlineEnum stringEnumInline = StringEnumInlineEnum.FOO; + public enum IntegerEnumInlineEnum { + + NUMBER_1(Integer.valueOf(1)), NUMBER_2(Integer.valueOf(2)), NUMBER_3(Integer.valueOf(3)); + + + private Integer value; + + IntegerEnumInlineEnum (Integer v) { + value = v; + } + + public Integer value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static IntegerEnumInlineEnum fromString(String s) { + for (IntegerEnumInlineEnum b : IntegerEnumInlineEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static IntegerEnumInlineEnum fromValue(Integer value) { + for (IntegerEnumInlineEnum b : IntegerEnumInlineEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private IntegerEnumInlineEnum integerEnumInline = IntegerEnumInlineEnum.NUMBER_1; + + protected FakeTestsDefaultsDefaultResponse(FakeTestsDefaultsDefaultResponseBuilder b) { + this.stringEnum = b.stringEnum; + this.integerEnum = b.integerEnum; + this.stringEnumInline = b.stringEnumInline; + this.integerEnumInline = b.integerEnumInline; + } + + public FakeTestsDefaultsDefaultResponse() { + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse stringEnum(StringEnum stringEnum) { + this.stringEnum = stringEnum; + return this; + } + + + @Schema(description = "") + @JsonProperty("stringEnum") + public StringEnum getStringEnum() { + return stringEnum; + } + + @JsonProperty("stringEnum") + public void setStringEnum(StringEnum stringEnum) { + this.stringEnum = stringEnum; + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse integerEnum(IntegerEnum integerEnum) { + this.integerEnum = integerEnum; + return this; + } + + + @Schema(description = "") + @JsonProperty("integerEnum") + public IntegerEnum getIntegerEnum() { + return integerEnum; + } + + @JsonProperty("integerEnum") + public void setIntegerEnum(IntegerEnum integerEnum) { + this.integerEnum = integerEnum; + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse stringEnumInline(StringEnumInlineEnum stringEnumInline) { + this.stringEnumInline = stringEnumInline; + return this; + } + + + @Schema(description = "") + @JsonProperty("stringEnumInline") + public StringEnumInlineEnum getStringEnumInline() { + return stringEnumInline; + } + + @JsonProperty("stringEnumInline") + public void setStringEnumInline(StringEnumInlineEnum stringEnumInline) { + this.stringEnumInline = stringEnumInline; + } + + /** + **/ + public FakeTestsDefaultsDefaultResponse integerEnumInline(IntegerEnumInlineEnum integerEnumInline) { + this.integerEnumInline = integerEnumInline; + return this; + } + + + @Schema(description = "") + @JsonProperty("integerEnumInline") + public IntegerEnumInlineEnum getIntegerEnumInline() { + return integerEnumInline; + } + + @JsonProperty("integerEnumInline") + public void setIntegerEnumInline(IntegerEnumInlineEnum integerEnumInline) { + this.integerEnumInline = integerEnumInline; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeTestsDefaultsDefaultResponse fakeTestsDefaultsDefaultResponse = (FakeTestsDefaultsDefaultResponse) o; + return Objects.equals(this.stringEnum, fakeTestsDefaultsDefaultResponse.stringEnum) && + Objects.equals(this.integerEnum, fakeTestsDefaultsDefaultResponse.integerEnum) && + Objects.equals(this.stringEnumInline, fakeTestsDefaultsDefaultResponse.stringEnumInline) && + Objects.equals(this.integerEnumInline, fakeTestsDefaultsDefaultResponse.integerEnumInline); + } + + @Override + public int hashCode() { + return Objects.hash(stringEnum, integerEnum, stringEnumInline, integerEnumInline); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeTestsDefaultsDefaultResponse {\n"); + + sb.append(" stringEnum: ").append(toIndentedString(stringEnum)).append("\n"); + sb.append(" integerEnum: ").append(toIndentedString(integerEnum)).append("\n"); + sb.append(" stringEnumInline: ").append(toIndentedString(stringEnumInline)).append("\n"); + sb.append(" integerEnumInline: ").append(toIndentedString(integerEnumInline)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FakeTestsDefaultsDefaultResponseBuilder builder() { + return new FakeTestsDefaultsDefaultResponseBuilderImpl(); + } + + private static final class FakeTestsDefaultsDefaultResponseBuilderImpl extends FakeTestsDefaultsDefaultResponseBuilder { + + @Override + protected FakeTestsDefaultsDefaultResponseBuilderImpl self() { + return this; + } + + @Override + public FakeTestsDefaultsDefaultResponse build() { + return new FakeTestsDefaultsDefaultResponse(this); + } + } + + public static abstract class FakeTestsDefaultsDefaultResponseBuilder> { + private StringEnum stringEnum = StringEnum.FOO; + private IntegerEnum integerEnum = IntegerEnum.NUMBER_1; + private StringEnumInlineEnum stringEnumInline = StringEnumInlineEnum.FOO; + private IntegerEnumInlineEnum integerEnumInline = IntegerEnumInlineEnum.NUMBER_1; + protected abstract B self(); + + public abstract C build(); + + public B stringEnum(StringEnum stringEnum) { + this.stringEnum = stringEnum; + return self(); + } + public B integerEnum(IntegerEnum integerEnum) { + this.integerEnum = integerEnum; + return self(); + } + public B stringEnumInline(StringEnumInlineEnum stringEnumInline) { + this.stringEnumInline = stringEnumInline; + return self(); + } + public B integerEnumInline(IntegerEnumInlineEnum integerEnumInline) { + this.integerEnumInline = integerEnumInline; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..b0808a981f93 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -0,0 +1,165 @@ +package org.openapitools.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.ModelFile; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("FileSchemaTestClass") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FileSchemaTestClass implements Serializable { + private ModelFile _file; + private @Valid List<@Valid ModelFile> files = new ArrayList<>(); + + protected FileSchemaTestClass(FileSchemaTestClassBuilder b) { + this._file = b._file; + this.files = b.files; + } + + public FileSchemaTestClass() { + } + + /** + **/ + public FileSchemaTestClass _file(ModelFile _file) { + this._file = _file; + return this; + } + + + @Schema(description = "") + @JsonProperty("file") + @Valid public ModelFile getFile() { + return _file; + } + + @JsonProperty("file") + public void setFile(ModelFile _file) { + this._file = _file; + } + + /** + **/ + public FileSchemaTestClass files(List<@Valid ModelFile> files) { + this.files = files; + return this; + } + + + @Schema(description = "") + @JsonProperty("files") + @Valid public List<@Valid ModelFile> getFiles() { + return files; + } + + @JsonProperty("files") + public void setFiles(List<@Valid ModelFile> files) { + this.files = files; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + + this.files.add(filesItem); + return this; + } + + public FileSchemaTestClass removeFilesItem(ModelFile filesItem) { + if (filesItem != null && this.files != null) { + this.files.remove(filesItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this._file, fileSchemaTestClass._file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(_file, files); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FileSchemaTestClassBuilder builder() { + return new FileSchemaTestClassBuilderImpl(); + } + + private static final class FileSchemaTestClassBuilderImpl extends FileSchemaTestClassBuilder { + + @Override + protected FileSchemaTestClassBuilderImpl self() { + return this; + } + + @Override + public FileSchemaTestClass build() { + return new FileSchemaTestClass(this); + } + } + + public static abstract class FileSchemaTestClassBuilder> { + private ModelFile _file; + private List files = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B _file(ModelFile _file) { + this._file = _file; + return self(); + } + public B files(List files) { + this.files = files; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Foo.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Foo.java new file mode 100644 index 000000000000..e999fb79b983 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Foo.java @@ -0,0 +1,117 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Foo") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Foo implements Serializable { + private String bar = "bar"; + + protected Foo(FooBuilder b) { + this.bar = b.bar; + } + + public Foo() { + } + + /** + **/ + public Foo bar(String bar) { + this.bar = bar; + return this; + } + + + @Schema(description = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + + @JsonProperty("bar") + public void setBar(String bar) { + this.bar = bar; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Foo foo = (Foo) o; + return Objects.equals(this.bar, foo.bar); + } + + @Override + public int hashCode() { + return Objects.hash(bar); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FooBuilder builder() { + return new FooBuilderImpl(); + } + + private static final class FooBuilderImpl extends FooBuilder { + + @Override + protected FooBuilderImpl self() { + return this; + } + + @Override + public Foo build() { + return new Foo(this); + } + } + + public static abstract class FooBuilder> { + private String bar = "bar"; + protected abstract B self(); + + public abstract C build(); + + public B bar(String bar) { + this.bar = bar; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java new file mode 100644 index 000000000000..b4fbcdd7c0dc --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java @@ -0,0 +1,119 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.openapitools.model.Foo; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("_foo_get_default_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FooGetDefaultResponse implements Serializable { + private Foo string; + + protected FooGetDefaultResponse(FooGetDefaultResponseBuilder b) { + this.string = b.string; + } + + public FooGetDefaultResponse() { + } + + /** + **/ + public FooGetDefaultResponse string(Foo string) { + this.string = string; + return this; + } + + + @Schema(description = "") + @JsonProperty("string") + @Valid public Foo getString() { + return string; + } + + @JsonProperty("string") + public void setString(Foo string) { + this.string = string; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(this.string, fooGetDefaultResponse.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FooGetDefaultResponseBuilder builder() { + return new FooGetDefaultResponseBuilderImpl(); + } + + private static final class FooGetDefaultResponseBuilderImpl extends FooGetDefaultResponseBuilder { + + @Override + protected FooGetDefaultResponseBuilderImpl self() { + return this; + } + + @Override + public FooGetDefaultResponse build() { + return new FooGetDefaultResponse(this); + } + } + + public static abstract class FooGetDefaultResponseBuilder> { + private Foo string; + protected abstract B self(); + + public abstract C build(); + + public B string(Foo string) { + this.string = string; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FormatTest.java new file mode 100644 index 000000000000..467a85e0a423 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/FormatTest.java @@ -0,0 +1,569 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.File; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.Date; +import java.util.UUID; +import org.joda.time.LocalDate; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("format_test") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class FormatTest implements Serializable { + private Integer integer; + private Integer int32; + private Long int64; + private BigDecimal number; + private Float _float; + private Double _double; + private BigDecimal decimal; + private String string; + private byte[] _byte; + private File binary; + private LocalDate date; + private Date dateTime; + private UUID uuid; + private String password; + private String patternWithDigits; + private String patternWithDigitsAndDelimiter; + + protected FormatTest(FormatTestBuilder b) { + this.integer = b.integer; + this.int32 = b.int32; + this.int64 = b.int64; + this.number = b.number; + this._float = b._float; + this._double = b._double; + this.decimal = b.decimal; + this.string = b.string; + this._byte = b._byte; + this.binary = b.binary; + this.date = b.date; + this.dateTime = b.dateTime; + this.uuid = b.uuid; + this.password = b.password; + this.patternWithDigits = b.patternWithDigits; + this.patternWithDigitsAndDelimiter = b.patternWithDigitsAndDelimiter; + } + + public FormatTest() { + } + + @JsonCreator + public FormatTest( + @JsonProperty(required = true, value = "number") BigDecimal number, + @JsonProperty(required = true, value = "byte") byte[] _byte, + @JsonProperty(required = true, value = "date") LocalDate date, + @JsonProperty(required = true, value = "password") String password + ) { + this.number = number; + this._byte = _byte; + this.date = date; + this.password = password; + } + + /** + * minimum: 10 + * maximum: 100 + **/ + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + + @Schema(description = "") + @JsonProperty("integer") + @Min(10) @Max(100)public Integer getInteger() { + return integer; + } + + @JsonProperty("integer") + public void setInteger(Integer integer) { + this.integer = integer; + } + + /** + * minimum: 20 + * maximum: 200 + **/ + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + + @Schema(description = "") + @JsonProperty("int32") + @Min(20) @Max(200)public Integer getInt32() { + return int32; + } + + @JsonProperty("int32") + public void setInt32(Integer int32) { + this.int32 = int32; + } + + /** + **/ + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + + @Schema(description = "") + @JsonProperty("int64") + public Long getInt64() { + return int64; + } + + @JsonProperty("int64") + public void setInt64(Long int64) { + this.int64 = int64; + } + + /** + * minimum: 32.1 + * maximum: 543.2 + **/ + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "number") + @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2")public BigDecimal getNumber() { + return number; + } + + @JsonProperty(required = true, value = "number") + public void setNumber(BigDecimal number) { + this.number = number; + } + + /** + * minimum: 54.3 + * maximum: 987.6 + **/ + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + + @Schema(description = "") + @JsonProperty("float") + @DecimalMin("54.3") @DecimalMax("987.6")public Float getFloat() { + return _float; + } + + @JsonProperty("float") + public void setFloat(Float _float) { + this._float = _float; + } + + /** + * minimum: 67.8 + * maximum: 123.4 + **/ + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + + @Schema(description = "") + @JsonProperty("double") + @DecimalMin("67.8") @DecimalMax("123.4")public Double getDouble() { + return _double; + } + + @JsonProperty("double") + public void setDouble(Double _double) { + this._double = _double; + } + + /** + **/ + public FormatTest decimal(BigDecimal decimal) { + this.decimal = decimal; + return this; + } + + + @Schema(description = "") + @JsonProperty("decimal") + @Valid public BigDecimal getDecimal() { + return decimal; + } + + @JsonProperty("decimal") + public void setDecimal(BigDecimal decimal) { + this.decimal = decimal; + } + + /** + **/ + public FormatTest string(String string) { + this.string = string; + return this; + } + + + @Schema(description = "") + @JsonProperty("string") + @Pattern(regexp="/[a-z]/i")public String getString() { + return string; + } + + @JsonProperty("string") + public void setString(String string) { + this.string = string; + } + + /** + **/ + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "byte") + @NotNull public byte[] getByte() { + return _byte; + } + + @JsonProperty(required = true, value = "byte") + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + /** + **/ + public FormatTest binary(File binary) { + this.binary = binary; + return this; + } + + + @Schema(description = "") + @JsonProperty("binary") + public File getBinary() { + return binary; + } + + @JsonProperty("binary") + public void setBinary(File binary) { + this.binary = binary; + } + + /** + **/ + public FormatTest date(LocalDate date) { + this.date = date; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "date") + @NotNull public LocalDate getDate() { + return date; + } + + @JsonProperty(required = true, value = "date") + public void setDate(LocalDate date) { + this.date = date; + } + + /** + **/ + public FormatTest dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + + @Schema(description = "") + @JsonProperty("dateTime") + public Date getDateTime() { + return dateTime; + } + + @JsonProperty("dateTime") + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + + @Schema(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", description = "") + @JsonProperty("uuid") + public UUID getUuid() { + return uuid; + } + + @JsonProperty("uuid") + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + /** + **/ + public FormatTest password(String password) { + this.password = password; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "password") + @NotNull @Size(min=10,max=64)public String getPassword() { + return password; + } + + @JsonProperty(required = true, value = "password") + public void setPassword(String password) { + this.password = password; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + **/ + public FormatTest patternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return this; + } + + + @Schema(description = "A string that is a 10 digit number. Can have leading zeros.") + @JsonProperty("pattern_with_digits") + @Pattern(regexp="^\\d{10}$")public String getPatternWithDigits() { + return patternWithDigits; + } + + @JsonProperty("pattern_with_digits") + public void setPatternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + **/ + public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + + @Schema(description = "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + @JsonProperty("pattern_with_digits_and_delimiter") + @Pattern(regexp="/^image_\\d{1,3}$/i")public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + @JsonProperty("pattern_with_digits_and_delimiter") + public void setPatternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.decimal, formatTest.decimal) && + Objects.equals(this.string, formatTest.string) && + Arrays.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password) && + Objects.equals(this.patternWithDigits, formatTest.patternWithDigits) && + Objects.equals(this.patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, decimal, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" decimal: ").append(toIndentedString(decimal)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append("*").append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static FormatTestBuilder builder() { + return new FormatTestBuilderImpl(); + } + + private static final class FormatTestBuilderImpl extends FormatTestBuilder { + + @Override + protected FormatTestBuilderImpl self() { + return this; + } + + @Override + public FormatTest build() { + return new FormatTest(this); + } + } + + public static abstract class FormatTestBuilder> { + private Integer integer; + private Integer int32; + private Long int64; + private BigDecimal number; + private Float _float; + private Double _double; + private BigDecimal decimal; + private String string; + private byte[] _byte; + private File binary; + private LocalDate date; + private Date dateTime; + private UUID uuid; + private String password; + private String patternWithDigits; + private String patternWithDigitsAndDelimiter; + protected abstract B self(); + + public abstract C build(); + + public B integer(Integer integer) { + this.integer = integer; + return self(); + } + public B int32(Integer int32) { + this.int32 = int32; + return self(); + } + public B int64(Long int64) { + this.int64 = int64; + return self(); + } + public B number(BigDecimal number) { + this.number = number; + return self(); + } + public B _float(Float _float) { + this._float = _float; + return self(); + } + public B _double(Double _double) { + this._double = _double; + return self(); + } + public B decimal(BigDecimal decimal) { + this.decimal = decimal; + return self(); + } + public B string(String string) { + this.string = string; + return self(); + } + public B _byte(byte[] _byte) { + this._byte = _byte; + return self(); + } + public B binary(File binary) { + this.binary = binary; + return self(); + } + public B date(LocalDate date) { + this.date = date; + return self(); + } + public B dateTime(Date dateTime) { + this.dateTime = dateTime; + return self(); + } + public B uuid(UUID uuid) { + this.uuid = uuid; + return self(); + } + public B password(String password) { + this.password = password; + return self(); + } + public B patternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return self(); + } + public B patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..04b430103b61 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -0,0 +1,146 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("hasOnlyReadOnly") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class HasOnlyReadOnly implements Serializable { + private String bar; + private String foo; + + protected HasOnlyReadOnly(HasOnlyReadOnlyBuilder b) { + this.bar = b.bar; + this.foo = b.foo; + } + + public HasOnlyReadOnly() { + } + + /** + **/ + public HasOnlyReadOnly bar(String bar) { + this.bar = bar; + return this; + } + + + @Schema(description = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + + @JsonProperty("bar") + public void setBar(String bar) { + this.bar = bar; + } + + /** + **/ + public HasOnlyReadOnly foo(String foo) { + this.foo = foo; + return this; + } + + + @Schema(description = "") + @JsonProperty("foo") + public String getFoo() { + return foo; + } + + @JsonProperty("foo") + public void setFoo(String foo) { + this.foo = foo; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HasOnlyReadOnlyBuilder builder() { + return new HasOnlyReadOnlyBuilderImpl(); + } + + private static final class HasOnlyReadOnlyBuilderImpl extends HasOnlyReadOnlyBuilder { + + @Override + protected HasOnlyReadOnlyBuilderImpl self() { + return this; + } + + @Override + public HasOnlyReadOnly build() { + return new HasOnlyReadOnly(this); + } + } + + public static abstract class HasOnlyReadOnlyBuilder> { + private String bar; + private String foo; + protected abstract B self(); + + public abstract C build(); + + public B bar(String bar) { + this.bar = bar; + return self(); + } + public B foo(String foo) { + this.foo = foo; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/HealthCheckResult.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/HealthCheckResult.java new file mode 100644 index 000000000000..c3faaee75882 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/HealthCheckResult.java @@ -0,0 +1,120 @@ +package org.openapitools.model; + +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + **/ + +@Schema(description="Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.") +@JsonTypeName("HealthCheckResult") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class HealthCheckResult implements Serializable { + private String nullableMessage; + + protected HealthCheckResult(HealthCheckResultBuilder b) { + this.nullableMessage = b.nullableMessage; + } + + public HealthCheckResult() { + } + + /** + **/ + public HealthCheckResult nullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + return this; + } + + + @Schema(description = "") + @JsonProperty("NullableMessage") + public String getNullableMessage() { + return nullableMessage; + } + + @JsonProperty("NullableMessage") + public void setNullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return Objects.equals(this.nullableMessage, healthCheckResult.nullableMessage); + } + + @Override + public int hashCode() { + return Objects.hash(nullableMessage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HealthCheckResultBuilder builder() { + return new HealthCheckResultBuilderImpl(); + } + + private static final class HealthCheckResultBuilderImpl extends HealthCheckResultBuilder { + + @Override + protected HealthCheckResultBuilderImpl self() { + return this; + } + + @Override + public HealthCheckResult build() { + return new HealthCheckResult(this); + } + } + + public static abstract class HealthCheckResultBuilder> { + private String nullableMessage; + protected abstract B self(); + + public abstract C build(); + + public B nullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/IntegerEnum.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/IntegerEnum.java new file mode 100644 index 000000000000..01c18bf99ad2 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/IntegerEnum.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets IntegerEnum + */ +public enum IntegerEnum { + + NUMBER_1(1), + + NUMBER_2(2), + + NUMBER_3(3); + + private Integer value; + + IntegerEnum(Integer value) { + this.value = value; + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static IntegerEnum fromString(String s) { + for (IntegerEnum b : IntegerEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static IntegerEnum fromValue(Integer value) { + for (IntegerEnum b : IntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/MapTest.java new file mode 100644 index 000000000000..d2c47955a0d2 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/MapTest.java @@ -0,0 +1,314 @@ +package org.openapitools.model; + +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("MapTest") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class MapTest implements Serializable { + private @Valid Map> mapMapOfString = new HashMap<>(); + public enum InnerEnum { + + UPPER(String.valueOf("UPPER")), LOWER(String.valueOf("lower")); + + + private String value; + + InnerEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static InnerEnum fromString(String s) { + for (InnerEnum b : InnerEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static InnerEnum fromValue(String value) { + for (InnerEnum b : InnerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private @Valid Map mapOfEnumString = new HashMap<>(); + private @Valid Map directMap = new HashMap<>(); + private @Valid Map indirectMap = new HashMap<>(); + + protected MapTest(MapTestBuilder b) { + this.mapMapOfString = b.mapMapOfString; + this.mapOfEnumString = b.mapOfEnumString; + this.directMap = b.directMap; + this.indirectMap = b.indirectMap; + } + + public MapTest() { + } + + /** + **/ + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + + @Schema(description = "") + @JsonProperty("map_map_of_string") + public Map> getMapMapOfString() { + return mapMapOfString; + } + + @JsonProperty("map_map_of_string") + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap<>(); + } + + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + public MapTest removeMapMapOfStringItem(String key) { + if (this.mapMapOfString != null) { + this.mapMapOfString.remove(key); + } + + return this; + } + /** + **/ + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + + @Schema(description = "") + @JsonProperty("map_of_enum_string") + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + @JsonProperty("map_of_enum_string") + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap<>(); + } + + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + public MapTest removeMapOfEnumStringItem(String key) { + if (this.mapOfEnumString != null) { + this.mapOfEnumString.remove(key); + } + + return this; + } + /** + **/ + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + + @Schema(description = "") + @JsonProperty("direct_map") + public Map getDirectMap() { + return directMap; + } + + @JsonProperty("direct_map") + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap<>(); + } + + this.directMap.put(key, directMapItem); + return this; + } + + public MapTest removeDirectMapItem(String key) { + if (this.directMap != null) { + this.directMap.remove(key); + } + + return this; + } + /** + **/ + public MapTest indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + + @Schema(description = "") + @JsonProperty("indirect_map") + public Map getIndirectMap() { + return indirectMap; + } + + @JsonProperty("indirect_map") + public void setIndirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + + this.indirectMap.put(key, indirectMapItem); + return this; + } + + public MapTest removeIndirectMapItem(String key) { + if (this.indirectMap != null) { + this.indirectMap.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static MapTestBuilder builder() { + return new MapTestBuilderImpl(); + } + + private static final class MapTestBuilderImpl extends MapTestBuilder { + + @Override + protected MapTestBuilderImpl self() { + return this; + } + + @Override + public MapTest build() { + return new MapTest(this); + } + } + + public static abstract class MapTestBuilder> { + private Map> mapMapOfString = new HashMap<>(); + private Map mapOfEnumString = new HashMap<>(); + private Map directMap = new HashMap<>(); + private Map indirectMap = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return self(); + } + public B mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return self(); + } + public B directMap(Map directMap) { + this.directMap = directMap; + return self(); + } + public B indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..7794077e6950 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,194 @@ +package org.openapitools.model; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.model.Animal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("MixedPropertiesAndAdditionalPropertiesClass") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class MixedPropertiesAndAdditionalPropertiesClass implements Serializable { + private UUID uuid; + private Date dateTime; + private @Valid Map map = new HashMap<>(); + + protected MixedPropertiesAndAdditionalPropertiesClass(MixedPropertiesAndAdditionalPropertiesClassBuilder b) { + this.uuid = b.uuid; + this.dateTime = b.dateTime; + this.map = b.map; + } + + public MixedPropertiesAndAdditionalPropertiesClass() { + } + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + + @Schema(description = "") + @JsonProperty("uuid") + public UUID getUuid() { + return uuid; + } + + @JsonProperty("uuid") + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + + @Schema(description = "") + @JsonProperty("dateTime") + public Date getDateTime() { + return dateTime; + } + + @JsonProperty("dateTime") + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + + @Schema(description = "") + @JsonProperty("map") + @Valid public Map getMap() { + return map; + } + + @JsonProperty("map") + public void setMap(Map map) { + this.map = map; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap<>(); + } + + this.map.put(key, mapItem); + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass removeMapItem(String key) { + if (this.map != null) { + this.map.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static MixedPropertiesAndAdditionalPropertiesClassBuilder builder() { + return new MixedPropertiesAndAdditionalPropertiesClassBuilderImpl(); + } + + private static final class MixedPropertiesAndAdditionalPropertiesClassBuilderImpl extends MixedPropertiesAndAdditionalPropertiesClassBuilder { + + @Override + protected MixedPropertiesAndAdditionalPropertiesClassBuilderImpl self() { + return this; + } + + @Override + public MixedPropertiesAndAdditionalPropertiesClass build() { + return new MixedPropertiesAndAdditionalPropertiesClass(this); + } + } + + public static abstract class MixedPropertiesAndAdditionalPropertiesClassBuilder> { + private UUID uuid; + private Date dateTime; + private Map map = new HashMap<>(); + protected abstract B self(); + + public abstract C build(); + + public B uuid(UUID uuid) { + this.uuid = uuid; + return self(); + } + public B dateTime(Date dateTime) { + this.dateTime = dateTime; + return self(); + } + public B map(Map map) { + this.map = map; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Model200Response.java new file mode 100644 index 000000000000..db2848fd996f --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Model200Response.java @@ -0,0 +1,148 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing model name starting with number + **/ + +@Schema(description="Model for testing model name starting with number") +@JsonTypeName("200_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Model200Response implements Serializable { + private Integer name; + private String propertyClass; + + protected Model200Response(Model200ResponseBuilder b) { + this.name = b.name; + this.propertyClass = b.propertyClass; + } + + public Model200Response() { + } + + /** + **/ + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + + @Schema(description = "") + @JsonProperty("name") + public Integer getName() { + return name; + } + + @JsonProperty("name") + public void setName(Integer name) { + this.name = name; + } + + /** + **/ + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + + @Schema(description = "") + @JsonProperty("class") + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty("class") + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static Model200ResponseBuilder builder() { + return new Model200ResponseBuilderImpl(); + } + + private static final class Model200ResponseBuilderImpl extends Model200ResponseBuilder { + + @Override + protected Model200ResponseBuilderImpl self() { + return this; + } + + @Override + public Model200Response build() { + return new Model200Response(this); + } + } + + public static abstract class Model200ResponseBuilder> { + private Integer name; + private String propertyClass; + protected abstract B self(); + + public abstract C build(); + + public B name(Integer name) { + this.name = name; + return self(); + } + public B propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelApiResponse.java new file mode 100644 index 000000000000..3512064eebc5 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -0,0 +1,174 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ApiResponse") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelApiResponse implements Serializable { + private Integer code; + private String type; + private String message; + + protected ModelApiResponse(ModelApiResponseBuilder b) { + this.code = b.code; + this.type = b.type; + this.message = b.message; + } + + public ModelApiResponse() { + } + + /** + **/ + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + + @Schema(description = "") + @JsonProperty("code") + public Integer getCode() { + return code; + } + + @JsonProperty("code") + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + + @Schema(description = "") + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + /** + **/ + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + + @Schema(description = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + + @JsonProperty("message") + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelApiResponseBuilder builder() { + return new ModelApiResponseBuilderImpl(); + } + + private static final class ModelApiResponseBuilderImpl extends ModelApiResponseBuilder { + + @Override + protected ModelApiResponseBuilderImpl self() { + return this; + } + + @Override + public ModelApiResponse build() { + return new ModelApiResponse(this); + } + } + + public static abstract class ModelApiResponseBuilder> { + private Integer code; + private String type; + private String message; + protected abstract B self(); + + public abstract C build(); + + public B code(Integer code) { + this.code = code; + return self(); + } + public B type(String type) { + this.type = type; + return self(); + } + public B message(String message) { + this.message = message; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelFile.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelFile.java new file mode 100644 index 000000000000..6481a56724dd --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelFile.java @@ -0,0 +1,121 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Must be named `File` for test. + **/ + +@Schema(description="Must be named `File` for test.") +@JsonTypeName("File") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelFile implements Serializable { + private String sourceURI; + + protected ModelFile(ModelFileBuilder b) { + this.sourceURI = b.sourceURI; + } + + public ModelFile() { + } + + /** + * Test capitalization + **/ + public ModelFile sourceURI(String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + + @Schema(description = "Test capitalization") + @JsonProperty("sourceURI") + public String getSourceURI() { + return sourceURI; + } + + @JsonProperty("sourceURI") + public void setSourceURI(String sourceURI) { + this.sourceURI = sourceURI; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelFile _file = (ModelFile) o; + return Objects.equals(this.sourceURI, _file.sourceURI); + } + + @Override + public int hashCode() { + return Objects.hash(sourceURI); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelFileBuilder builder() { + return new ModelFileBuilderImpl(); + } + + private static final class ModelFileBuilderImpl extends ModelFileBuilder { + + @Override + protected ModelFileBuilderImpl self() { + return this; + } + + @Override + public ModelFile build() { + return new ModelFile(this); + } + } + + public static abstract class ModelFileBuilder> { + private String sourceURI; + protected abstract B self(); + + public abstract C build(); + + public B sourceURI(String sourceURI) { + this.sourceURI = sourceURI; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelList.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelList.java new file mode 100644 index 000000000000..0418b0742f00 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelList.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("List") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelList implements Serializable { + private String _123list; + + protected ModelList(ModelListBuilder b) { + this._123list = b._123list; + } + + public ModelList() { + } + + /** + **/ + public ModelList _123list(String _123list) { + this._123list = _123list; + return this; + } + + + @Schema(description = "") + @JsonProperty("123-list") + public String get123list() { + return _123list; + } + + @JsonProperty("123-list") + public void set123list(String _123list) { + this._123list = _123list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelList _list = (ModelList) o; + return Objects.equals(this._123list, _list._123list); + } + + @Override + public int hashCode() { + return Objects.hash(_123list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + + sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelListBuilder builder() { + return new ModelListBuilderImpl(); + } + + private static final class ModelListBuilderImpl extends ModelListBuilder { + + @Override + protected ModelListBuilderImpl self() { + return this; + } + + @Override + public ModelList build() { + return new ModelList(this); + } + } + + public static abstract class ModelListBuilder> { + private String _123list; + protected abstract B self(); + + public abstract C build(); + + public B _123list(String _123list) { + this._123list = _123list; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelReturn.java new file mode 100644 index 000000000000..21708ddb78ab --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ModelReturn.java @@ -0,0 +1,120 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing reserved words + **/ + +@Schema(description="Model for testing reserved words") +@JsonTypeName("Return") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ModelReturn implements Serializable { + private Integer _return; + + protected ModelReturn(ModelReturnBuilder b) { + this._return = b._return; + } + + public ModelReturn() { + } + + /** + **/ + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + + @Schema(description = "") + @JsonProperty("return") + public Integer getReturn() { + return _return; + } + + @JsonProperty("return") + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ModelReturnBuilder builder() { + return new ModelReturnBuilderImpl(); + } + + private static final class ModelReturnBuilderImpl extends ModelReturnBuilder { + + @Override + protected ModelReturnBuilderImpl self() { + return this; + } + + @Override + public ModelReturn build() { + return new ModelReturn(this); + } + } + + public static abstract class ModelReturnBuilder> { + private Integer _return; + protected abstract B self(); + + public abstract C build(); + + public B _return(Integer _return) { + this._return = _return; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Name.java new file mode 100644 index 000000000000..1093dc026082 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Name.java @@ -0,0 +1,210 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Model for testing model name same as property name + **/ + +@Schema(description="Model for testing model name same as property name") +@JsonTypeName("Name") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Name implements Serializable { + private Integer name; + private Integer snakeCase; + private String property; + private Integer _123number; + + protected Name(NameBuilder b) { + this.name = b.name; + this.snakeCase = b.snakeCase; + this.property = b.property; + this._123number = b._123number; + } + + public Name() { + } + + @JsonCreator + public Name( + @JsonProperty(required = true, value = "name") Integer name + ) { + this.name = name; + } + + /** + **/ + public Name name(Integer name) { + this.name = name; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "name") + @NotNull public Integer getName() { + return name; + } + + @JsonProperty(required = true, value = "name") + public void setName(Integer name) { + this.name = name; + } + + /** + **/ + public Name snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return this; + } + + + @Schema(description = "") + @JsonProperty("snake_case") + public Integer getSnakeCase() { + return snakeCase; + } + + @JsonProperty("snake_case") + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + + /** + **/ + public Name property(String property) { + this.property = property; + return this; + } + + + @Schema(description = "") + @JsonProperty("property") + public String getProperty() { + return property; + } + + @JsonProperty("property") + public void setProperty(String property) { + this.property = property; + } + + /** + **/ + public Name _123number(Integer _123number) { + this._123number = _123number; + return this; + } + + + @Schema(description = "") + @JsonProperty("123Number") + public Integer get123number() { + return _123number; + } + + @JsonProperty("123Number") + public void set123number(Integer _123number) { + this._123number = _123number; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static NameBuilder builder() { + return new NameBuilderImpl(); + } + + private static final class NameBuilderImpl extends NameBuilder { + + @Override + protected NameBuilderImpl self() { + return this; + } + + @Override + public Name build() { + return new Name(this); + } + } + + public static abstract class NameBuilder> { + private Integer name; + private Integer snakeCase; + private String property; + private Integer _123number; + protected abstract B self(); + + public abstract C build(); + + public B name(Integer name) { + this.name = name; + return self(); + } + public B snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return self(); + } + public B property(String property) { + this.property = property; + return self(); + } + public B _123number(Integer _123number) { + this._123number = _123number; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/NullableClass.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/NullableClass.java new file mode 100644 index 000000000000..ba7ab0f5d832 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/NullableClass.java @@ -0,0 +1,433 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.joda.time.LocalDate; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("NullableClass") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class NullableClass extends HashMap implements Serializable { + private Integer integerProp; + private BigDecimal numberProp; + private Boolean booleanProp; + private String stringProp; + private LocalDate dateProp; + private Date datetimeProp; + private @Valid List arrayNullableProp; + private @Valid List arrayAndItemsNullableProp; + private @Valid List arrayItemsNullable = new ArrayList<>(); + private @Valid Map objectNullableProp; + private @Valid Map objectAndItemsNullableProp; + private @Valid Map objectItemsNullable = new HashMap<>(); + + public NullableClass() { + } + + /** + **/ + public NullableClass integerProp(Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("integer_prop") + public Integer getIntegerProp() { + return integerProp; + } + + @JsonProperty("integer_prop") + public void setIntegerProp(Integer integerProp) { + this.integerProp = integerProp; + } + + /** + **/ + public NullableClass numberProp(BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("number_prop") + @Valid public BigDecimal getNumberProp() { + return numberProp; + } + + @JsonProperty("number_prop") + public void setNumberProp(BigDecimal numberProp) { + this.numberProp = numberProp; + } + + /** + **/ + public NullableClass booleanProp(Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("boolean_prop") + public Boolean getBooleanProp() { + return booleanProp; + } + + @JsonProperty("boolean_prop") + public void setBooleanProp(Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + /** + **/ + public NullableClass stringProp(String stringProp) { + this.stringProp = stringProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("string_prop") + public String getStringProp() { + return stringProp; + } + + @JsonProperty("string_prop") + public void setStringProp(String stringProp) { + this.stringProp = stringProp; + } + + /** + **/ + public NullableClass dateProp(LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("date_prop") + public LocalDate getDateProp() { + return dateProp; + } + + @JsonProperty("date_prop") + public void setDateProp(LocalDate dateProp) { + this.dateProp = dateProp; + } + + /** + **/ + public NullableClass datetimeProp(Date datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("datetime_prop") + public Date getDatetimeProp() { + return datetimeProp; + } + + @JsonProperty("datetime_prop") + public void setDatetimeProp(Date datetimeProp) { + this.datetimeProp = datetimeProp; + } + + /** + **/ + public NullableClass arrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_nullable_prop") + public List getArrayNullableProp() { + return arrayNullableProp; + } + + @JsonProperty("array_nullable_prop") + public void setArrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + public NullableClass removeArrayNullablePropItem(Object arrayNullablePropItem) { + if (arrayNullablePropItem != null && this.arrayNullableProp != null) { + this.arrayNullableProp.remove(arrayNullablePropItem); + } + + return this; + } + /** + **/ + public NullableClass arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_and_items_nullable_prop") + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + @JsonProperty("array_and_items_nullable_prop") + public void setArrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + public NullableClass removeArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (arrayAndItemsNullablePropItem != null && this.arrayAndItemsNullableProp != null) { + this.arrayAndItemsNullableProp.remove(arrayAndItemsNullablePropItem); + } + + return this; + } + /** + **/ + public NullableClass arrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + + @Schema(description = "") + @JsonProperty("array_items_nullable") + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + @JsonProperty("array_items_nullable") + public void setArrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + public NullableClass removeArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (arrayItemsNullableItem != null && this.arrayItemsNullable != null) { + this.arrayItemsNullable.remove(arrayItemsNullableItem); + } + + return this; + } + /** + **/ + public NullableClass objectNullableProp(Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("object_nullable_prop") + public Map getObjectNullableProp() { + return objectNullableProp; + } + + @JsonProperty("object_nullable_prop") + public void setObjectNullableProp(Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + public NullableClass removeObjectNullablePropItem(String key) { + if (this.objectNullableProp != null) { + this.objectNullableProp.remove(key); + } + + return this; + } + /** + **/ + public NullableClass objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + + @Schema(description = "") + @JsonProperty("object_and_items_nullable_prop") + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + @JsonProperty("object_and_items_nullable_prop") + public void setObjectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + public NullableClass removeObjectAndItemsNullablePropItem(String key) { + if (this.objectAndItemsNullableProp != null) { + this.objectAndItemsNullableProp.remove(key); + } + + return this; + } + /** + **/ + public NullableClass objectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + return this; + } + + + @Schema(description = "") + @JsonProperty("object_items_nullable") + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + @JsonProperty("object_items_nullable") + public void setObjectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + if (this.objectItemsNullable == null) { + this.objectItemsNullable = new HashMap<>(); + } + + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + public NullableClass removeObjectItemsNullableItem(String key) { + if (this.objectItemsNullable != null) { + this.objectItemsNullable.remove(key); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableClass nullableClass = (NullableClass) o; + return Objects.equals(this.integerProp, nullableClass.integerProp) && + Objects.equals(this.numberProp, nullableClass.numberProp) && + Objects.equals(this.booleanProp, nullableClass.booleanProp) && + Objects.equals(this.stringProp, nullableClass.stringProp) && + Objects.equals(this.dateProp, nullableClass.dateProp) && + Objects.equals(this.datetimeProp, nullableClass.datetimeProp) && + Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) && + Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) && + Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) && + Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) && + Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && + Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); + sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); + sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); + sb.append(" stringProp: ").append(toIndentedString(stringProp)).append("\n"); + sb.append(" dateProp: ").append(toIndentedString(dateProp)).append("\n"); + sb.append(" datetimeProp: ").append(toIndentedString(datetimeProp)).append("\n"); + sb.append(" arrayNullableProp: ").append(toIndentedString(arrayNullableProp)).append("\n"); + sb.append(" arrayAndItemsNullableProp: ").append(toIndentedString(arrayAndItemsNullableProp)).append("\n"); + sb.append(" arrayItemsNullable: ").append(toIndentedString(arrayItemsNullable)).append("\n"); + sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); + sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); + sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/NumberOnly.java new file mode 100644 index 000000000000..1057c0ba31d3 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/NumberOnly.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("NumberOnly") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class NumberOnly implements Serializable { + private BigDecimal justNumber; + + protected NumberOnly(NumberOnlyBuilder b) { + this.justNumber = b.justNumber; + } + + public NumberOnly() { + } + + /** + **/ + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + + @Schema(description = "") + @JsonProperty("JustNumber") + @Valid public BigDecimal getJustNumber() { + return justNumber; + } + + @JsonProperty("JustNumber") + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static NumberOnlyBuilder builder() { + return new NumberOnlyBuilderImpl(); + } + + private static final class NumberOnlyBuilderImpl extends NumberOnlyBuilder { + + @Override + protected NumberOnlyBuilderImpl self() { + return this; + } + + @Override + public NumberOnly build() { + return new NumberOnly(this); + } + } + + public static abstract class NumberOnlyBuilder> { + private BigDecimal justNumber; + protected abstract B self(); + + public abstract C build(); + + public B justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java new file mode 100644 index 000000000000..a28d3f2cc723 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java @@ -0,0 +1,222 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.DeprecatedObject; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ObjectWithDeprecatedFields") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ObjectWithDeprecatedFields implements Serializable { + private String uuid; + private BigDecimal id; + private DeprecatedObject deprecatedRef; + private @Valid List bars = new ArrayList<>(); + + protected ObjectWithDeprecatedFields(ObjectWithDeprecatedFieldsBuilder b) { + this.uuid = b.uuid; + this.id = b.id; + this.deprecatedRef = b.deprecatedRef; + this.bars = b.bars; + } + + public ObjectWithDeprecatedFields() { + } + + /** + **/ + public ObjectWithDeprecatedFields uuid(String uuid) { + this.uuid = uuid; + return this; + } + + + @Schema(description = "") + @JsonProperty("uuid") + public String getUuid() { + return uuid; + } + + @JsonProperty("uuid") + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + **/ + public ObjectWithDeprecatedFields id(BigDecimal id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + @Valid public BigDecimal getId() { + return id; + } + + @JsonProperty("id") + public void setId(BigDecimal id) { + this.id = id; + } + + /** + **/ + public ObjectWithDeprecatedFields deprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return this; + } + + + @Schema(description = "") + @JsonProperty("deprecatedRef") + @Valid public DeprecatedObject getDeprecatedRef() { + return deprecatedRef; + } + + @JsonProperty("deprecatedRef") + public void setDeprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + } + + /** + **/ + public ObjectWithDeprecatedFields bars(List bars) { + this.bars = bars; + return this; + } + + + @Schema(description = "") + @JsonProperty("bars") + public List getBars() { + return bars; + } + + @JsonProperty("bars") + public void setBars(List bars) { + this.bars = bars; + } + + public ObjectWithDeprecatedFields addBarsItem(String barsItem) { + if (this.bars == null) { + this.bars = new ArrayList<>(); + } + + this.bars.add(barsItem); + return this; + } + + public ObjectWithDeprecatedFields removeBarsItem(String barsItem) { + if (barsItem != null && this.bars != null) { + this.bars.remove(barsItem); + } + + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObjectWithDeprecatedFields objectWithDeprecatedFields = (ObjectWithDeprecatedFields) o; + return Objects.equals(this.uuid, objectWithDeprecatedFields.uuid) && + Objects.equals(this.id, objectWithDeprecatedFields.id) && + Objects.equals(this.deprecatedRef, objectWithDeprecatedFields.deprecatedRef) && + Objects.equals(this.bars, objectWithDeprecatedFields.bars); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, id, deprecatedRef, bars); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObjectWithDeprecatedFields {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" deprecatedRef: ").append(toIndentedString(deprecatedRef)).append("\n"); + sb.append(" bars: ").append(toIndentedString(bars)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ObjectWithDeprecatedFieldsBuilder builder() { + return new ObjectWithDeprecatedFieldsBuilderImpl(); + } + + private static final class ObjectWithDeprecatedFieldsBuilderImpl extends ObjectWithDeprecatedFieldsBuilder { + + @Override + protected ObjectWithDeprecatedFieldsBuilderImpl self() { + return this; + } + + @Override + public ObjectWithDeprecatedFields build() { + return new ObjectWithDeprecatedFields(this); + } + } + + public static abstract class ObjectWithDeprecatedFieldsBuilder> { + private String uuid; + private BigDecimal id; + private DeprecatedObject deprecatedRef; + private List bars = new ArrayList<>(); + protected abstract B self(); + + public abstract C build(); + + public B uuid(String uuid) { + this.uuid = uuid; + return self(); + } + public B id(BigDecimal id) { + this.id = id; + return self(); + } + public B deprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return self(); + } + public B bars(List bars) { + this.bars = bars; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Order.java new file mode 100644 index 000000000000..0d738476e0a6 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Order.java @@ -0,0 +1,306 @@ +package org.openapitools.model; + +import java.util.Date; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Order") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Order implements Serializable { + private Long id; + private Long petId; + private Integer quantity; + private Date shipDate; + public enum StatusEnum { + + PLACED(String.valueOf("placed")), APPROVED(String.valueOf("approved")), DELIVERED(String.valueOf("delivered")); + + + private String value; + + StatusEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StatusEnum fromString(String s) { + for (StatusEnum b : StatusEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private StatusEnum status; + private Boolean complete = false; + + protected Order(OrderBuilder b) { + this.id = b.id; + this.petId = b.petId; + this.quantity = b.quantity; + this.shipDate = b.shipDate; + this.status = b.status; + this.complete = b.complete; + } + + public Order() { + } + + /** + **/ + public Order id(Long id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + + @Schema(description = "") + @JsonProperty("petId") + public Long getPetId() { + return petId; + } + + @JsonProperty("petId") + public void setPetId(Long petId) { + this.petId = petId; + } + + /** + **/ + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + + @Schema(description = "") + @JsonProperty("quantity") + public Integer getQuantity() { + return quantity; + } + + @JsonProperty("quantity") + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + /** + **/ + public Order shipDate(Date shipDate) { + this.shipDate = shipDate; + return this; + } + + + @Schema(description = "") + @JsonProperty("shipDate") + public Date getShipDate() { + return shipDate; + } + + @JsonProperty("shipDate") + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + /** + * Order Status + **/ + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + + @Schema(description = "Order Status") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + + @JsonProperty("status") + public void setStatus(StatusEnum status) { + this.status = status; + } + + /** + **/ + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + + @Schema(description = "") + @JsonProperty("complete") + public Boolean getComplete() { + return complete; + } + + @JsonProperty("complete") + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static OrderBuilder builder() { + return new OrderBuilderImpl(); + } + + private static final class OrderBuilderImpl extends OrderBuilder { + + @Override + protected OrderBuilderImpl self() { + return this; + } + + @Override + public Order build() { + return new Order(this); + } + } + + public static abstract class OrderBuilder> { + private Long id; + private Long petId; + private Integer quantity; + private Date shipDate; + private StatusEnum status; + private Boolean complete = false; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B petId(Long petId) { + this.petId = petId; + return self(); + } + public B quantity(Integer quantity) { + this.quantity = quantity; + return self(); + } + public B shipDate(Date shipDate) { + this.shipDate = shipDate; + return self(); + } + public B status(StatusEnum status) { + this.status = status; + return self(); + } + public B complete(Boolean complete) { + this.complete = complete; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterComposite.java new file mode 100644 index 000000000000..9051eb76d6e8 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterComposite.java @@ -0,0 +1,174 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("OuterComposite") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class OuterComposite implements Serializable { + private BigDecimal myNumber; + private String myString; + private Boolean myBoolean; + + protected OuterComposite(OuterCompositeBuilder b) { + this.myNumber = b.myNumber; + this.myString = b.myString; + this.myBoolean = b.myBoolean; + } + + public OuterComposite() { + } + + /** + **/ + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + + @Schema(description = "") + @JsonProperty("my_number") + @Valid public BigDecimal getMyNumber() { + return myNumber; + } + + @JsonProperty("my_number") + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + /** + **/ + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + + @Schema(description = "") + @JsonProperty("my_string") + public String getMyString() { + return myString; + } + + @JsonProperty("my_string") + public void setMyString(String myString) { + this.myString = myString; + } + + /** + **/ + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + + @Schema(description = "") + @JsonProperty("my_boolean") + public Boolean getMyBoolean() { + return myBoolean; + } + + @JsonProperty("my_boolean") + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static OuterCompositeBuilder builder() { + return new OuterCompositeBuilderImpl(); + } + + private static final class OuterCompositeBuilderImpl extends OuterCompositeBuilder { + + @Override + protected OuterCompositeBuilderImpl self() { + return this; + } + + @Override + public OuterComposite build() { + return new OuterComposite(this); + } + } + + public static abstract class OuterCompositeBuilder> { + private BigDecimal myNumber; + private String myString; + private Boolean myBoolean; + protected abstract B self(); + + public abstract C build(); + + public B myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return self(); + } + public B myString(String myString) { + this.myString = myString; + return self(); + } + public B myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnum.java new file mode 100644 index 000000000000..5f86922395d7 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnum.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnum fromString(String s) { + for (OuterEnum b : OuterEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + return null; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..f9fd44c8deb0 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumDefaultValue + */ +public enum OuterEnumDefaultValue { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnumDefaultValue(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumDefaultValue fromString(String s) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumDefaultValue fromValue(String value) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnumInteger.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnumInteger.java new file mode 100644 index 000000000000..a81c0a77bebf --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnumInteger.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumInteger + */ +public enum OuterEnumInteger { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumInteger(Integer value) { + this.value = value; + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumInteger fromString(String s) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumInteger fromValue(Integer value) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..3f16a4d4e458 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumIntegerDefaultValue + */ +public enum OuterEnumIntegerDefaultValue { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumIntegerDefaultValue(Integer value) { + this.value = value; + } + + /** + * Convert a String into Integer, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static OuterEnumIntegerDefaultValue fromString(String s) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumIntegerDefaultValue fromValue(Integer value) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java new file mode 100644 index 000000000000..626633b65567 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java @@ -0,0 +1,125 @@ +package org.openapitools.model; + +import org.openapitools.model.OuterEnumInteger; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("OuterObjectWithEnumProperty") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class OuterObjectWithEnumProperty implements Serializable { + private OuterEnumInteger value; + + protected OuterObjectWithEnumProperty(OuterObjectWithEnumPropertyBuilder b) { + this.value = b.value; + } + + public OuterObjectWithEnumProperty() { + } + + @JsonCreator + public OuterObjectWithEnumProperty( + @JsonProperty(required = true, value = "value") OuterEnumInteger value + ) { + this.value = value; + } + + /** + **/ + public OuterObjectWithEnumProperty value(OuterEnumInteger value) { + this.value = value; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "value") + @NotNull public OuterEnumInteger getValue() { + return value; + } + + @JsonProperty(required = true, value = "value") + public void setValue(OuterEnumInteger value) { + this.value = value; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterObjectWithEnumProperty outerObjectWithEnumProperty = (OuterObjectWithEnumProperty) o; + return Objects.equals(this.value, outerObjectWithEnumProperty.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterObjectWithEnumProperty {\n"); + + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static OuterObjectWithEnumPropertyBuilder builder() { + return new OuterObjectWithEnumPropertyBuilderImpl(); + } + + private static final class OuterObjectWithEnumPropertyBuilderImpl extends OuterObjectWithEnumPropertyBuilder { + + @Override + protected OuterObjectWithEnumPropertyBuilderImpl self() { + return this; + } + + @Override + public OuterObjectWithEnumProperty build() { + return new OuterObjectWithEnumProperty(this); + } + } + + public static abstract class OuterObjectWithEnumPropertyBuilder> { + private OuterEnumInteger value; + protected abstract B self(); + + public abstract C build(); + + public B value(OuterEnumInteger value) { + this.value = value; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ParentWithNullable.java new file mode 100644 index 000000000000..750ba0cf47da --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ParentWithNullable.java @@ -0,0 +1,200 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChildWithNullable.class, name = "ChildWithNullable"), +}) + + +@Schema(description="") +@JsonTypeName("ParentWithNullable") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ParentWithNullable implements Serializable { + public enum TypeEnum { + + CHILD_WITH_NULLABLE(String.valueOf("ChildWithNullable")); + + + private String value; + + TypeEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static TypeEnum fromString(String s) { + for (TypeEnum b : TypeEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private TypeEnum type; + private String nullableProperty; + + protected ParentWithNullable(ParentWithNullableBuilder b) { + this.type = b.type; + this.nullableProperty = b.nullableProperty; + } + + public ParentWithNullable() { + } + + /** + **/ + public ParentWithNullable type(TypeEnum type) { + this.type = type; + return this; + } + + + @Schema(description = "") + @JsonProperty("type") + public TypeEnum getType() { + return type; + } + + @JsonProperty("type") + public void setType(TypeEnum type) { + this.type = type; + } + + /** + **/ + public ParentWithNullable nullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + return this; + } + + + @Schema(description = "") + @JsonProperty("nullableProperty") + public String getNullableProperty() { + return nullableProperty; + } + + @JsonProperty("nullableProperty") + public void setNullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParentWithNullable parentWithNullable = (ParentWithNullable) o; + return Objects.equals(this.type, parentWithNullable.type) && + Objects.equals(this.nullableProperty, parentWithNullable.nullableProperty); + } + + @Override + public int hashCode() { + return Objects.hash(type, nullableProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParentWithNullable {\n"); + + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" nullableProperty: ").append(toIndentedString(nullableProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ParentWithNullableBuilder builder() { + return new ParentWithNullableBuilderImpl(); + } + + private static final class ParentWithNullableBuilderImpl extends ParentWithNullableBuilder { + + @Override + protected ParentWithNullableBuilderImpl self() { + return this; + } + + @Override + public ParentWithNullable build() { + return new ParentWithNullable(this); + } + } + + public static abstract class ParentWithNullableBuilder> { + private TypeEnum type; + private String nullableProperty; + protected abstract B self(); + + public abstract C build(); + + public B type(TypeEnum type) { + this.type = type; + return self(); + } + public B nullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Pet.java new file mode 100644 index 000000000000..97fe2ac5e797 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Pet.java @@ -0,0 +1,355 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.model.Category; +import org.openapitools.model.Tag; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Pet") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Pet implements Serializable { + private Long id; + private Category category; + private String name; + private @Valid Set photoUrls = new LinkedHashSet<>(); + private @Valid List<@Valid Tag> tags = new ArrayList<>(); + public enum StatusEnum { + + AVAILABLE(String.valueOf("available")), PENDING(String.valueOf("pending")), SOLD(String.valueOf("sold")); + + + private String value; + + StatusEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StatusEnum fromString(String s) { + for (StatusEnum b : StatusEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private StatusEnum status; + + protected Pet(PetBuilder b) { + this.id = b.id; + this.category = b.category; + this.name = b.name; + this.photoUrls = b.photoUrls; + this.tags = b.tags; + this.status = b.status; + } + + public Pet() { + } + + @JsonCreator + public Pet( + @JsonProperty(required = true, value = "name") String name, + @JsonProperty(required = true, value = "photoUrls") Set photoUrls + ) { + this.name = name; + this.photoUrls = photoUrls; + } + + /** + **/ + public Pet id(Long id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Pet category(Category category) { + this.category = category; + return this; + } + + + @Schema(description = "") + @JsonProperty("category") + @Valid public Category getCategory() { + return category; + } + + @JsonProperty("category") + public void setCategory(Category category) { + this.category = category; + } + + /** + **/ + public Pet name(String name) { + this.name = name; + return this; + } + + + @Schema(example = "doggie", required = true, description = "") + @JsonProperty(required = true, value = "name") + @NotNull public String getName() { + return name; + } + + @JsonProperty(required = true, value = "name") + public void setName(String name) { + this.name = name; + } + + /** + **/ + public Pet photoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + + @Schema(required = true, description = "") + @JsonProperty(required = true, value = "photoUrls") + @NotNull public Set getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(required = true, value = "photoUrls") + @JsonDeserialize(as = LinkedHashSet.class) + public void setPhotoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new LinkedHashSet<>(); + } + + this.photoUrls.add(photoUrlsItem); + return this; + } + + public Pet removePhotoUrlsItem(String photoUrlsItem) { + if (photoUrlsItem != null && this.photoUrls != null) { + this.photoUrls.remove(photoUrlsItem); + } + + return this; + } + /** + **/ + public Pet tags(List<@Valid Tag> tags) { + this.tags = tags; + return this; + } + + + @Schema(description = "") + @JsonProperty("tags") + @Valid public List<@Valid Tag> getTags() { + return tags; + } + + @JsonProperty("tags") + public void setTags(List<@Valid Tag> tags) { + this.tags = tags; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + + this.tags.add(tagsItem); + return this; + } + + public Pet removeTagsItem(Tag tagsItem) { + if (tagsItem != null && this.tags != null) { + this.tags.remove(tagsItem); + } + + return this; + } + /** + * pet status in the store + **/ + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + + @Schema(description = "pet status in the store") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + + @JsonProperty("status") + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static PetBuilder builder() { + return new PetBuilderImpl(); + } + + private static final class PetBuilderImpl extends PetBuilder { + + @Override + protected PetBuilderImpl self() { + return this; + } + + @Override + public Pet build() { + return new Pet(this); + } + } + + public static abstract class PetBuilder> { + private Long id; + private Category category; + private String name; + private Set photoUrls = new LinkedHashSet<>(); + private List tags = new ArrayList<>(); + private StatusEnum status; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B category(Category category) { + this.category = category; + return self(); + } + public B name(String name) { + this.name = name; + return self(); + } + public B photoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + return self(); + } + public B tags(List tags) { + this.tags = tags; + return self(); + } + public B status(StatusEnum status) { + this.status = status; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..396374dc05b8 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -0,0 +1,145 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("ReadOnlyFirst") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class ReadOnlyFirst implements Serializable { + private String bar; + private String baz; + + protected ReadOnlyFirst(ReadOnlyFirstBuilder b) { + this.bar = b.bar; + this.baz = b.baz; + } + + public ReadOnlyFirst() { + } + + /** + **/ + public ReadOnlyFirst bar(String bar) { + this.bar = bar; + return this; + } + + + @Schema(description = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + + @JsonProperty("bar") + public void setBar(String bar) { + this.bar = bar; + } + + /** + **/ + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + + @Schema(description = "") + @JsonProperty("baz") + public String getBaz() { + return baz; + } + + @JsonProperty("baz") + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static ReadOnlyFirstBuilder builder() { + return new ReadOnlyFirstBuilderImpl(); + } + + private static final class ReadOnlyFirstBuilderImpl extends ReadOnlyFirstBuilder { + + @Override + protected ReadOnlyFirstBuilderImpl self() { + return this; + } + + @Override + public ReadOnlyFirst build() { + return new ReadOnlyFirst(this); + } + } + + public static abstract class ReadOnlyFirstBuilder> { + private String bar; + private String baz; + protected abstract B self(); + + public abstract C build(); + + public B bar(String bar) { + this.bar = bar; + return self(); + } + public B baz(String baz) { + this.baz = baz; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/SingleRefType.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/SingleRefType.java new file mode 100644 index 000000000000..3314a0f57b45 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/SingleRefType.java @@ -0,0 +1,57 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets SingleRefType + */ +public enum SingleRefType { + + ADMIN("admin"), + + USER("user"); + + private String value; + + SingleRefType(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static SingleRefType fromString(String s) { + for (SingleRefType b : SingleRefType.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SingleRefType fromValue(String value) { + for (SingleRefType b : SingleRefType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/SpecialModelName.java new file mode 100644 index 000000000000..f0fd3e255295 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("_special_model.name_") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class SpecialModelName implements Serializable { + private Long $specialPropertyName; + + protected SpecialModelName(SpecialModelNameBuilder b) { + this.$specialPropertyName = b.$specialPropertyName; + } + + public SpecialModelName() { + } + + /** + **/ + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + + @Schema(description = "") + @JsonProperty("$special[property.name]") + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + @JsonProperty("$special[property.name]") + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static SpecialModelNameBuilder builder() { + return new SpecialModelNameBuilderImpl(); + } + + private static final class SpecialModelNameBuilderImpl extends SpecialModelNameBuilder { + + @Override + protected SpecialModelNameBuilderImpl self() { + return this; + } + + @Override + public SpecialModelName build() { + return new SpecialModelName(this); + } + } + + public static abstract class SpecialModelNameBuilder> { + private Long $specialPropertyName; + protected abstract B self(); + + public abstract C build(); + + public B $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/StringEnum.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/StringEnum.java new file mode 100644 index 000000000000..4e37a7e483bf --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/StringEnum.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets StringEnum + */ +public enum StringEnum { + + FOO("foo"), + + BAR("bar"), + + BAZ("baz"); + + private String value; + + StringEnum(String value) { + this.value = value; + } + + /** + * Convert a String into String, as specified in the + * See JAX RS 2.0 Specification, section 3.2, p. 12 + */ + public static StringEnum fromString(String s) { + for (StringEnum b : StringEnum.values()) { + // using Objects.toString() to be safe if value type non-object type + // because types like 'int' etc. will be auto-boxed + if (java.util.Objects.toString(b.value).equals(s)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected string value '" + s + "'"); + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StringEnum fromValue(String value) { + for (StringEnum b : StringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Tag.java new file mode 100644 index 000000000000..8ca87aec0bea --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/Tag.java @@ -0,0 +1,145 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("Tag") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class Tag implements Serializable { + private Long id; + private String name; + + protected Tag(TagBuilder b) { + this.id = b.id; + this.name = b.name; + } + + public Tag() { + } + + /** + **/ + public Tag id(Long id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public Tag name(String name) { + this.name = name; + return this; + } + + + @Schema(description = "") + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static TagBuilder builder() { + return new TagBuilderImpl(); + } + + private static final class TagBuilderImpl extends TagBuilder { + + @Override + protected TagBuilderImpl self() { + return this; + } + + @Override + public Tag build() { + return new Tag(this); + } + } + + public static abstract class TagBuilder> { + private Long id; + private String name; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B name(String name) { + this.name = name; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java new file mode 100644 index 000000000000..896f32091319 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -0,0 +1,89 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.HashMap; +import java.util.Map; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("testInlineFreeformAdditionalProperties_request") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap implements Serializable { + private String someProperty; + + public TestInlineFreeformAdditionalPropertiesRequest() { + } + + /** + **/ + public TestInlineFreeformAdditionalPropertiesRequest someProperty(String someProperty) { + this.someProperty = someProperty; + return this; + } + + + @Schema(description = "") + @JsonProperty("someProperty") + public String getSomeProperty() { + return someProperty; + } + + @JsonProperty("someProperty") + public void setSomeProperty(String someProperty) { + this.someProperty = someProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = (TestInlineFreeformAdditionalPropertiesRequest) o; + return Objects.equals(this.someProperty, testInlineFreeformAdditionalPropertiesRequest.someProperty) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(someProperty, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" someProperty: ").append(toIndentedString(someProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/User.java new file mode 100644 index 000000000000..20dbdeb5f03a --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/gen/java/org/openapitools/model/User.java @@ -0,0 +1,314 @@ +package org.openapitools.model; + +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonTypeName; + + + +@Schema(description="") +@JsonTypeName("User") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", comments = "Generator version: 7.18.0-SNAPSHOT") +public class User implements Serializable { + private Long id; + private String username; + private String firstName; + private String lastName; + private String email; + private String password; + private String phone; + private Integer userStatus; + + protected User(UserBuilder b) { + this.id = b.id; + this.username = b.username; + this.firstName = b.firstName; + this.lastName = b.lastName; + this.email = b.email; + this.password = b.password; + this.phone = b.phone; + this.userStatus = b.userStatus; + } + + public User() { + } + + /** + **/ + public User id(Long id) { + this.id = id; + return this; + } + + + @Schema(description = "") + @JsonProperty("id") + public Long getId() { + return id; + } + + @JsonProperty("id") + public void setId(Long id) { + this.id = id; + } + + /** + **/ + public User username(String username) { + this.username = username; + return this; + } + + + @Schema(description = "") + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonProperty("username") + public void setUsername(String username) { + this.username = username; + } + + /** + **/ + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + + @Schema(description = "") + @JsonProperty("firstName") + public String getFirstName() { + return firstName; + } + + @JsonProperty("firstName") + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + **/ + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + + @Schema(description = "") + @JsonProperty("lastName") + public String getLastName() { + return lastName; + } + + @JsonProperty("lastName") + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + **/ + public User email(String email) { + this.email = email; + return this; + } + + + @Schema(description = "") + @JsonProperty("email") + public String getEmail() { + return email; + } + + @JsonProperty("email") + public void setEmail(String email) { + this.email = email; + } + + /** + **/ + public User password(String password) { + this.password = password; + return this; + } + + + @Schema(description = "") + @JsonProperty("password") + public String getPassword() { + return password; + } + + @JsonProperty("password") + public void setPassword(String password) { + this.password = password; + } + + /** + **/ + public User phone(String phone) { + this.phone = phone; + return this; + } + + + @Schema(description = "") + @JsonProperty("phone") + public String getPhone() { + return phone; + } + + @JsonProperty("phone") + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * User Status + **/ + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + + @Schema(description = "User Status") + @JsonProperty("userStatus") + public Integer getUserStatus() { + return userStatus; + } + + @JsonProperty("userStatus") + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static UserBuilder builder() { + return new UserBuilderImpl(); + } + + private static final class UserBuilderImpl extends UserBuilder { + + @Override + protected UserBuilderImpl self() { + return this; + } + + @Override + public User build() { + return new User(this); + } + } + + public static abstract class UserBuilder> { + private Long id; + private String username; + private String firstName; + private String lastName; + private String email; + private String password; + private String phone; + private Integer userStatus; + protected abstract B self(); + + public abstract C build(); + + public B id(Long id) { + this.id = id; + return self(); + } + public B username(String username) { + this.username = username; + return self(); + } + public B firstName(String firstName) { + this.firstName = firstName; + return self(); + } + public B lastName(String lastName) { + this.lastName = lastName; + return self(); + } + public B email(String email) { + this.email = email; + return self(); + } + public B password(String password) { + this.password = password; + return self(); + } + public B phone(String phone) { + this.phone = phone; + return self(); + } + public B userStatus(Integer userStatus) { + this.userStatus = userStatus; + return self(); + } + } +} + diff --git a/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/main/openapi/openapi.yaml new file mode 100644 index 000000000000..e8ba4f7ffd4e --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-swagger-v3-annotations/src/main/openapi/openapi.yaml @@ -0,0 +1,2508 @@ +openapi: 3.0.0 +info: + description: "This spec is mainly for testing Petstore server and contains fake\ + \ endpoints, models. Please do not use this for any other purpose. Special characters:\ + \ \" \\" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- description: petstore server + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: "https://localhost:8080/{version}" + variables: + version: + default: v2 + enum: + - v1 + - v2 +- description: The local server without variables + url: https://127.0.0.1/no_varaible +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/_foo_get_default_response" + description: response + x-accepts: + - application/json + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + description: Successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: pet + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + description: Successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-webclient-blocking: true + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: pet + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 + - description: test server with variables + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + description: target server + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + x-tags: + - tag: pet + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + uniqueItems: true + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + uniqueItems: true + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + uniqueItems: true + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + x-tags: + - tag: pet + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + description: Successful operation + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + x-tags: + - tag: pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-webclient-blocking: true + x-accepts: + - application/json + - application/xml + x-tags: + - tag: pet + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "200": + description: Successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: pet + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-webclient-blocking: false + x-accepts: + - application/json + x-tags: + - tag: store + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + x-tags: + - tag: store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + x-tags: + - tag: store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + x-tags: + - tag: store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + x-tags: + - tag: user + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + x-tags: + - tag: user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Delete user + tags: + - user + x-accepts: + - application/json + x-tags: + - tag: user + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + x-tags: + - tag: user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: user + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake_classname_tags 123#$%^ + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + "400": + description: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: + - application/json + x-tags: + - tag: fake + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + - explode: true + in: query + name: enum_query_model_array + required: false + schema: + items: + $ref: "#/components/schemas/EnumClass" + type: array + style: form + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEnumParameters_request" + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test "client" model + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEndpointParameters_request" + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterNumber" + description: Input number as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterNumber" + description: Output number + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/property/enum-int: + post: + description: Test serialization of enum (int) properties with examples + operationId: fakePropertyEnumIntegerSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterObjectWithEnumProperty" + description: Input enum (int) as post body + required: true + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterObjectWithEnumProperty" + description: Output enum (int) + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterString" + description: Input string as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterString" + description: Output string + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Input boolean as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Output boolean + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterComposite" + description: Input composite as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterComposite" + description: Output composite + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/fakeBigDecimalMap_200_response" + description: successful operation + tags: + - fake + x-accepts: + - '*/*' + x-tags: + - tag: fake + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testJsonFormData_request" + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FreeFormObject" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/MapOfString" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/inline-additionalProperties: + post: + description: "" + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/testInlineFreeformAdditionalProperties_request" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/nullable: + post: + description: "" + operationId: testNullable + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ChildWithNullable" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test nullable parent property + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: $another-fake? + /fake/body-with-file-schema: + put: + description: "For this test, the body for this request must reference a schema\ + \ named `File`." + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FileSchemaTestClass" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/body-with-binary: + put: + description: "For this test, the body has to be a binary file." + operationId: testBodyWithBinary + requestBody: + content: + image/png: + schema: + format: binary + nullable: true + type: string + description: image to upload + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: image/png + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: false + in: query + name: pipe + required: true + schema: + items: + type: string + type: array + style: pipeDelimited + - explode: false + in: query + name: ioutil + required: true + schema: + items: + type: string + type: array + style: form + - explode: false + in: query + name: http + required: true + schema: + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: language + required: false + schema: + additionalProperties: + format: string + type: string + type: object + style: form + - allowEmptyValue: true + explode: true + in: query + name: allowEmpty + required: true + schema: + type: string + style: form + responses: + "200": + description: Success + tags: + - fake + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFileWithRequiredFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: pet + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/HealthCheckResult" + description: The instance started successfully + summary: Health check endpoint + tags: + - fake + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/http-signature-test: + get: + operationId: fake-http-signature-test + parameters: + - description: query parameter + explode: true + in: query + name: query_1 + required: false + schema: + type: string + style: form + - description: header parameter + explode: false + in: header + name: header_1 + required: false + schema: + type: string + style: simple + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + description: The instance started successfully + security: + - http_signature_test: [] + summary: test http signature authentication + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: fake + /fake/tests/defaults: + get: + operationId: fake-tests-defaults + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/fake_tests_defaults_default_response" + description: response + summary: test enum default in request body + tags: + - fake + x-accepts: + - application/json + x-tags: + - tag: fake +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + name: default-name + id: 6 + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: default-name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + uniqueItems: true + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + declawed: + type: boolean + type: object + Animal: + discriminator: + mapping: + DOG: "#/components/schemas/Dog" + CAT: "#/components/schemas/Cat" + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: "#/components/schemas/Animal" + type: array + format_test: + properties: + integer: + maximum: 100 + minimum: 10 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + decimal: + format: number + type: string + string: + pattern: "/[a-z]/i" + type: string + byte: + format: byte + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: "^\\d{10}$" + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: "/^image_\\d{1,3}$/i" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: "#/components/schemas/OuterEnum" + outerEnumInteger: + $ref: "#/components/schemas/OuterEnumInteger" + outerEnumDefaultValue: + $ref: "#/components/schemas/OuterEnumDefaultValue" + outerEnumIntegerDefaultValue: + $ref: "#/components/schemas/OuterEnumIntegerDefaultValue" + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: "#/components/schemas/Animal" + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + type: object + ArrayTest: + properties: + array_of_string: + items: + type: string + maxItems: 3 + minItems: 0 + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: "#/components/schemas/ReadOnlyFirst" + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + nullable: true + type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 2 + example: 2 + type: integer + OuterEnumDefaultValue: + default: placed + enum: + - placed + - approved + - delivered + type: string + OuterEnumIntegerDefaultValue: + default: 0 + enum: + - 0 + - 1 + - 2 + type: integer + OuterComposite: + example: + my_string: my_string + my_number: 0.8008281904610115 + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + ParentWithNullable: + discriminator: + propertyName: type + properties: + type: + enum: + - ChildWithNullable + type: string + nullableProperty: + nullable: true + type: string + type: object + ChildWithNullable: + allOf: + - $ref: "#/components/schemas/ParentWithNullable" + - properties: + otherProperty: + type: string + type: object + example: + otherProperty: otherProperty + nullableProperty: nullableProperty + type: ChildWithNullable + StringBooleanMap: + additionalProperties: + type: boolean + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: "#/components/schemas/File" + files: + items: + $ref: "#/components/schemas/File" + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + xml: + name: "$special[model.name]" + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage + properties: + NullableMessage: + nullable: true + type: string + type: object + NullableClass: + additionalProperties: + nullable: true + type: object + properties: + integer_prop: + nullable: true + type: integer + number_prop: + nullable: true + type: number + boolean_prop: + nullable: true + type: boolean + string_prop: + nullable: true + type: string + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: + items: + type: object + nullable: true + type: array + array_and_items_nullable_prop: + items: + nullable: true + type: object + nullable: true + type: array + array_items_nullable: + items: + nullable: true + type: object + type: array + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + type: object + type: object + OuterObjectWithEnumProperty: + example: + value: 2 + properties: + value: + $ref: "#/components/schemas/OuterEnumInteger" + required: + - value + type: object + DeprecatedObject: + deprecated: true + properties: + name: + type: string + type: object + ObjectWithDeprecatedFields: + properties: + uuid: + type: string + id: + deprecated: true + type: number + deprecatedRef: + $ref: "#/components/schemas/DeprecatedObject" + bars: + deprecated: true + items: + $ref: "#/components/schemas/Bar" + type: array + type: object + AllOfWithSingleRef: + properties: + username: + type: string + SingleRefType: + allOf: + - $ref: "#/components/schemas/SingleRefType" + type: object + SingleRefType: + enum: + - admin + - user + title: SingleRefType + type: string + StringEnum: + default: foo + enum: + - foo + - bar + - baz + type: string + IntegerEnum: + default: 1 + enum: + - 1 + - 2 + - 3 + type: integer + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: "#/components/schemas/Foo" + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + testEndpointParameters_request: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + fake_tests_defaults_default_response: + example: + stringEnum: foo + integerEnum: 0 + stringEnumInline: foo + integerEnumInline: 6 + properties: + stringEnum: + $ref: "#/components/schemas/StringEnum" + integerEnum: + $ref: "#/components/schemas/IntegerEnum" + stringEnumInline: + default: foo + enum: + - foo + - bar + - baz + type: string + integerEnumInline: + default: 1 + enum: + - 1 + - 2 + - 3 + type: integer + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + http_signature_test: + scheme: signature + type: http