diff --git a/bin/configs/other/openapi3/jaxrs-cxf-client-jackson-nullable.yaml b/bin/configs/other/openapi3/jaxrs-cxf-client-jackson-nullable.yaml new file mode 100644 index 000000000000..c7e0393d7526 --- /dev/null +++ b/bin/configs/other/openapi3/jaxrs-cxf-client-jackson-nullable.yaml @@ -0,0 +1,6 @@ +generatorName: jaxrs-cxf-client +outputDir: samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/cxf +additionalProperties: + jackson: "true" \ No newline at end of file diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index c50caf9c3aa4..aaa988a6109a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -70,6 +70,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code public static final String ADDITIONAL_ENUM_TYPE_ANNOTATIONS = "additionalEnumTypeAnnotations"; public static final String DISCRIMINATOR_CASE_SENSITIVE = "discriminatorCaseSensitive"; public static final String OPENAPI_NULLABLE = "openApiNullable"; + public static final String JACKSON = "jackson"; protected String dateLibrary = "threetenbp"; protected boolean supportAsync = false; @@ -525,6 +526,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue"); importMapping.put("JsonIgnore", "com.fasterxml.jackson.annotation.JsonIgnore"); importMapping.put("JsonInclude", "com.fasterxml.jackson.annotation.JsonInclude"); + importMapping.put("JsonNullable", "org.openapitools.jackson.nullable.JsonNullable"); importMapping.put("SerializedName", "com.google.gson.annotations.SerializedName"); importMapping.put("TypeAdapter", "com.google.gson.TypeAdapter"); importMapping.put("JsonAdapter", "com.google.gson.annotations.JsonAdapter"); @@ -1174,7 +1176,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code if (codegenModel.description != null) { codegenModel.imports.add("ApiModel"); } - if (codegenModel.discriminator != null && additionalProperties.containsKey("jackson")) { + if (codegenModel.discriminator != null && additionalProperties.containsKey(JACKSON)) { codegenModel.imports.add("JsonSubTypes"); codegenModel.imports.add("JsonTypeInfo"); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java index e631ae130fad..cb448e277d0d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java @@ -70,7 +70,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen additionalProperties.put("title", title); // java inflector uses the jackson lib - additionalProperties.put("jackson", "true"); + additionalProperties.put(JACKSON, "true"); cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC).defaultValue(implFolder)); cliOptions.add(new CliOption("title", "a title describing the application").defaultValue(title)); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java index 0c6745e64649..a02a1782764e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java @@ -49,6 +49,8 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen protected boolean useLoggingFeatureForTests = false; + private boolean useJackson = false; + public JavaCXFClientCodegen() { super(); @@ -108,6 +110,10 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen this.setUseLoggingFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE_FOR_TESTS)); } + if (additionalProperties.containsKey(JACKSON)) { + useJackson = convertPropertyToBooleanAndWriteBack(JACKSON); + } + supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml") @@ -139,12 +145,22 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen model.imports.remove("JsonSerialize"); model.imports.remove("ToStringSerializer"); - //Add imports for Jackson when model has inner enum - if (additionalProperties.containsKey("jackson")) { + + if (useJackson) { + //Add jackson imports when model has inner enum if (Boolean.FALSE.equals(model.isEnum) && Boolean.TRUE.equals(model.hasEnums)) { model.imports.add("JsonCreator"); model.imports.add("JsonValue"); } + + //Add JsonNullable import and mark property nullable for templating if necessary + if (openApiNullable) { + if (Boolean.FALSE.equals(property.required) && Boolean.TRUE.equals(property.isNullable)) { + property.getVendorExtensions().put("x-is-jackson-optional-nullable", true); + model.imports.add("JsonNullable"); + model.imports.add("JsonIgnore"); + } + } } } @@ -195,4 +211,7 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen return useGenericResponse; } + public boolean isUseJackson() { + return useJackson; + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFServerCodegen.java index 30c3479b626f..f7dae1dc15aa 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFServerCodegen.java @@ -242,7 +242,7 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen model.imports.remove("ToStringSerializer"); //Add imports for Jackson when model has inner enum - if (additionalProperties.containsKey("jackson")) { + if (additionalProperties.containsKey(JACKSON)) { if (Boolean.FALSE.equals(model.isEnum) && Boolean.TRUE.equals(model.hasEnums)) { model.imports.add("JsonCreator"); model.imports.add("JsonValue"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java index 297a45d353e0..5bf0265e2cba 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java @@ -69,7 +69,7 @@ public class JavaInflectorServerCodegen extends AbstractJavaCodegen { additionalProperties.put("title", title); // java inflector uses the jackson lib - additionalProperties.put("jackson", "true"); + additionalProperties.put(JACKSON, "true"); } @Override 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 95fdf15a39ee..a679e0a982d8 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 @@ -31,7 +31,6 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { public static final String RETURN_RESPONSE = "returnResponse"; public static final String GENERATE_POM = "generatePom"; public static final String USE_SWAGGER_ANNOTATIONS = "useSwaggerAnnotations"; - public static final String JACKSON = "jackson"; public static final String OPEN_API_SPEC_FILE_LOCATION = "openApiSpecFileLocation"; public static final String GENERATE_BUILDERS = "generateBuilders"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java index 415ac439aee9..ca3d6b5c3ebc 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java @@ -70,7 +70,7 @@ public class JavaPKMSTServerCodegen extends AbstractJavaCodegen { updateOption(CodegenConstants.API_PACKAGE, apiPackage); updateOption(CodegenConstants.MODEL_PACKAGE, modelPackage); - additionalProperties.put("jackson", "true"); + additionalProperties.put(JACKSON, "true"); this.cliOptions.add(new CliOption("basePackage", "base package for java source code")); this.cliOptions.add(new CliOption("serviceName", "Service Name")); @@ -422,7 +422,7 @@ public class JavaPKMSTServerCodegen extends AbstractJavaCodegen { } } else { // enum class // Needed imports for Jackson's JsonCreator - if (this.additionalProperties.containsKey("jackson")) { + if (this.additionalProperties.containsKey(JACKSON)) { model.imports.add("JsonCreator"); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java index 107371672547..e3037d734607 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java @@ -82,7 +82,7 @@ public class JavaPlayFrameworkCodegen extends AbstractJavaCodegen implements Bea updateOption(CodegenConstants.MODEL_PACKAGE, modelPackage); additionalProperties.put("java8", true); - additionalProperties.put("jackson", "true"); + additionalProperties.put(JACKSON, "true"); cliOptions.add(new CliOption(TITLE, "server title name or client service name").defaultValue(title)); cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code").defaultValue(getConfigPackage())); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index 0dd93bfc594f..b0db9a4c124d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -145,7 +145,7 @@ public class SpringCodegen extends AbstractJavaCodegen apiTestTemplateFiles.clear(); // TODO: add test template // spring uses the jackson lib - additionalProperties.put("jackson", "true"); + additionalProperties.put(JACKSON, "true"); additionalProperties.put("openbrace", OPEN_BRACE); additionalProperties.put("closebrace", CLOSE_BRACE); @@ -829,7 +829,7 @@ public class SpringCodegen extends AbstractJavaCodegen } } else { // enum class //Needed imports for Jackson's JsonCreator - if (additionalProperties.containsKey("jackson")) { + if (additionalProperties.containsKey(JACKSON)) { model.imports.add("JsonCreator"); } } diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache index d30876ae41e2..0dd381f8ee4b 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache @@ -28,13 +28,23 @@ import com.fasterxml.jackson.annotation.JsonProperty; * {{{description}}} **/ {{/description}} -{{#isContainer}} +{{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); + {{/isContainer}} + {{^isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + {{/isContainer}} +{{/vendorExtensions.x-is-jackson-optional-nullable}} +{{^vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; -{{/isContainer}} -{{^isContainer}} + {{/isContainer}} + {{^isContainer}} private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; -{{/isContainer}} - {{/vars}} + {{/isContainer}} +{{/vendorExtensions.x-is-jackson-optional-nullable}} +{{/vars}} {{#vars}} /** {{#description}} @@ -51,44 +61,115 @@ import com.fasterxml.jackson.annotation.JsonProperty; {{/maximum}} * @return {{name}} **/ - @JsonProperty("{{baseName}}") {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} {{/vendorExtensions.x-extra-annotation}} -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} {{#isEnum}}{{^isArray}}{{^isMap}}public {{dataType}} {{getter}}() { +{{#vendorExtensions.x-is-jackson-optional-nullable}} +{{!unannotated, Jackson would pick this up automatically and add it *in addition* to the _JsonNullable getter field}} + @JsonIgnore +{{/vendorExtensions.x-is-jackson-optional-nullable}} +{{^vendorExtensions.x-is-jackson-optional-nullable}} + @JsonProperty("{{baseName}}") +{{/vendorExtensions.x-is-jackson-optional-nullable}} +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} {{#isEnum}}{{^isContainer}}public {{dataType}} {{getter}}() { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if ({{name}} == null || !{{name}}.isPresent() || {{name}}.get() == null) { + return null; + } + return {{name}}.get().value(); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} if ({{name}} == null) { return null; } return {{name}}.value(); - }{{/isMap}}{{/isArray}}{{/isEnum}}{{#isEnum}}{{#isArray}}public {{{datatypeWithEnum}}} {{getter}}() { + {{/vendorExtensions.x-is-jackson-optional-nullable}} + }{{/isContainer}}{{#isContainer}}public {{{datatypeWithEnum}}} {{getter}}() { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if ({{name}} == null) { + return null; + } + return {{name}}.orElse(null); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} return {{name}}; - }{{/isArray}}{{/isEnum}}{{#isEnum}}{{#isMap}}public {{{datatypeWithEnum}}} {{getter}}() { - return {{name}}; - }{{/isMap}}{{/isEnum}}{{^isEnum}}public {{{datatypeWithEnum}}} {{getter}}() { + {{/vendorExtensions.x-is-jackson-optional-nullable}} + }{{/isContainer}}{{/isEnum}}{{^isEnum}}public {{{datatypeWithEnum}}} {{getter}}() { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if ({{name}} == null) { + return null; + } + return {{name}}.orElse(null); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} return {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} }{{/isEnum}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + + @JsonProperty("{{baseName}}") + public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() { + return {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} {{^isReadOnly}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{#vendorExtensions.x-is-jackson-optional-nullable}} + + @JsonProperty("{{baseName}}") + public void {{setter}}_JsonNullable(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + {{! For getters/setters that have name differing from attribute name, we must include setter (albeit private) for jackson to be able to set the attribute}} this.{{name}} = {{name}}; } + {{/vendorExtensions.x-is-jackson-optional-nullable}} public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} this.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} return this; } {{#isArray}} public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + this.{{name}}.get().add({{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} this.{{name}}.add({{name}}Item); return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} } {{/isArray}} {{#isMap}} public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + this.{{name}}.get().put(key, {{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} this.{{name}}.put(key, {{name}}Item); return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} } {{/isMap}} {{/isReadOnly}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaCXFClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaCXFClientCodegenTest.java index 9f1bc6f7e60d..13b247940f55 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaCXFClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaCXFClientCodegenTest.java @@ -22,10 +22,8 @@ import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.media.*; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.responses.ApiResponses; -import org.openapitools.codegen.CodegenConstants; -import org.openapitools.codegen.CodegenOperation; -import org.openapitools.codegen.CodegenResponse; -import org.openapitools.codegen.TestUtils; +import org.openapitools.codegen.*; +import org.openapitools.codegen.languages.AbstractJavaCodegen; import org.openapitools.codegen.languages.JavaCXFClientCodegen; import org.openapitools.codegen.languages.features.BeanValidationFeatures; import org.openapitools.codegen.languages.features.GzipTestFeatures; @@ -179,4 +177,121 @@ public class JavaCXFClientCodegenTest { Assert.assertTrue(codegen.isUseGzipFeatureForTests()); } + @Test + public void testOpenApiNullableAdditionalProperty() throws Exception { + JavaCXFClientCodegen codegen = new JavaCXFClientCodegen(); + + codegen.processOpts(); + Assert.assertNotNull(codegen.additionalProperties().get(AbstractJavaCodegen.OPENAPI_NULLABLE)); + Assert.assertTrue(codegen.isOpenApiNullable()); + + codegen.additionalProperties().put(AbstractJavaCodegen.OPENAPI_NULLABLE, false); + codegen.processOpts(); + Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaCodegen.OPENAPI_NULLABLE), Boolean.FALSE); + Assert.assertFalse(codegen.isOpenApiNullable()); + } + + @Test + public void testPostProcessNullableModelPropertyWithOpenApiNullableEnabled() throws Exception { + JavaCXFClientCodegen codegen = new JavaCXFClientCodegen(); + codegen.additionalProperties().put(AbstractJavaCodegen.JACKSON, true); + codegen.additionalProperties().put(AbstractJavaCodegen.OPENAPI_NULLABLE, true); + codegen.processOpts(); + + CodegenModel codegenModel = new CodegenModel(); + CodegenProperty codegenProperty = new CodegenProperty(); + codegenProperty.required = false; + codegenProperty.isNullable = true; + + codegen.postProcessModelProperty(codegenModel, codegenProperty); + Assert.assertTrue(codegenModel.imports.contains("JsonNullable")); + Assert.assertTrue(codegenModel.imports.contains("JsonIgnore")); + Assert.assertEquals(codegenProperty.getVendorExtensions().get("x-is-jackson-optional-nullable"), Boolean.TRUE); + } + + @Test + public void testPostProcessNullableModelPropertyWithOpenApiNullableDisabled() throws Exception { + JavaCXFClientCodegen codegen = new JavaCXFClientCodegen(); + codegen.additionalProperties().put(AbstractJavaCodegen.JACKSON, true); + codegen.additionalProperties().put(AbstractJavaCodegen.OPENAPI_NULLABLE, false); + codegen.processOpts(); + + CodegenModel codegenModel = new CodegenModel(); + CodegenProperty codegenProperty = new CodegenProperty(); + codegenProperty.required = false; + codegenProperty.isNullable = true; + + codegen.postProcessModelProperty(codegenModel, codegenProperty); + Assert.assertFalse(codegenModel.imports.contains("JsonNullable")); + Assert.assertFalse(codegenModel.imports.contains("JsonIgnore")); + Assert.assertNull(codegenProperty.getVendorExtensions().get("x-is-jackson-optional-nullable")); + } + + @Test + public void testPostProcessNullableModelPropertyWithOpenApiNullableEnabledForRequiredProperties() throws Exception { + JavaCXFClientCodegen codegen = new JavaCXFClientCodegen(); + codegen.additionalProperties().put(AbstractJavaCodegen.JACKSON, true); + codegen.additionalProperties().put(AbstractJavaCodegen.OPENAPI_NULLABLE, true); + codegen.processOpts(); + + CodegenModel codegenModel = new CodegenModel(); + CodegenProperty codegenProperty = new CodegenProperty(); + codegenProperty.required = true; + codegenProperty.isNullable = true; + + codegen.postProcessModelProperty(codegenModel, codegenProperty); + Assert.assertFalse(codegenModel.imports.contains("JsonNullable")); + Assert.assertFalse(codegenModel.imports.contains("JsonIgnore")); + Assert.assertNull(codegenProperty.getVendorExtensions().get("x-is-jackson-optional-nullable")); + } + + @Test + public void testPostProcessNotNullableModelPropertyWithOpenApiNullableEnabled() throws Exception { + JavaCXFClientCodegen codegen = new JavaCXFClientCodegen(); + codegen.additionalProperties().put(AbstractJavaCodegen.JACKSON, true); + codegen.additionalProperties().put(AbstractJavaCodegen.OPENAPI_NULLABLE, true); + codegen.processOpts(); + + CodegenModel codegenModel = new CodegenModel(); + CodegenProperty codegenProperty = new CodegenProperty(); + codegenProperty.required = false; + codegenProperty.isNullable = false; + + codegen.postProcessModelProperty(codegenModel, codegenProperty); + Assert.assertFalse(codegenModel.imports.contains("JsonNullable")); + Assert.assertFalse(codegenModel.imports.contains("JsonIgnore")); + Assert.assertNull(codegenProperty.getVendorExtensions().get("x-is-jackson-optional-nullable")); + } + + @Test + public void testPostProcessNullableModelPropertyWithOpenApiNullableEnabledButJacksonDisabled() throws Exception { + JavaCXFClientCodegen codegen = new JavaCXFClientCodegen(); + codegen.additionalProperties().put(AbstractJavaCodegen.JACKSON, false); + codegen.additionalProperties().put(AbstractJavaCodegen.OPENAPI_NULLABLE, true); + codegen.processOpts(); + + CodegenModel codegenModel = new CodegenModel(); + CodegenProperty codegenProperty = new CodegenProperty(); + codegenProperty.required = false; + codegenProperty.isNullable = true; + + codegen.postProcessModelProperty(codegenModel, codegenProperty); + Assert.assertFalse(codegenModel.imports.contains("JsonNullable")); + Assert.assertFalse(codegenModel.imports.contains("JsonIgnore")); + Assert.assertNull(codegenProperty.getVendorExtensions().get("x-is-jackson-optional-nullable")); + } + + @Test + public void testUseJackson() throws Exception { + JavaCXFClientCodegen codegen = new JavaCXFClientCodegen(); + + codegen.processOpts(); + Assert.assertNull(codegen.additionalProperties().get(AbstractJavaCodegen.JACKSON)); + Assert.assertFalse(codegen.isUseJackson()); + + codegen.additionalProperties().put(AbstractJavaCodegen.JACKSON, true); + codegen.processOpts(); + Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaCodegen.JACKSON), Boolean.TRUE); + Assert.assertTrue(codegen.isUseJackson()); + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java index 4c83727afbe5..40080ec4384f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java @@ -23,6 +23,7 @@ import java.nio.file.Paths; import static org.openapitools.codegen.TestUtils.assertFileContains; import static org.openapitools.codegen.TestUtils.assertFileNotContains; +import static org.openapitools.codegen.languages.AbstractJavaCodegen.JACKSON; public abstract class JavaJaxrsBaseTest { @@ -59,7 +60,7 @@ public abstract class JavaJaxrsBaseTest { @Test public void doNotGenerateJsonAnnotationForPolymorphismIfJsonExclude() throws IOException { - codegen.additionalProperties().put("jackson", false); + codegen.additionalProperties().put(JACKSON, false); File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); output.deleteOnExit(); String outputPath = output.getAbsolutePath().replace('\\', '/'); diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/.openapi-generator-ignore b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/.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/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/.openapi-generator/FILES b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/.openapi-generator/FILES new file mode 100644 index 000000000000..0caf05fc2773 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/.openapi-generator/FILES @@ -0,0 +1,49 @@ +pom.xml +src/gen/java/org/openapitools/api/AnotherFakeApi.java +src/gen/java/org/openapitools/api/DefaultApi.java +src/gen/java/org/openapitools/api/FakeApi.java +src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java +src/gen/java/org/openapitools/api/PetApi.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/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/CatAllOf.java +src/gen/java/org/openapitools/model/Category.java +src/gen/java/org/openapitools/model/ClassModel.java +src/gen/java/org/openapitools/model/Client.java +src/gen/java/org/openapitools/model/Dog.java +src/gen/java/org/openapitools/model/DogAllOf.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/FileSchemaTestClass.java +src/gen/java/org/openapitools/model/Foo.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/InlineResponseDefault.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/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/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/Pet.java +src/gen/java/org/openapitools/model/ReadOnlyFirst.java +src/gen/java/org/openapitools/model/SpecialModelName.java +src/gen/java/org/openapitools/model/Tag.java +src/gen/java/org/openapitools/model/User.java diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/.openapi-generator/VERSION b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/.openapi-generator/VERSION new file mode 100644 index 000000000000..c30f0ec2be7f --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/pom.xml b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/pom.xml new file mode 100644 index 000000000000..c35a2bc81fb6 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/pom.xml @@ -0,0 +1,187 @@ + + 4.0.0 + org.openapitools + openapi-jaxrs-client + jar + openapi-jaxrs-client + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + 1.0.0 + + src/main/java + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + io.swagger + swagger-jaxrs + compile + ${swagger-core-version} + + + ch.qos.logback + logback-classic + ${logback-version} + compile + + + ch.qos.logback + logback-core + ${logback-version} + compile + + + junit + junit + ${junit-version} + test + + + + org.apache.cxf + cxf-rt-rs-client + ${cxf-version} + test + + + + + org.apache.cxf + cxf-rt-frontend-jaxrs + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-rs-service-description + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-ws-policy + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-wsdl + ${cxf-version} + compile + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson-jaxrs-version} + compile + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-jaxrs-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + javax.annotation + javax.annotation-api + ${javax-annotation-version} + provided + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + 1.7 + ${java.version} + ${java.version} + 1.5.18 + 9.2.9.v20150224 + 4.13.1 + 1.1.7 + 2.5 + 3.3.0 + 2.9.9 + 1.3.2 + 0.2.1 + UTF-8 + + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/AnotherFakeApi.java new file mode 100644 index 000000000000..8dfdd76aafb5 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -0,0 +1,45 @@ +package org.openapitools.api; + +import org.openapitools.model.Client; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; +import io.swagger.jaxrs.PATCH; + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + */ +@Path("/another-fake/dummy") +@Api(value = "/", description = "") +public interface AnotherFakeApi { + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + */ + @PATCH + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test special tags", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Client call123testSpecialTags(Client client); +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/DefaultApi.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/DefaultApi.java new file mode 100644 index 000000000000..3f89d74c9edb --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/DefaultApi.java @@ -0,0 +1,38 @@ +package org.openapitools.api; + +import org.openapitools.model.InlineResponseDefault; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; +import io.swagger.jaxrs.PATCH; + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + */ +@Path("/foo") +@Api(value = "/", description = "") +public interface DefaultApi { + + @GET + + @Produces({ "application/json" }) + @ApiOperation(value = "", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "response", response = InlineResponseDefault.class) }) + public InlineResponseDefault fooGet(); +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/FakeApi.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/FakeApi.java new file mode 100644 index 000000000000..a286c189544c --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/FakeApi.java @@ -0,0 +1,204 @@ +package org.openapitools.api; + +import java.math.BigDecimal; +import org.openapitools.model.Client; +import java.util.Date; +import java.io.File; +import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; +import org.joda.time.LocalDate; +import org.openapitools.model.OuterComposite; +import org.openapitools.model.Pet; +import org.openapitools.model.User; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; +import io.swagger.jaxrs.PATCH; + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + */ +@Path("/fake") +@Api(value = "/", description = "") +public interface FakeApi { + + /** + * Health check endpoint + * + */ + @GET + @Path("/health") + @Produces({ "application/json" }) + @ApiOperation(value = "Health check endpoint", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "The instance started successfully", response = HealthCheckResult.class) }) + public HealthCheckResult fakeHealthGet(); + + /** + * test http signature authentication + * + */ + @GET + @Path("/http-signature-test") + @Consumes({ "application/json", "application/xml" }) + @ApiOperation(value = "test http signature authentication", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "The instance started successfully") }) + public void fakeHttpSignatureTest(Pet pet, @QueryParam("query_1") String query1, @HeaderParam("header_1") String header1); + + @POST + @Path("/outer/boolean") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @ApiOperation(value = "", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + public Boolean fakeOuterBooleanSerialize(Boolean body); + + @POST + @Path("/outer/composite") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @ApiOperation(value = "", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + public OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite); + + @POST + @Path("/outer/number") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @ApiOperation(value = "", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + public BigDecimal fakeOuterNumberSerialize(BigDecimal body); + + @POST + @Path("/outer/string") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @ApiOperation(value = "", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) }) + public String fakeOuterStringSerialize(String body); + + @PUT + @Path("/body-with-file-schema") + @Consumes({ "application/json" }) + @ApiOperation(value = "", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Success") }) + public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); + + @PUT + @Path("/body-with-query-params") + @Consumes({ "application/json" }) + @ApiOperation(value = "", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Success") }) + public void testBodyWithQueryParams(@QueryParam("query") String query, User user); + + /** + * To test \"client\" model + * + * To test \"client\" model + * + */ + @PATCH + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test \"client\" model", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Client testClientModel(Client client); + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + */ + @POST + + @Consumes({ "application/x-www-form-urlencoded" }) + @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid username supplied"), + @ApiResponse(code = 404, message = "User not found") }) + public void testEndpointParameters(@Multipart(value = "number") BigDecimal number, @Multipart(value = "double") Double _double, @Multipart(value = "pattern_without_delimiter") String patternWithoutDelimiter, @Multipart(value = "byte") byte[] _byte, @Multipart(value = "integer", required = false) Integer integer, @Multipart(value = "int32", required = false) Integer int32, @Multipart(value = "int64", required = false) Long int64, @Multipart(value = "float", required = false) Float _float, @Multipart(value = "string", required = false) String string, @Multipart(value = "binary" , required = false) Attachment binaryDetail, @Multipart(value = "date", required = false) LocalDate date, @Multipart(value = "dateTime", required = false) Date dateTime, @Multipart(value = "password", required = false) String password, @Multipart(value = "callback", required = false) String paramCallback); + + /** + * To test enum parameters + * + * To test enum parameters + * + */ + @GET + + @Consumes({ "application/x-www-form-urlencoded" }) + @ApiOperation(value = "To test enum parameters", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid request"), + @ApiResponse(code = 404, message = "Not found") }) + public void testEnumParameters(@HeaderParam("enum_header_string_array") List enumHeaderStringArray, @HeaderParam("enum_header_string") String enumHeaderString, @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, @Multipart(value = "enum_form_string_array", required = false) List enumFormStringArray, @Multipart(value = "enum_form_string", required = false) String enumFormString); + + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + * + */ + @DELETE + + @ApiOperation(value = "Fake endpoint to test group parameters (optional)", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Someting wrong") }) + public void testGroupParameters(@QueryParam("required_string_group") Integer requiredStringGroup, @HeaderParam("required_boolean_group") Boolean requiredBooleanGroup, @QueryParam("required_int64_group") Long requiredInt64Group, @QueryParam("string_group") Integer stringGroup, @HeaderParam("boolean_group") Boolean booleanGroup, @QueryParam("int64_group") Long int64Group); + + /** + * test inline additionalProperties + * + */ + @POST + @Path("/inline-additionalProperties") + @Consumes({ "application/json" }) + @ApiOperation(value = "test inline additionalProperties", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void testInlineAdditionalProperties(Map requestBody); + + /** + * test json serialization of form data + * + */ + @GET + @Path("/jsonFormData") + @Consumes({ "application/x-www-form-urlencoded" }) + @ApiOperation(value = "test json serialization of form data", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void testJsonFormData(@Multipart(value = "param") String param, @Multipart(value = "param2") String param2); + + @PUT + @Path("/test-query-paramters") + @ApiOperation(value = "", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Success") }) + public void testQueryParameterCollectionFormat(@QueryParam("pipe") List pipe, @QueryParam("ioutil") List ioutil, @QueryParam("http") List http, @QueryParam("url") List url, @QueryParam("context") List context); +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..b973be7d283b --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java @@ -0,0 +1,45 @@ +package org.openapitools.api; + +import org.openapitools.model.Client; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; +import io.swagger.jaxrs.PATCH; + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + */ +@Path("/fake_classname_test") +@Api(value = "/", description = "") +public interface FakeClassnameTags123Api { + + /** + * To test class name in snake case + * + * To test class name in snake case + * + */ + @PATCH + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test class name in snake case", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Client testClassname(Client client); +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/PetApi.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/PetApi.java new file mode 100644 index 000000000000..09048cfdd1a8 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/PetApi.java @@ -0,0 +1,158 @@ +package org.openapitools.api; + +import java.io.File; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.Pet; +import java.util.Set; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; +import io.swagger.jaxrs.PATCH; + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + */ +@Path("") +@Api(value = "/", description = "") +public interface PetApi { + + /** + * Add a new pet to the store + * + */ + @POST + @Path("/pet") + @Consumes({ "application/json", "application/xml" }) + @ApiOperation(value = "Add a new pet to the store", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful operation"), + @ApiResponse(code = 405, message = "Invalid input") }) + public void addPet(Pet pet); + + /** + * Deletes a pet + * + */ + @DELETE + @Path("/pet/{petId}") + @ApiOperation(value = "Deletes a pet", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful operation"), + @ApiResponse(code = 400, message = "Invalid pet value") }) + public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey); + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + */ + @GET + @Path("/pet/findByStatus") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Finds Pets by status", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + @ApiResponse(code = 400, message = "Invalid status value") }) + public List findPetsByStatus(@QueryParam("status") List status); + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + */ + @GET + @Path("/pet/findByTags") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Finds Pets by tags", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "Set"), + @ApiResponse(code = 400, message = "Invalid tag value") }) + public Set findPetsByTags(@QueryParam("tags") Set tags); + + /** + * Find pet by ID + * + * Returns a single pet + * + */ + @GET + @Path("/pet/{petId}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Find pet by ID", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Pet not found") }) + public Pet getPetById(@PathParam("petId") Long petId); + + /** + * Update an existing pet + * + */ + @PUT + @Path("/pet") + @Consumes({ "application/json", "application/xml" }) + @ApiOperation(value = "Update an existing pet", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful operation"), + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Pet not found"), + @ApiResponse(code = 405, message = "Validation exception") }) + public void updatePet(Pet pet); + + /** + * Updates a pet in the store with form data + * + */ + @POST + @Path("/pet/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + @ApiOperation(value = "Updates a pet in the store with form data", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successful operation"), + @ApiResponse(code = 405, message = "Invalid input") }) + public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status); + + /** + * uploads an image + * + */ + @POST + @Path("/pet/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @ApiOperation(value = "uploads an image", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail); + + /** + * uploads an image (required) + * + */ + @POST + @Path("/fake/{petId}/uploadImageWithRequiredFile") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @ApiOperation(value = "uploads an image (required)", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + public ModelApiResponse uploadFileWithRequiredFile(@PathParam("petId") Long petId, @Multipart(value = "requiredFile" ) Attachment requiredFileDetail, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata); +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/StoreApi.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/StoreApi.java new file mode 100644 index 000000000000..e2f31aa5ae15 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/StoreApi.java @@ -0,0 +1,88 @@ +package org.openapitools.api; + +import org.openapitools.model.Order; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; +import io.swagger.jaxrs.PATCH; + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + */ +@Path("/store") +@Api(value = "/", description = "") +public interface StoreApi { + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + */ + @DELETE + @Path("/order/{order_id}") + @ApiOperation(value = "Delete purchase order by ID", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Order not found") }) + public void deleteOrder(@PathParam("order_id") String orderId); + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + */ + @GET + @Path("/inventory") + @Produces({ "application/json" }) + @ApiOperation(value = "Returns pet inventories by status", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) + public Map getInventory(); + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + */ + @GET + @Path("/order/{order_id}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Find purchase order by ID", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Order not found") }) + public Order getOrderById(@PathParam("order_id") Long orderId); + + /** + * Place an order for a pet + * + */ + @POST + @Path("/order") + @Consumes({ "application/json" }) + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Place an order for a pet", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid Order") }) + public Order placeOrder(Order order); +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/UserApi.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/UserApi.java new file mode 100644 index 000000000000..d27415f20560 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/api/UserApi.java @@ -0,0 +1,135 @@ +package org.openapitools.api; + +import org.openapitools.model.User; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; +import io.swagger.jaxrs.PATCH; + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + */ +@Path("/user") +@Api(value = "/", description = "") +public interface UserApi { + + /** + * Create user + * + * This can only be done by the logged in user. + * + */ + @POST + + @Consumes({ "application/json" }) + @ApiOperation(value = "Create user", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void createUser(User user); + + /** + * Creates list of users with given input array + * + */ + @POST + @Path("/createWithArray") + @Consumes({ "application/json" }) + @ApiOperation(value = "Creates list of users with given input array", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void createUsersWithArrayInput(List user); + + /** + * Creates list of users with given input array + * + */ + @POST + @Path("/createWithList") + @Consumes({ "application/json" }) + @ApiOperation(value = "Creates list of users with given input array", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void createUsersWithListInput(List user); + + /** + * Delete user + * + * This can only be done by the logged in user. + * + */ + @DELETE + @Path("/{username}") + @ApiOperation(value = "Delete user", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid username supplied"), + @ApiResponse(code = 404, message = "User not found") }) + public void deleteUser(@PathParam("username") String username); + + /** + * Get user by user name + * + */ + @GET + @Path("/{username}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Get user by user name", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = User.class), + @ApiResponse(code = 400, message = "Invalid username supplied"), + @ApiResponse(code = 404, message = "User not found") }) + public User getUserByName(@PathParam("username") String username); + + /** + * Logs user into the system + * + */ + @GET + @Path("/login") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Logs user into the system", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = String.class), + @ApiResponse(code = 400, message = "Invalid username/password supplied") }) + public String loginUser(@QueryParam("username") String username, @QueryParam("password") String password); + + /** + * Logs out current logged in user session + * + */ + @GET + @Path("/logout") + @ApiOperation(value = "Logs out current logged in user session", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void logoutUser(); + + /** + * Updated user + * + * This can only be done by the logged in user. + * + */ + @PUT + @Path("/{username}") + @Consumes({ "application/json" }) + @ApiOperation(value = "Updated user", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid user supplied"), + @ApiResponse(code = 404, message = "User not found") }) + public void updateUser(@PathParam("username") String username, User user); +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..f0108158055e --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -0,0 +1,93 @@ +package org.openapitools.model; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class AdditionalPropertiesClass { + + @ApiModelProperty(value = "") + private Map mapProperty = null; + + @ApiModelProperty(value = "") + private Map> mapOfMapProperty = null; + /** + * Get mapProperty + * @return mapProperty + **/ + @JsonProperty("map_property") + public Map getMapProperty() { + return mapProperty; + } + + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + /** + * Get mapOfMapProperty + * @return mapOfMapProperty + **/ + @JsonProperty("map_of_map_property") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Animal.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Animal.java new file mode 100644 index 000000000000..33f76666df7c --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Animal.java @@ -0,0 +1,87 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +@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"), +}) +public class Animal { + + @ApiModelProperty(required = true, value = "") + private String className; + + @ApiModelProperty(value = "") + private String color = "red"; + /** + * Get className + * @return className + **/ + @JsonProperty("className") + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public Animal className(String className) { + this.className = className; + return this; + } + + /** + * Get color + * @return color + **/ + @JsonProperty("color") + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public Animal color(String color) { + this.color = color; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..144c88be4f13 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,66 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ArrayOfArrayOfNumberOnly { + + @ApiModelProperty(value = "") + private List> arrayArrayNumber = null; + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @JsonProperty("ArrayArrayNumber") + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..5b7198ac58f5 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -0,0 +1,66 @@ +package org.openapitools.model; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ArrayOfNumberOnly { + + @ApiModelProperty(value = "") + private List arrayNumber = null; + /** + * Get arrayNumber + * @return arrayNumber + **/ + @JsonProperty("ArrayNumber") + public List getArrayNumber() { + return arrayNumber; + } + + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + this.arrayNumber.add(arrayNumberItem); + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ArrayTest.java new file mode 100644 index 000000000000..14df6ad168d9 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ArrayTest.java @@ -0,0 +1,120 @@ +package org.openapitools.model; + +import java.util.ArrayList; +import java.util.List; +import org.openapitools.model.ReadOnlyFirst; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ArrayTest { + + @ApiModelProperty(value = "") + private List arrayOfString = null; + + @ApiModelProperty(value = "") + private List> arrayArrayOfInteger = null; + + @ApiModelProperty(value = "") + private List> arrayArrayOfModel = null; + /** + * Get arrayOfString + * @return arrayOfString + **/ + @JsonProperty("array_of_string") + public List getArrayOfString() { + return arrayOfString; + } + + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @JsonProperty("array_array_of_integer") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @JsonProperty("array_array_of_model") + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Capitalization.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Capitalization.java new file mode 100644 index 000000000000..0019a471c17f --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Capitalization.java @@ -0,0 +1,171 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Capitalization { + + @ApiModelProperty(value = "") + private String smallCamel; + + @ApiModelProperty(value = "") + private String capitalCamel; + + @ApiModelProperty(value = "") + private String smallSnake; + + @ApiModelProperty(value = "") + private String capitalSnake; + + @ApiModelProperty(value = "") + private String scAETHFlowPoints; + + @ApiModelProperty(value = "Name of the pet ") + /** + * Name of the pet + **/ + private String ATT_NAME; + /** + * Get smallCamel + * @return smallCamel + **/ + @JsonProperty("smallCamel") + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @JsonProperty("CapitalCamel") + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @JsonProperty("small_Snake") + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @JsonProperty("Capital_Snake") + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @JsonProperty("SCA_ETH_Flow_Points") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @JsonProperty("ATT_NAME") + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Cat.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Cat.java new file mode 100644 index 000000000000..f72d26a1b5f0 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Cat.java @@ -0,0 +1,60 @@ +package org.openapitools.model; + +import org.openapitools.model.Animal; +import org.openapitools.model.CatAllOf; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Cat extends Animal { + + @ApiModelProperty(value = "") + private Boolean declawed; + /** + * Get declawed + * @return declawed + **/ + @JsonProperty("declawed") + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/CatAllOf.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/CatAllOf.java new file mode 100644 index 000000000000..cb2eea854278 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/CatAllOf.java @@ -0,0 +1,58 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CatAllOf { + + @ApiModelProperty(value = "") + private Boolean declawed; + /** + * Get declawed + * @return declawed + **/ + @JsonProperty("declawed") + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + public CatAllOf declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatAllOf {\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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Category.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Category.java new file mode 100644 index 000000000000..2fbcc46343d3 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Category.java @@ -0,0 +1,80 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Category { + + @ApiModelProperty(value = "") + private Long id; + + @ApiModelProperty(required = true, value = "") + private String name = "default-name"; + /** + * Get id + * @return id + **/ + @JsonProperty("id") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Category id(Long id) { + this.id = id; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Category name(String name) { + this.name = name; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ClassModel.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ClassModel.java new file mode 100644 index 000000000000..492c50b313c0 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ClassModel.java @@ -0,0 +1,63 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Model for testing model with \"_class\" property + **/ +@ApiModel(description="Model for testing model with \"_class\" property") +public class ClassModel { + + @ApiModelProperty(value = "") + private String propertyClass; + /** + * Get propertyClass + * @return propertyClass + **/ + @JsonProperty("_class") + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Client.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Client.java new file mode 100644 index 000000000000..dc64a9a708e3 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Client.java @@ -0,0 +1,58 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Client { + + @ApiModelProperty(value = "") + private String client; + /** + * Get client + * @return client + **/ + @JsonProperty("client") + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + + public Client client(String client) { + this.client = client; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Dog.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Dog.java new file mode 100644 index 000000000000..900b3643764b --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Dog.java @@ -0,0 +1,60 @@ +package org.openapitools.model; + +import org.openapitools.model.Animal; +import org.openapitools.model.DogAllOf; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Dog extends Animal { + + @ApiModelProperty(value = "") + private String breed; + /** + * Get breed + * @return breed + **/ + @JsonProperty("breed") + public String getBreed() { + return breed; + } + + public void setBreed(String breed) { + this.breed = breed; + } + + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/DogAllOf.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/DogAllOf.java new file mode 100644 index 000000000000..2bbc5648d5ac --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/DogAllOf.java @@ -0,0 +1,58 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class DogAllOf { + + @ApiModelProperty(value = "") + private String breed; + /** + * Get breed + * @return breed + **/ + @JsonProperty("breed") + public String getBreed() { + return breed; + } + + public void setBreed(String breed) { + this.breed = breed; + } + + public DogAllOf breed(String breed) { + this.breed = breed; + return this; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DogAllOf {\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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/EnumArrays.java new file mode 100644 index 000000000000..bb666614bfec --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/EnumArrays.java @@ -0,0 +1,160 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.List; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class EnumArrays { + +@XmlType(name="JustSymbolEnum") +@XmlEnum(String.class) +public enum JustSymbolEnum { + +@XmlEnumValue(">=") GREATER_THAN_OR_EQUAL_TO(String.valueOf(">=")), @XmlEnumValue("$") 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); + } + + @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 + "'"); + } +} + + @ApiModelProperty(value = "") + private JustSymbolEnum justSymbol; + +@XmlType(name="ArrayEnumEnum") +@XmlEnum(String.class) +public enum ArrayEnumEnum { + +@XmlEnumValue("fish") FISH(String.valueOf("fish")), @XmlEnumValue("crab") 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); + } + + @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 + "'"); + } +} + + @ApiModelProperty(value = "") + private List arrayEnum = null; + /** + * Get justSymbol + * @return justSymbol + **/ + @JsonProperty("just_symbol") + public String getJustSymbol() { + if (justSymbol == null) { + return null; + } + return justSymbol.value(); + } + + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @JsonProperty("array_enum") + public List getArrayEnum() { + return arrayEnum; + } + + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + this.arrayEnum.add(arrayEnumItem); + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/EnumClass.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/EnumClass.java new file mode 100644 index 000000000000..0c2b8541f887 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/EnumClass.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + + +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; + } + + @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/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/EnumTest.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/EnumTest.java new file mode 100644 index 000000000000..063aec42077b --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/EnumTest.java @@ -0,0 +1,381 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonValue; +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 io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class EnumTest { + +@XmlType(name="EnumStringEnum") +@XmlEnum(String.class) +public enum EnumStringEnum { + +@XmlEnumValue("UPPER") UPPER(String.valueOf("UPPER")), @XmlEnumValue("lower") LOWER(String.valueOf("lower")), @XmlEnumValue("") 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); + } + + @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 + "'"); + } +} + + @ApiModelProperty(value = "") + private EnumStringEnum enumString; + +@XmlType(name="EnumStringRequiredEnum") +@XmlEnum(String.class) +public enum EnumStringRequiredEnum { + +@XmlEnumValue("UPPER") UPPER(String.valueOf("UPPER")), @XmlEnumValue("lower") LOWER(String.valueOf("lower")), @XmlEnumValue("") 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); + } + + @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 + "'"); + } +} + + @ApiModelProperty(required = true, value = "") + private EnumStringRequiredEnum enumStringRequired; + +@XmlType(name="EnumIntegerEnum") +@XmlEnum(Integer.class) +public enum EnumIntegerEnum { + +@XmlEnumValue("1") NUMBER_1(Integer.valueOf(1)), @XmlEnumValue("-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); + } + + @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 + "'"); + } +} + + @ApiModelProperty(value = "") + private EnumIntegerEnum enumInteger; + +@XmlType(name="EnumNumberEnum") +@XmlEnum(Double.class) +public enum EnumNumberEnum { + +@XmlEnumValue("1.1") NUMBER_1_DOT_1(Double.valueOf(1.1)), @XmlEnumValue("-1.2") 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); + } + + @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 + "'"); + } +} + + @ApiModelProperty(value = "") + private EnumNumberEnum enumNumber; + + @ApiModelProperty(value = "") + private JsonNullable outerEnum = JsonNullable.undefined(); + + @ApiModelProperty(value = "") + private OuterEnumInteger outerEnumInteger; + + @ApiModelProperty(value = "") + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + + @ApiModelProperty(value = "") + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + /** + * Get enumString + * @return enumString + **/ + @JsonProperty("enum_string") + public String getEnumString() { + if (enumString == null) { + return null; + } + return enumString.value(); + } + + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @JsonProperty("enum_string_required") + public String getEnumStringRequired() { + if (enumStringRequired == null) { + return null; + } + return enumStringRequired.value(); + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @JsonProperty("enum_integer") + public Integer getEnumInteger() { + if (enumInteger == null) { + return null; + } + return enumInteger.value(); + } + + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @JsonProperty("enum_number") + public Double getEnumNumber() { + if (enumNumber == null) { + return null; + } + return enumNumber.value(); + } + + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @JsonIgnore + public OuterEnum getOuterEnum() { + if (outerEnum == null) { + return null; + } + return outerEnum.orElse(null); + } + + @JsonProperty("outerEnum") + public JsonNullable getOuterEnum_JsonNullable() { + return outerEnum; + } + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = JsonNullable.of(outerEnum); + } + + @JsonProperty("outerEnum") + public void setOuterEnum_JsonNullable(JsonNullable outerEnum) { + this.outerEnum = outerEnum; + } + + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = JsonNullable.of(outerEnum); + return this; + } + + /** + * Get outerEnumInteger + * @return outerEnumInteger + **/ + @JsonProperty("outerEnumInteger") + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + public void setOuterEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return this; + } + + /** + * Get outerEnumDefaultValue + * @return outerEnumDefaultValue + **/ + @JsonProperty("outerEnumDefaultValue") + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + public void setOuterEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + /** + * Get outerEnumIntegerDefaultValue + * @return outerEnumIntegerDefaultValue + **/ + @JsonProperty("outerEnumIntegerDefaultValue") + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + public void setOuterEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + public EnumTest outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..f712f5f21fd4 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -0,0 +1,87 @@ +package org.openapitools.model; + +import java.util.ArrayList; +import java.util.List; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class FileSchemaTestClass { + + @ApiModelProperty(value = "") + private java.io.File file; + + @ApiModelProperty(value = "") + private List files = null; + /** + * Get file + * @return file + **/ + @JsonProperty("file") + public java.io.File getFile() { + return file; + } + + public void setFile(java.io.File file) { + this.file = file; + } + + public FileSchemaTestClass file(java.io.File file) { + this.file = file; + return this; + } + + /** + * Get files + * @return files + **/ + @JsonProperty("files") + public List getFiles() { + return files; + } + + public void setFiles(List files) { + this.files = files; + } + + public FileSchemaTestClass files(List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(java.io.File filesItem) { + this.files.add(filesItem); + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Foo.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Foo.java new file mode 100644 index 000000000000..faf5d868e284 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Foo.java @@ -0,0 +1,58 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Foo { + + @ApiModelProperty(value = "") + private String bar = "bar"; + /** + * Get bar + * @return bar + **/ + @JsonProperty("bar") + public String getBar() { + return bar; + } + + public void setBar(String bar) { + this.bar = bar; + } + + public Foo bar(String bar) { + this.bar = bar; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/FormatTest.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/FormatTest.java new file mode 100644 index 000000000000..0f7e080d877e --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/FormatTest.java @@ -0,0 +1,409 @@ +package org.openapitools.model; + +import java.io.File; +import java.math.BigDecimal; +import java.util.Date; +import java.util.UUID; +import org.joda.time.LocalDate; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class FormatTest { + + @ApiModelProperty(value = "") + private Integer integer; + + @ApiModelProperty(value = "") + private Integer int32; + + @ApiModelProperty(value = "") + private Long int64; + + @ApiModelProperty(required = true, value = "") + private BigDecimal number; + + @ApiModelProperty(value = "") + private Float _float; + + @ApiModelProperty(value = "") + private Double _double; + + @ApiModelProperty(value = "") + private BigDecimal decimal; + + @ApiModelProperty(value = "") + private String string; + + @ApiModelProperty(required = true, value = "") + private byte[] _byte; + + @ApiModelProperty(value = "") + private File binary; + + @ApiModelProperty(required = true, value = "") + private LocalDate date; + + @ApiModelProperty(value = "") + private Date dateTime; + + @ApiModelProperty(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", value = "") + private UUID uuid; + + @ApiModelProperty(required = true, value = "") + private String password; + + @ApiModelProperty(value = "A string that is a 10 digit number. Can have leading zeros.") + /** + * A string that is a 10 digit number. Can have leading zeros. + **/ + private String patternWithDigits; + + @ApiModelProperty(value = "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + **/ + private String patternWithDigitsAndDelimiter; + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @JsonProperty("integer") + public Integer getInteger() { + return integer; + } + + public void setInteger(Integer integer) { + this.integer = integer; + } + + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @JsonProperty("int32") + public Integer getInt32() { + return int32; + } + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @JsonProperty("int64") + public Long getInt64() { + return int64; + } + + public void setInt64(Long int64) { + this.int64 = int64; + } + + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @JsonProperty("number") + public BigDecimal getNumber() { + return number; + } + + public void setNumber(BigDecimal number) { + this.number = number; + } + + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @JsonProperty("float") + public Float getFloat() { + return _float; + } + + public void setFloat(Float _float) { + this._float = _float; + } + + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @JsonProperty("double") + public Double getDouble() { + return _double; + } + + public void setDouble(Double _double) { + this._double = _double; + } + + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + /** + * Get decimal + * @return decimal + **/ + @JsonProperty("decimal") + public BigDecimal getDecimal() { + return decimal; + } + + public void setDecimal(BigDecimal decimal) { + this.decimal = decimal; + } + + public FormatTest decimal(BigDecimal decimal) { + this.decimal = decimal; + return this; + } + + /** + * Get string + * @return string + **/ + @JsonProperty("string") + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + + public FormatTest string(String string) { + this.string = string; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @JsonProperty("byte") + public byte[] getByte() { + return _byte; + } + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get binary + * @return binary + **/ + @JsonProperty("binary") + public File getBinary() { + return binary; + } + + public void setBinary(File binary) { + this.binary = binary; + } + + public FormatTest binary(File binary) { + this.binary = binary; + return this; + } + + /** + * Get date + * @return date + **/ + @JsonProperty("date") + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + + public FormatTest date(LocalDate date) { + this.date = date; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @JsonProperty("dateTime") + public Date getDateTime() { + return dateTime; + } + + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + public FormatTest dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @JsonProperty("uuid") + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get password + * @return password + **/ + @JsonProperty("password") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public FormatTest password(String password) { + this.password = password; + return this; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + * @return patternWithDigits + **/ + @JsonProperty("pattern_with_digits") + public String getPatternWithDigits() { + return patternWithDigits; + } + + public void setPatternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + public FormatTest patternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return this; + } + + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + * @return patternWithDigitsAndDelimiter + **/ + @JsonProperty("pattern_with_digits_and_delimiter") + public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + public void setPatternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + + @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(toIndentedString(password)).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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..8b81d3c024ad --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -0,0 +1,64 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class HasOnlyReadOnly { + + @ApiModelProperty(value = "") + private String bar; + + @ApiModelProperty(value = "") + private String foo; + /** + * Get bar + * @return bar + **/ + @JsonProperty("bar") + public String getBar() { + return bar; + } + + + /** + * Get foo + * @return foo + **/ + @JsonProperty("foo") + public String getFoo() { + return 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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/HealthCheckResult.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/HealthCheckResult.java new file mode 100644 index 000000000000..3a07e9d7754c --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/HealthCheckResult.java @@ -0,0 +1,78 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import org.openapitools.jackson.nullable.JsonNullable; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * 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.") +public class HealthCheckResult { + + @ApiModelProperty(value = "") + private JsonNullable nullableMessage = JsonNullable.undefined(); + /** + * Get nullableMessage + * @return nullableMessage + **/ + @JsonIgnore + public String getNullableMessage() { + if (nullableMessage == null) { + return null; + } + return nullableMessage.orElse(null); + } + + @JsonProperty("NullableMessage") + public JsonNullable getNullableMessage_JsonNullable() { + return nullableMessage; + } + + public void setNullableMessage(String nullableMessage) { + this.nullableMessage = JsonNullable.of(nullableMessage); + } + + @JsonProperty("NullableMessage") + public void setNullableMessage_JsonNullable(JsonNullable nullableMessage) { + this.nullableMessage = nullableMessage; + } + + public HealthCheckResult nullableMessage(String nullableMessage) { + this.nullableMessage = JsonNullable.of(nullableMessage); + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/InlineResponseDefault.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/InlineResponseDefault.java new file mode 100644 index 000000000000..1adeb42e24d0 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/InlineResponseDefault.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import org.openapitools.model.Foo; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class InlineResponseDefault { + + @ApiModelProperty(value = "") + private Foo string; + /** + * Get string + * @return string + **/ + @JsonProperty("string") + public Foo getString() { + return string; + } + + public void setString(Foo string) { + this.string = string; + } + + public InlineResponseDefault string(Foo string) { + this.string = string; + return this; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineResponseDefault {\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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/MapTest.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/MapTest.java new file mode 100644 index 000000000000..982f2d897769 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/MapTest.java @@ -0,0 +1,183 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class MapTest { + + @ApiModelProperty(value = "") + private Map> mapMapOfString = null; + +@XmlType(name="InnerEnum") +@XmlEnum(String.class) +public enum InnerEnum { + +@XmlEnumValue("UPPER") UPPER(String.valueOf("UPPER")), @XmlEnumValue("lower") 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); + } + + @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 + "'"); + } +} + + @ApiModelProperty(value = "") + private Map mapOfEnumString = null; + + @ApiModelProperty(value = "") + private Map directMap = null; + + @ApiModelProperty(value = "") + private Map indirectMap = null; + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @JsonProperty("map_map_of_string") + public Map> getMapMapOfString() { + return mapMapOfString; + } + + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @JsonProperty("map_of_enum_string") + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @JsonProperty("direct_map") + public Map getDirectMap() { + return directMap; + } + + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @JsonProperty("indirect_map") + public Map getIndirectMap() { + return indirectMap; + } + + public void setIndirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + } + + public MapTest indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + this.indirectMap.put(key, indirectMapItem); + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..a02f0977b238 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,113 @@ +package org.openapitools.model; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.model.Animal; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class MixedPropertiesAndAdditionalPropertiesClass { + + @ApiModelProperty(value = "") + private UUID uuid; + + @ApiModelProperty(value = "") + private Date dateTime; + + @ApiModelProperty(value = "") + private Map map = null; + /** + * Get uuid + * @return uuid + **/ + @JsonProperty("uuid") + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @JsonProperty("dateTime") + public Date getDateTime() { + return dateTime; + } + + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get map + * @return map + **/ + @JsonProperty("map") + public Map getMap() { + return map; + } + + public void setMap(Map map) { + this.map = map; + } + + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + this.map.put(key, mapItem); + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Model200Response.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Model200Response.java new file mode 100644 index 000000000000..4f83df87b82d --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Model200Response.java @@ -0,0 +1,85 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Model for testing model name starting with number + **/ +@ApiModel(description="Model for testing model name starting with number") +public class Model200Response { + + @ApiModelProperty(value = "") + private Integer name; + + @ApiModelProperty(value = "") + private String propertyClass; + /** + * Get name + * @return name + **/ + @JsonProperty("name") + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @JsonProperty("class") + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ModelApiResponse.java new file mode 100644 index 000000000000..7c628ec80e98 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -0,0 +1,102 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelApiResponse { + + @ApiModelProperty(value = "") + private Integer code; + + @ApiModelProperty(value = "") + private String type; + + @ApiModelProperty(value = "") + private String message; + /** + * Get code + * @return code + **/ + @JsonProperty("code") + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get type + * @return type + **/ + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get message + * @return message + **/ + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ModelReturn.java new file mode 100644 index 000000000000..ea48b1ce7e08 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ModelReturn.java @@ -0,0 +1,63 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Model for testing reserved words + **/ +@ApiModel(description="Model for testing reserved words") +public class ModelReturn { + + @ApiModelProperty(value = "") + private Integer _return; + /** + * Get _return + * @return _return + **/ + @JsonProperty("return") + public Integer getReturn() { + return _return; + } + + public void setReturn(Integer _return) { + this._return = _return; + } + + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Name.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Name.java new file mode 100644 index 000000000000..dab102816a54 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Name.java @@ -0,0 +1,113 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Model for testing model name same as property name + **/ +@ApiModel(description="Model for testing model name same as property name") +public class Name { + + @ApiModelProperty(required = true, value = "") + private Integer name; + + @ApiModelProperty(value = "") + private Integer snakeCase; + + @ApiModelProperty(value = "") + private String property; + + @ApiModelProperty(value = "") + private Integer _123number; + /** + * Get name + * @return name + **/ + @JsonProperty("name") + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + public Name name(Integer name) { + this.name = name; + return this; + } + + /** + * Get snakeCase + * @return snakeCase + **/ + @JsonProperty("snake_case") + public Integer getSnakeCase() { + return snakeCase; + } + + + /** + * Get property + * @return property + **/ + @JsonProperty("property") + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + public Name property(String property) { + this.property = property; + return this; + } + + /** + * Get _123number + * @return _123number + **/ + @JsonProperty("123Number") + public Integer get123number() { + return _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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/NullableClass.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/NullableClass.java new file mode 100644 index 000000000000..8f1f0c63e3ac --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/NullableClass.java @@ -0,0 +1,481 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.math.BigDecimal; +import java.util.ArrayList; +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 io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NullableClass extends HashMap { + + @ApiModelProperty(value = "") + private JsonNullable integerProp = JsonNullable.undefined(); + + @ApiModelProperty(value = "") + private JsonNullable numberProp = JsonNullable.undefined(); + + @ApiModelProperty(value = "") + private JsonNullable booleanProp = JsonNullable.undefined(); + + @ApiModelProperty(value = "") + private JsonNullable stringProp = JsonNullable.undefined(); + + @ApiModelProperty(value = "") + private JsonNullable dateProp = JsonNullable.undefined(); + + @ApiModelProperty(value = "") + private JsonNullable datetimeProp = JsonNullable.undefined(); + + @ApiModelProperty(value = "") + private JsonNullable> arrayNullableProp = JsonNullable.>undefined(); + + @ApiModelProperty(value = "") + private JsonNullable> arrayAndItemsNullableProp = JsonNullable.>undefined(); + + @ApiModelProperty(value = "") + private List arrayItemsNullable = null; + + @ApiModelProperty(value = "") + private JsonNullable> objectNullableProp = JsonNullable.>undefined(); + + @ApiModelProperty(value = "") + private JsonNullable> objectAndItemsNullableProp = JsonNullable.>undefined(); + + @ApiModelProperty(value = "") + private Map objectItemsNullable = null; + /** + * Get integerProp + * @return integerProp + **/ + @JsonIgnore + public Integer getIntegerProp() { + if (integerProp == null) { + return null; + } + return integerProp.orElse(null); + } + + @JsonProperty("integer_prop") + public JsonNullable getIntegerProp_JsonNullable() { + return integerProp; + } + + public void setIntegerProp(Integer integerProp) { + this.integerProp = JsonNullable.of(integerProp); + } + + @JsonProperty("integer_prop") + public void setIntegerProp_JsonNullable(JsonNullable integerProp) { + this.integerProp = integerProp; + } + + public NullableClass integerProp(Integer integerProp) { + this.integerProp = JsonNullable.of(integerProp); + return this; + } + + /** + * Get numberProp + * @return numberProp + **/ + @JsonIgnore + public BigDecimal getNumberProp() { + if (numberProp == null) { + return null; + } + return numberProp.orElse(null); + } + + @JsonProperty("number_prop") + public JsonNullable getNumberProp_JsonNullable() { + return numberProp; + } + + public void setNumberProp(BigDecimal numberProp) { + this.numberProp = JsonNullable.of(numberProp); + } + + @JsonProperty("number_prop") + public void setNumberProp_JsonNullable(JsonNullable numberProp) { + this.numberProp = numberProp; + } + + public NullableClass numberProp(BigDecimal numberProp) { + this.numberProp = JsonNullable.of(numberProp); + return this; + } + + /** + * Get booleanProp + * @return booleanProp + **/ + @JsonIgnore + public Boolean getBooleanProp() { + if (booleanProp == null) { + return null; + } + return booleanProp.orElse(null); + } + + @JsonProperty("boolean_prop") + public JsonNullable getBooleanProp_JsonNullable() { + return booleanProp; + } + + public void setBooleanProp(Boolean booleanProp) { + this.booleanProp = JsonNullable.of(booleanProp); + } + + @JsonProperty("boolean_prop") + public void setBooleanProp_JsonNullable(JsonNullable booleanProp) { + this.booleanProp = booleanProp; + } + + public NullableClass booleanProp(Boolean booleanProp) { + this.booleanProp = JsonNullable.of(booleanProp); + return this; + } + + /** + * Get stringProp + * @return stringProp + **/ + @JsonIgnore + public String getStringProp() { + if (stringProp == null) { + return null; + } + return stringProp.orElse(null); + } + + @JsonProperty("string_prop") + public JsonNullable getStringProp_JsonNullable() { + return stringProp; + } + + public void setStringProp(String stringProp) { + this.stringProp = JsonNullable.of(stringProp); + } + + @JsonProperty("string_prop") + public void setStringProp_JsonNullable(JsonNullable stringProp) { + this.stringProp = stringProp; + } + + public NullableClass stringProp(String stringProp) { + this.stringProp = JsonNullable.of(stringProp); + return this; + } + + /** + * Get dateProp + * @return dateProp + **/ + @JsonIgnore + public LocalDate getDateProp() { + if (dateProp == null) { + return null; + } + return dateProp.orElse(null); + } + + @JsonProperty("date_prop") + public JsonNullable getDateProp_JsonNullable() { + return dateProp; + } + + public void setDateProp(LocalDate dateProp) { + this.dateProp = JsonNullable.of(dateProp); + } + + @JsonProperty("date_prop") + public void setDateProp_JsonNullable(JsonNullable dateProp) { + this.dateProp = dateProp; + } + + public NullableClass dateProp(LocalDate dateProp) { + this.dateProp = JsonNullable.of(dateProp); + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + **/ + @JsonIgnore + public Date getDatetimeProp() { + if (datetimeProp == null) { + return null; + } + return datetimeProp.orElse(null); + } + + @JsonProperty("datetime_prop") + public JsonNullable getDatetimeProp_JsonNullable() { + return datetimeProp; + } + + public void setDatetimeProp(Date datetimeProp) { + this.datetimeProp = JsonNullable.of(datetimeProp); + } + + @JsonProperty("datetime_prop") + public void setDatetimeProp_JsonNullable(JsonNullable datetimeProp) { + this.datetimeProp = datetimeProp; + } + + public NullableClass datetimeProp(Date datetimeProp) { + this.datetimeProp = JsonNullable.of(datetimeProp); + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + **/ + @JsonIgnore + public List getArrayNullableProp() { + if (arrayNullableProp == null) { + return null; + } + return arrayNullableProp.orElse(null); + } + + @JsonProperty("array_nullable_prop") + public JsonNullable> getArrayNullableProp_JsonNullable() { + return arrayNullableProp; + } + + public void setArrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + } + + @JsonProperty("array_nullable_prop") + public void setArrayNullableProp_JsonNullable(JsonNullable> arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + public NullableClass arrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + return this; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + this.arrayNullableProp = JsonNullable.>of(new ArrayList()); + } + this.arrayNullableProp.get().add(arrayNullablePropItem); + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + **/ + @JsonIgnore + public List getArrayAndItemsNullableProp() { + if (arrayAndItemsNullableProp == null) { + return null; + } + return arrayAndItemsNullableProp.orElse(null); + } + + @JsonProperty("array_and_items_nullable_prop") + public JsonNullable> getArrayAndItemsNullableProp_JsonNullable() { + return arrayAndItemsNullableProp; + } + + public void setArrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + } + + @JsonProperty("array_and_items_nullable_prop") + public void setArrayAndItemsNullableProp_JsonNullable(JsonNullable> arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + public NullableClass arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + return this; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList()); + } + this.arrayAndItemsNullableProp.get().add(arrayAndItemsNullablePropItem); + return this; + } + + /** + * Get arrayItemsNullable + * @return arrayItemsNullable + **/ + @JsonProperty("array_items_nullable") + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + public void setArrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + public NullableClass arrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + **/ + @JsonIgnore + public Map getObjectNullableProp() { + if (objectNullableProp == null) { + return null; + } + return objectNullableProp.orElse(null); + } + + @JsonProperty("object_nullable_prop") + public JsonNullable> getObjectNullableProp_JsonNullable() { + return objectNullableProp; + } + + public void setObjectNullableProp(Map objectNullableProp) { + this.objectNullableProp = JsonNullable.>of(objectNullableProp); + } + + @JsonProperty("object_nullable_prop") + public void setObjectNullableProp_JsonNullable(JsonNullable> objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + public NullableClass objectNullableProp(Map objectNullableProp) { + this.objectNullableProp = JsonNullable.>of(objectNullableProp); + return this; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null || !this.objectNullableProp.isPresent()) { + this.objectNullableProp = JsonNullable.>of(new HashMap()); + } + this.objectNullableProp.get().put(key, objectNullablePropItem); + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + **/ + @JsonIgnore + public Map getObjectAndItemsNullableProp() { + if (objectAndItemsNullableProp == null) { + return null; + } + return objectAndItemsNullableProp.orElse(null); + } + + @JsonProperty("object_and_items_nullable_prop") + public JsonNullable> getObjectAndItemsNullableProp_JsonNullable() { + return objectAndItemsNullableProp; + } + + public void setObjectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + } + + @JsonProperty("object_and_items_nullable_prop") + public void setObjectAndItemsNullableProp_JsonNullable(JsonNullable> objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + public NullableClass objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + return this; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap()); + } + this.objectAndItemsNullableProp.get().put(key, objectAndItemsNullablePropItem); + return this; + } + + /** + * Get objectItemsNullable + * @return objectItemsNullable + **/ + @JsonProperty("object_items_nullable") + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + public void setObjectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + public NullableClass objectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + return this; + } + + public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/NumberOnly.java new file mode 100644 index 000000000000..c59e4fc25db3 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/NumberOnly.java @@ -0,0 +1,59 @@ +package org.openapitools.model; + +import java.math.BigDecimal; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NumberOnly { + + @ApiModelProperty(value = "") + private BigDecimal justNumber; + /** + * Get justNumber + * @return justNumber + **/ + @JsonProperty("JustNumber") + public BigDecimal getJustNumber() { + return justNumber; + } + + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Order.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Order.java new file mode 100644 index 000000000000..6df21e42f210 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Order.java @@ -0,0 +1,211 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Date; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Order { + + @ApiModelProperty(value = "") + private Long id; + + @ApiModelProperty(value = "") + private Long petId; + + @ApiModelProperty(value = "") + private Integer quantity; + + @ApiModelProperty(value = "") + private Date shipDate; + +@XmlType(name="StatusEnum") +@XmlEnum(String.class) +public enum StatusEnum { + +@XmlEnumValue("placed") PLACED(String.valueOf("placed")), @XmlEnumValue("approved") APPROVED(String.valueOf("approved")), @XmlEnumValue("delivered") 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); + } + + @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 + "'"); + } +} + + @ApiModelProperty(value = "Order Status") + /** + * Order Status + **/ + private StatusEnum status; + + @ApiModelProperty(value = "") + private Boolean complete = false; + /** + * Get id + * @return id + **/ + @JsonProperty("id") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Order id(Long id) { + this.id = id; + return this; + } + + /** + * Get petId + * @return petId + **/ + @JsonProperty("petId") + public Long getPetId() { + return petId; + } + + public void setPetId(Long petId) { + this.petId = petId; + } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @JsonProperty("quantity") + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @JsonProperty("shipDate") + public Date getShipDate() { + return shipDate; + } + + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + public Order shipDate(Date shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Order Status + * @return status + **/ + @JsonProperty("status") + public String getStatus() { + if (status == null) { + return null; + } + return status.value(); + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get complete + * @return complete + **/ + @JsonProperty("complete") + public Boolean getComplete() { + return complete; + } + + public void setComplete(Boolean complete) { + this.complete = complete; + } + + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterComposite.java new file mode 100644 index 000000000000..51f1cbe83998 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterComposite.java @@ -0,0 +1,103 @@ +package org.openapitools.model; + +import java.math.BigDecimal; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class OuterComposite { + + @ApiModelProperty(value = "") + private BigDecimal myNumber; + + @ApiModelProperty(value = "") + private String myString; + + @ApiModelProperty(value = "") + private Boolean myBoolean; + /** + * Get myNumber + * @return myNumber + **/ + @JsonProperty("my_number") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myString + * @return myString + **/ + @JsonProperty("my_string") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @JsonProperty("my_boolean") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnum.java new file mode 100644 index 000000000000..0248ef97a837 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnum.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + + +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; + } + + @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/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..ccd802fdf70c --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + + +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; + } + + @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/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnumInteger.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnumInteger.java new file mode 100644 index 000000000000..a54af1b06b82 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnumInteger.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + + +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; + } + + @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/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..63e001988b5f --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,41 @@ +package org.openapitools.model; + + +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; + } + + @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/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Pet.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Pet.java new file mode 100644 index 000000000000..458e399bdc80 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Pet.java @@ -0,0 +1,226 @@ +package org.openapitools.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.model.Category; +import org.openapitools.model.Tag; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Pet { + + @ApiModelProperty(value = "") + private Long id; + + @ApiModelProperty(value = "") + private Category category; + + @ApiModelProperty(example = "doggie", required = true, value = "") + private String name; + + @ApiModelProperty(required = true, value = "") + private Set photoUrls = new LinkedHashSet(); + + @ApiModelProperty(value = "") + private List tags = null; + +@XmlType(name="StatusEnum") +@XmlEnum(String.class) +public enum StatusEnum { + +@XmlEnumValue("available") AVAILABLE(String.valueOf("available")), @XmlEnumValue("pending") PENDING(String.valueOf("pending")), @XmlEnumValue("sold") 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); + } + + @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 + "'"); + } +} + + @ApiModelProperty(value = "pet status in the store") + /** + * pet status in the store + **/ + private StatusEnum status; + /** + * Get id + * @return id + **/ + @JsonProperty("id") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Pet id(Long id) { + this.id = id; + return this; + } + + /** + * Get category + * @return category + **/ + @JsonProperty("category") + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + public Pet category(Category category) { + this.category = category; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Pet name(String name) { + this.name = name; + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @JsonProperty("photoUrls") + public Set getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet photoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @JsonProperty("tags") + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + this.tags.add(tagsItem); + return this; + } + + /** + * pet status in the store + * @return status + **/ + @JsonProperty("status") + public String getStatus() { + if (status == null) { + return null; + } + return status.value(); + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..51d0933e4a33 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -0,0 +1,72 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ReadOnlyFirst { + + @ApiModelProperty(value = "") + private String bar; + + @ApiModelProperty(value = "") + private String baz; + /** + * Get bar + * @return bar + **/ + @JsonProperty("bar") + public String getBar() { + return bar; + } + + + /** + * Get baz + * @return baz + **/ + @JsonProperty("baz") + public String getBaz() { + return baz; + } + + public void setBaz(String baz) { + this.baz = baz; + } + + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/SpecialModelName.java new file mode 100644 index 000000000000..f69d373158a1 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -0,0 +1,58 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SpecialModelName { + + @ApiModelProperty(value = "") + private Long $specialPropertyName; + /** + * Get $specialPropertyName + * @return $specialPropertyName + **/ + @JsonProperty("$special[property.name]") + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Tag.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Tag.java new file mode 100644 index 000000000000..794fa454925d --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/Tag.java @@ -0,0 +1,80 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Tag { + + @ApiModelProperty(value = "") + private Long id; + + @ApiModelProperty(value = "") + private String name; + /** + * Get id + * @return id + **/ + @JsonProperty("id") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Tag id(Long id) { + this.id = id; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Tag name(String name) { + this.name = name; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/User.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/User.java new file mode 100644 index 000000000000..3c364f502ab2 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/gen/java/org/openapitools/model/User.java @@ -0,0 +1,215 @@ +package org.openapitools.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class User { + + @ApiModelProperty(value = "") + private Long id; + + @ApiModelProperty(value = "") + private String username; + + @ApiModelProperty(value = "") + private String firstName; + + @ApiModelProperty(value = "") + private String lastName; + + @ApiModelProperty(value = "") + private String email; + + @ApiModelProperty(value = "") + private String password; + + @ApiModelProperty(value = "") + private String phone; + + @ApiModelProperty(value = "User Status") + /** + * User Status + **/ + private Integer userStatus; + /** + * Get id + * @return id + **/ + @JsonProperty("id") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public User id(Long id) { + this.id = id; + return this; + } + + /** + * Get username + * @return username + **/ + @JsonProperty("username") + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public User username(String username) { + this.username = username; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @JsonProperty("firstName") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @JsonProperty("lastName") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get email + * @return email + **/ + @JsonProperty("email") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get password + * @return password + **/ + @JsonProperty("password") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public User password(String password) { + this.password = password; + return this; + } + + /** + * Get phone + * @return phone + **/ + @JsonProperty("phone") + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public User phone(String phone) { + this.phone = phone; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @JsonProperty("userStatus") + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + + @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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/AnotherFakeApiTest.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/AnotherFakeApiTest.java new file mode 100644 index 000000000000..40b34eb3c61a --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/AnotherFakeApiTest.java @@ -0,0 +1,80 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.api; + +import org.openapitools.model.Client; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.client.JAXRSClientFactory; +import org.apache.cxf.jaxrs.client.ClientConfiguration; +import org.apache.cxf.jaxrs.client.WebClient; + + +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API tests for AnotherFakeApi + */ +public class AnotherFakeApiTest { + + + private AnotherFakeApi api; + + @Before + public void setup() { + JacksonJsonProvider provider = new JacksonJsonProvider(); + List providers = new ArrayList(); + providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io:80/v2", AnotherFakeApi.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); + + ClientConfiguration config = WebClient.getConfig(client); + } + + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void call123testSpecialTagsTest() { + Client client = null; + //Client response = api.call123testSpecialTags(client); + //assertNotNull(response); + // TODO: test validations + + + } + +} diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/DefaultApiTest.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/DefaultApiTest.java new file mode 100644 index 000000000000..27170ce46553 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/DefaultApiTest.java @@ -0,0 +1,75 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.api; + +import org.openapitools.model.InlineResponseDefault; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.client.JAXRSClientFactory; +import org.apache.cxf.jaxrs.client.ClientConfiguration; +import org.apache.cxf.jaxrs.client.WebClient; + + +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API tests for DefaultApi + */ +public class DefaultApiTest { + + + private DefaultApi api; + + @Before + public void setup() { + JacksonJsonProvider provider = new JacksonJsonProvider(); + List providers = new ArrayList(); + providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io:80/v2", DefaultApi.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); + + ClientConfiguration config = WebClient.getConfig(client); + } + + + /** + * @throws ApiException + * if the Api call fails + */ + @Test + public void fooGetTest() { + //InlineResponseDefault response = api.fooGet(); + //assertNotNull(response); + // TODO: test validations + + + } + +} diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/FakeApiTest.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/FakeApiTest.java new file mode 100644 index 000000000000..0371717f6c1c --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/FakeApiTest.java @@ -0,0 +1,337 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.api; + +import java.math.BigDecimal; +import org.openapitools.model.Client; +import java.util.Date; +import java.io.File; +import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; +import org.joda.time.LocalDate; +import org.openapitools.model.OuterComposite; +import org.openapitools.model.Pet; +import org.openapitools.model.User; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.client.JAXRSClientFactory; +import org.apache.cxf.jaxrs.client.ClientConfiguration; +import org.apache.cxf.jaxrs.client.WebClient; + + +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API tests for FakeApi + */ +public class FakeApiTest { + + + private FakeApi api; + + @Before + public void setup() { + JacksonJsonProvider provider = new JacksonJsonProvider(); + List providers = new ArrayList(); + providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io:80/v2", FakeApi.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); + + ClientConfiguration config = WebClient.getConfig(client); + } + + + /** + * Health check endpoint + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeHealthGetTest() { + //HealthCheckResult response = api.fakeHealthGet(); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * test http signature authentication + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeHttpSignatureTestTest() { + Pet pet = null; + String query1 = null; + String header1 = null; + //api.fakeHttpSignatureTest(pet, query1, header1); + + // TODO: test validations + + + } + + /** + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterBooleanSerializeTest() { + Boolean body = null; + //Boolean response = api.fakeOuterBooleanSerialize(body); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterCompositeSerializeTest() { + OuterComposite outerComposite = null; + //OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterNumberSerializeTest() { + BigDecimal body = null; + //BigDecimal response = api.fakeOuterNumberSerialize(body); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterStringSerializeTest() { + String body = null; + //String response = api.fakeOuterStringSerialize(body); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * @throws ApiException + * if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() { + FileSchemaTestClass fileSchemaTestClass = null; + //api.testBodyWithFileSchema(fileSchemaTestClass); + + // TODO: test validations + + + } + + /** + * @throws ApiException + * if the Api call fails + */ + @Test + public void testBodyWithQueryParamsTest() { + String query = null; + User user = null; + //api.testBodyWithQueryParams(query, user); + + // TODO: test validations + + + } + + /** + * To test \"client\" model + * + * To test \"client\" model + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClientModelTest() { + Client client = null; + //Client response = api.testClientModel(client); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testEndpointParametersTest() { + BigDecimal number = null; + Double _double = null; + String patternWithoutDelimiter = null; + byte[] _byte = null; + Integer integer = null; + Integer int32 = null; + Long int64 = null; + Float _float = null; + String string = null; + org.apache.cxf.jaxrs.ext.multipart.Attachment binary = null; + LocalDate date = null; + Date dateTime = null; + String password = null; + String paramCallback = null; + //api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + + // TODO: test validations + + + } + + /** + * To test enum parameters + * + * To test enum parameters + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testEnumParametersTest() { + List enumHeaderStringArray = null; + String enumHeaderString = null; + List enumQueryStringArray = null; + String enumQueryString = null; + Integer enumQueryInteger = null; + Double enumQueryDouble = null; + List enumFormStringArray = null; + String enumFormString = null; + //api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + + // TODO: test validations + + + } + + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testGroupParametersTest() { + Integer requiredStringGroup = null; + Boolean requiredBooleanGroup = null; + Long requiredInt64Group = null; + Integer stringGroup = null; + Boolean booleanGroup = null; + Long int64Group = null; + //api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + + // TODO: test validations + + + } + + /** + * test inline additionalProperties + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() { + Map requestBody = null; + //api.testInlineAdditionalProperties(requestBody); + + // TODO: test validations + + + } + + /** + * test json serialization of form data + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testJsonFormDataTest() { + String param = null; + String param2 = null; + //api.testJsonFormData(param, param2); + + // TODO: test validations + + + } + + /** + * @throws ApiException + * if the Api call fails + */ + @Test + public void testQueryParameterCollectionFormatTest() { + List pipe = null; + List ioutil = null; + List http = null; + List url = null; + List context = null; + //api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + + // TODO: test validations + + + } + +} diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/FakeClassnameTags123ApiTest.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 000000000000..cb2a07382b23 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,80 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.api; + +import org.openapitools.model.Client; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.client.JAXRSClientFactory; +import org.apache.cxf.jaxrs.client.ClientConfiguration; +import org.apache.cxf.jaxrs.client.WebClient; + + +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API tests for FakeClassnameTags123Api + */ +public class FakeClassnameTags123ApiTest { + + + private FakeClassnameTags123Api api; + + @Before + public void setup() { + JacksonJsonProvider provider = new JacksonJsonProvider(); + List providers = new ArrayList(); + providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io:80/v2", FakeClassnameTags123Api.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); + + ClientConfiguration config = WebClient.getConfig(client); + } + + + /** + * To test class name in snake case + * + * To test class name in snake case + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClassnameTest() { + Client client = null; + //Client response = api.testClassname(client); + //assertNotNull(response); + // TODO: test validations + + + } + +} diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/PetApiTest.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/PetApiTest.java new file mode 100644 index 000000000000..542a5ffaa6fa --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/PetApiTest.java @@ -0,0 +1,222 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.api; + +import java.io.File; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.Pet; +import java.util.Set; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.client.JAXRSClientFactory; +import org.apache.cxf.jaxrs.client.ClientConfiguration; +import org.apache.cxf.jaxrs.client.WebClient; + + +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API tests for PetApi + */ +public class PetApiTest { + + + private PetApi api; + + @Before + public void setup() { + JacksonJsonProvider provider = new JacksonJsonProvider(); + List providers = new ArrayList(); + providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io:80/v2", PetApi.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); + + ClientConfiguration config = WebClient.getConfig(client); + } + + + /** + * Add a new pet to the store + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void addPetTest() { + Pet pet = null; + //api.addPet(pet); + + // TODO: test validations + + + } + + /** + * Deletes a pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deletePetTest() { + Long petId = null; + String apiKey = null; + //api.deletePet(petId, apiKey); + + // TODO: test validations + + + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByStatusTest() { + List status = null; + //List response = api.findPetsByStatus(status); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByTagsTest() { + Set tags = null; + //Set response = api.findPetsByTags(tags); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getPetByIdTest() { + Long petId = null; + //Pet response = api.getPetById(petId); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * Update an existing pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetTest() { + Pet pet = null; + //api.updatePet(pet); + + // TODO: test validations + + + } + + /** + * Updates a pet in the store with form data + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetWithFormTest() { + Long petId = null; + String name = null; + String status = null; + //api.updatePetWithForm(petId, name, status); + + // TODO: test validations + + + } + + /** + * uploads an image + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileTest() { + Long petId = null; + String additionalMetadata = null; + org.apache.cxf.jaxrs.ext.multipart.Attachment file = null; + //ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * uploads an image (required) + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() { + Long petId = null; + org.apache.cxf.jaxrs.ext.multipart.Attachment requiredFile = null; + String additionalMetadata = null; + //ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + //assertNotNull(response); + // TODO: test validations + + + } + +} diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/StoreApiTest.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/StoreApiTest.java new file mode 100644 index 000000000000..1d11fa63e2f3 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/StoreApiTest.java @@ -0,0 +1,131 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.api; + +import org.openapitools.model.Order; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.client.JAXRSClientFactory; +import org.apache.cxf.jaxrs.client.ClientConfiguration; +import org.apache.cxf.jaxrs.client.WebClient; + + +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API tests for StoreApi + */ +public class StoreApiTest { + + + private StoreApi api; + + @Before + public void setup() { + JacksonJsonProvider provider = new JacksonJsonProvider(); + List providers = new ArrayList(); + providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io:80/v2", StoreApi.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); + + ClientConfiguration config = WebClient.getConfig(client); + } + + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteOrderTest() { + String orderId = null; + //api.deleteOrder(orderId); + + // TODO: test validations + + + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getInventoryTest() { + //Map response = api.getInventory(); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getOrderByIdTest() { + Long orderId = null; + //Order response = api.getOrderById(orderId); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * Place an order for a pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void placeOrderTest() { + Order order = null; + //Order response = api.placeOrder(order); + //assertNotNull(response); + // TODO: test validations + + + } + +} diff --git a/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/UserApiTest.java b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/UserApiTest.java new file mode 100644 index 000000000000..c0fa3aa090e2 --- /dev/null +++ b/samples/openapi3/client/petstore/jaxrs-cxf-client-jackson-nullable/src/test/java/org/openapitools/api/UserApiTest.java @@ -0,0 +1,197 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.api; + +import org.openapitools.model.User; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.client.JAXRSClientFactory; +import org.apache.cxf.jaxrs.client.ClientConfiguration; +import org.apache.cxf.jaxrs.client.WebClient; + + +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API tests for UserApi + */ +public class UserApiTest { + + + private UserApi api; + + @Before + public void setup() { + JacksonJsonProvider provider = new JacksonJsonProvider(); + List providers = new ArrayList(); + providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io:80/v2", UserApi.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); + + ClientConfiguration config = WebClient.getConfig(client); + } + + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUserTest() { + User user = null; + //api.createUser(user); + + // TODO: test validations + + + } + + /** + * Creates list of users with given input array + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() { + List user = null; + //api.createUsersWithArrayInput(user); + + // TODO: test validations + + + } + + /** + * Creates list of users with given input array + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithListInputTest() { + List user = null; + //api.createUsersWithListInput(user); + + // TODO: test validations + + + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteUserTest() { + String username = null; + //api.deleteUser(username); + + // TODO: test validations + + + } + + /** + * Get user by user name + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getUserByNameTest() { + String username = null; + //User response = api.getUserByName(username); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * Logs user into the system + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void loginUserTest() { + String username = null; + String password = null; + //String response = api.loginUser(username, password); + //assertNotNull(response); + // TODO: test validations + + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void logoutUserTest() { + //api.logoutUser(); + + // TODO: test validations + + + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateUserTest() { + String username = null; + User user = null; + //api.updateUser(username, user); + + // TODO: test validations + + + } + +}