diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache index 5f597f12a591..2e4bf9a2905d 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache @@ -46,12 +46,12 @@ }}{{/serializableModel}}{{! no newline }}{{/parent}} { {{#discriminator}} - {{#requiredVars}} - {{>interfaceReqVar}}{{! prevent indent}} - {{/requiredVars}} - {{#optionalVars}} - {{>interfaceOptVar}}{{! prevent indent}} - {{/optionalVars}} +{{#requiredVars}} +{{>interfaceReqVar}}{{! prevent indent}} +{{/requiredVars}} +{{#optionalVars}} +{{>interfaceOptVar}}{{! prevent indent}} +{{/optionalVars}} {{/discriminator}} {{#hasEnums}}{{#vars}}{{#isEnum}} /** diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache index ab575d4bf9d3..34ade5ec8501 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache @@ -1,6 +1,24 @@ -{{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} - @ApiModelProperty({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swagger1AnnotationLibrary}}{{#deprecated}} - @Deprecated(message = ""){{/deprecated}}{{#vendorExtensions.x-field-extra-annotation}} - {{{.}}}{{/vendorExtensions.x-field-extra-annotation}} - @get:JsonProperty("{{{baseName}}}"){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInPascalCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? = {{^defaultValue}}null{{/defaultValue}}{{#defaultValue}}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}} \ No newline at end of file +{{! comments are used to break long lines into multiple lines for better readability }} +{{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}}{{! +}}{{#swagger2AnnotationLibrary}} + @Schema({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}required = false, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{! +}}{{/swagger2AnnotationLibrary}}{{! +}}{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}required = false, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{! +}}{{/swagger1AnnotationLibrary}}{{! +}}{{#deprecated}} + @Deprecated(message = ""){{! +}}{{/deprecated}}{{! +}}{{#vendorExtensions.x-field-extra-annotation}} + {{{.}}}{{! +}}{{/vendorExtensions.x-field-extra-annotation}} + @get:JsonProperty("{{{baseName}}}", required = false) + {{#isInherited}}{{! +}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{! +}}{{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInPascalCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{! +}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{! +}}{{^defaultValue}}? = null{{/defaultValue}}{{! +}}{{#defaultValue}}{{#isNullable}}?{{/isNullable}} = {{! + }}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{! + }}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{! +}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache index 92e2875ac08a..9f38710d55d1 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache @@ -1,5 +1,21 @@ -{{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}}{{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}required = true, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} - @ApiModelProperty({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}required = true, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swagger1AnnotationLibrary}}{{#vendorExtensions.x-field-extra-annotation}} - {{{.}}}{{/vendorExtensions.x-field-extra-annotation}} - @get:JsonProperty("{{{baseName}}}", required = true){{#isInherited}} override{{/isInherited}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInPascalCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}}?{{/isNullable}}{{#defaultValue}} = {{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{/defaultValue}} \ No newline at end of file +{{! comments are used to break long lines into multiple lines for better readability }} +{{#useBeanValidation}}{{>beanValidation}}{{>beanValidationModel}}{{/useBeanValidation}}{{! +}}{{#swagger2AnnotationLibrary}} + @Schema({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}required = true, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{! +}}{{/swagger2AnnotationLibrary}}{{! +}}{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeInNormalString}}{{{.}}}{{/lambdaEscapeInNormalString}}{{/lambdaRemoveLineBreak}}", {{/example}}required = true, {{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{! +}}{{/swagger1AnnotationLibrary}}{{! +}}{{#vendorExtensions.x-field-extra-annotation}} + {{{.}}}{{! +}}{{/vendorExtensions.x-field-extra-annotation}} + @get:JsonProperty("{{{baseName}}}", required = true) + {{#isInherited}}{{! +}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{! +}}{{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInPascalCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{! +}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{! +}}{{#isNullable}}?{{/isNullable}}{{! +}}{{#defaultValue}} = {{! + }}{{^isNumber}}{{{defaultValue}}}{{/isNumber}}{{! + }}{{#isNumber}}{{{dataType}}}("{{{defaultValue}}}"){{/isNumber}}{{! +}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache index 3fa63ad64876..69aabb5f526d 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache @@ -1,5 +1,22 @@ +{{! comments are used to break long lines into multiple lines for better readability }} {{#swagger2AnnotationLibrary}} - @get:Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}requiredMode = Schema.RequiredMode.REQUIRED, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} - @get:ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swagger1AnnotationLibrary}}{{#vendorExtensions.x-field-extra-annotation}} - {{{.}}}{{/vendorExtensions.x-field-extra-annotation}} - {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInPascalCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? {{^discriminator}}= {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/discriminator}} + @get:Schema({{#example}}example = "{{{.}}}", {{/example}}{{! + }}{{#required}}requiredMode = Schema.RequiredMode.REQUIRED, {{/required}}{{! + }}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}{{! + }}description = "{{{description}}}"){{! +}}{{/swagger2AnnotationLibrary}}{{! +}}{{#swagger1AnnotationLibrary}} + @get:ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{! + }}{{#required}}required = {{required}}, {{/required}}{{! + }}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}{{! + }}value = "{{{description}}}"){{! +}}{{/swagger1AnnotationLibrary}}{{! +}}{{#vendorExtensions.x-field-extra-annotation}} + {{{.}}}{{! +}}{{/vendorExtensions.x-field-extra-annotation}} + {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{! +}}{{#isEnum}}{{classname}}.{{nameInPascalCase}}{{/isEnum}}{{! +}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{! +}}{{#isNullable}}?{{/isNullable}}{{! +}}{{^isNullable}}{{^defaultValue}}?{{/defaultValue}}{{/isNullable}}{{! +}}{{^discriminator}} = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/discriminator}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache index 8f0fb71ba319..a6fb2fc0aad7 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache @@ -1,5 +1,19 @@ +{{! comments are used to break long lines into multiple lines for better readability }} {{#swagger2AnnotationLibrary}} - @get:Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}requiredMode = Schema.RequiredMode.REQUIRED, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} - @get:ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swagger1AnnotationLibrary}}{{#vendorExtensions.x-field-extra-annotation}} - {{{.}}}{{/vendorExtensions.x-field-extra-annotation}} - {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInPascalCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}} + @get:Schema({{#example}}example = "{{{.}}}", {{/example}}{{! + }}{{#required}}requiredMode = Schema.RequiredMode.REQUIRED, {{/required}}{{! + }}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}{{! + }}description = "{{{description}}}"){{! +}}{{/swagger2AnnotationLibrary}}{{! +}}{{#swagger1AnnotationLibrary}} + @get:ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{! + }}{{#required}}required = {{required}}, {{/required}}{{! + }}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}{{! + }}value = "{{{description}}}"){{! +}}{{/swagger1AnnotationLibrary}}{{! +}}{{#vendorExtensions.x-field-extra-annotation}} + {{{.}}}{{! +}}{{/vendorExtensions.x-field-extra-annotation}} + {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{! +}}{{#isEnum}}{{classname}}.{{nameInPascalCase}}{{/isEnum}}{{! +}}{{^isEnum}}{{{dataType}}}{{/isEnum}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index 4835aa65e8ec..6e4e0a52c97f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -1064,6 +1064,141 @@ public void generateNonSerializableModelWithXimplements() throws Exception { ); } + @Test + public void generateModelWithRequiredFalseWithDefaults() throws Exception { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + String outputPath = output.getAbsolutePath().replace('\\', '/'); + + KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(CodegenConstants.SERIALIZABLE_MODEL, true); + + ClientOptInput input = new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml")) + .config(codegen); + DefaultGenerator generator = new DefaultGenerator(); + + generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false"); + + generator.opts(input).generate(); + + Path dogPath = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Dog.kt"); + assertFileContains( + dogPath, + // [not required, not nullable, no default ] => value is nullable + "@get:JsonProperty(\"category\", required = false)", + "override val category: Category? = null", + // [not required, not nullable, yes default ] => value is not nullable to disallow explicit passing of null + "@get:JsonProperty(\"nonRequiredWithDefaultList\", required = false)", + "override val nonRequiredWithDefaultList: kotlin.collections.List = arrayListOf(\"just some default string\",\"another default string\"),", + "@get:JsonProperty(\"nonRequiredWithDefaultSet\", required = false)", + "override val nonRequiredWithDefaultSet: kotlin.collections.Set = setOf(\"more strings\",\"look, it's a string!\")", + "@get:JsonProperty(\"nonRequiredWithDefaultString\", required = false)", + "override val nonRequiredWithDefaultString: kotlin.String = \"defaultValue\"", + "@get:JsonProperty(\"nonRequiredWithDefaultInt\", required = false)", + "override val nonRequiredWithDefaultInt: java.math.BigDecimal = java.math.BigDecimal(\"15\")", + "@get:JsonProperty(\"nonRequiredWithDefaultLong\", required = false)", + "override val nonRequiredWithDefaultLong: java.math.BigDecimal = java.math.BigDecimal(\"15\")", + "@get:JsonProperty(\"nonRequiredWithDefaultFloat\", required = false)", + "override val nonRequiredWithDefaultFloat: kotlin.Float = 15.45f", + "@get:JsonProperty(\"nonRequiredWithDefaultDouble\", required = false)", + "override val nonRequiredWithDefaultDouble: kotlin.Double = 15.45", + "@get:JsonProperty(\"nonRequiredWithDefaultEnum\", required = false)", + "override val nonRequiredWithDefaultEnum: SomeEnum = SomeEnum.ENUMVALUE1", + "@get:JsonProperty(\"nonRequiredWithDefaultEnumList\", required = false)", + "override val nonRequiredWithDefaultEnumList: kotlin.collections.List = arrayListOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1)", + "@get:JsonProperty(\"nonRequiredWithDefaultEnumSet\", required = false)", + "override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1)", + // [not required, yes nullable, yes default [null] ] => value is nullable to allow explicit passing of null + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNullList\", required = false)", + "override val nonRequiredNullableWithDefaultNullList: kotlin.collections.List? = null", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNullSet\", required = false)", + "override val nonRequiredNullableWithDefaultNullSet: kotlin.collections.Set? = null", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNullString\", required = false)", + "override val nonRequiredNullableWithDefaultNullString: kotlin.String? = null", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNullInt\", required = false)", + "override val nonRequiredNullableWithDefaultNullInt: java.math.BigDecimal? = null", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNullLong\", required = false)", + "override val nonRequiredNullableWithDefaultNullLong: java.math.BigDecimal? = null", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNullFloat\", required = false)", + "override val nonRequiredNullableWithDefaultNullFloat: kotlin.Float? = null", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNullDouble\", required = false)", + "override val nonRequiredNullableWithDefaultNullDouble: kotlin.Double? = null", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNullEnum\", required = false)", + "override val nonRequiredNullableWithDefaultNullEnum: SomeNullableEnumWithNullDefault? = null", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNullEnumList\", required = false)", + "override val nonRequiredNullableWithDefaultNullEnumList: kotlin.collections.List? = null", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNullEnumSet\", required = false)", + "override val nonRequiredNullableWithDefaultNullEnumSet: kotlin.collections.Set? = null", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNonNullList\", required = false)", + // [not required, yes nullable, yes default [non null] ] => value is nullable to allow explicit passing of null + "override val nonRequiredNullableWithDefaultNonNullList: kotlin.collections.List? = arrayListOf(\"some string\",\"another string\")", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNonNullSet\", required = false)", + "override val nonRequiredNullableWithDefaultNonNullSet: kotlin.collections.Set? = setOf(\"some string\",\"another string\")", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNonNullString\", required = false)", + "override val nonRequiredNullableWithDefaultNonNullString: kotlin.String? = \"some string\"", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNonNullInt\", required = false)", + "override val nonRequiredNullableWithDefaultNonNullInt: java.math.BigDecimal? = java.math.BigDecimal(\"42\")", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNonNullLong\", required = false)", + "override val nonRequiredNullableWithDefaultNonNullLong: java.math.BigDecimal? = java.math.BigDecimal(\"42\")", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNonNullFloat\", required = false)", + "override val nonRequiredNullableWithDefaultNonNullFloat: kotlin.Float? = 15.45f", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNonNullDouble\", required = false)", + "override val nonRequiredNullableWithDefaultNonNullDouble: kotlin.Double? = 15.45", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNonNullEnum\", required = false)", + "override val nonRequiredNullableWithDefaultNonNullEnum: SomeNullableEnumWithNonNullDefault? = SomeNullableEnumWithNonNullDefault.ENUMVALUE1", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNonNullEnumList\", required = false)", + "override val nonRequiredNullableWithDefaultNonNullEnumList: kotlin.collections.List? = arrayListOf(SomeEnum.ENUMVALUE1)", + "@get:JsonProperty(\"nonRequiredNullableWithDefaultNonNullEnumSet\", required = false)", + "override val nonRequiredNullableWithDefaultNonNullEnumSet: kotlin.collections.Set? = setOf(SomeEnum.ENUMVALUE1)" + ); + + Path petPath = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Pet.kt"); + assertFileContains( + petPath, + // [not required, not nullable, no default ] => value is nullable + "override val category: Category?", + // [not required, not nullable, yes default ] => value is not nullable to disallow explicit passing of null + "val nonRequiredWithDefaultList: kotlin.collections.List", + "val nonRequiredWithDefaultSet: kotlin.collections.Set", + "val nonRequiredWithDefaultString: kotlin.String", + "val nonRequiredWithDefaultInt: java.math.BigDecimal", + "val nonRequiredWithDefaultLong: java.math.BigDecimal", + "val nonRequiredWithDefaultFloat: kotlin.Float", + "val nonRequiredWithDefaultDouble: kotlin.Double", + "val nonRequiredWithDefaultEnum: SomeEnum", + "val nonRequiredWithDefaultEnumList: kotlin.collections.List", + "val nonRequiredWithDefaultEnumSet: kotlin.collections.Set", + // [not required, yes nullable, yes default [null] ] => value is nullable to allow explicit passing of null + "val nonRequiredNullableWithDefaultNullList: kotlin.collections.List?", + "val nonRequiredNullableWithDefaultNullSet: kotlin.collections.Set?", + "val nonRequiredNullableWithDefaultNullString: kotlin.String?", + "val nonRequiredNullableWithDefaultNullInt: java.math.BigDecimal?", + "val nonRequiredNullableWithDefaultNullLong: java.math.BigDecimal?", + "val nonRequiredNullableWithDefaultNullFloat: kotlin.Float?", + "val nonRequiredNullableWithDefaultNullDouble: kotlin.Double?", + "val nonRequiredNullableWithDefaultNullEnum: SomeNullableEnumWithNullDefault?", + "val nonRequiredNullableWithDefaultNullEnumList: kotlin.collections.List?", + "val nonRequiredNullableWithDefaultNullEnumSet: kotlin.collections.Set?", + // [not required, yes nullable, yes default [non null] ] => value is nullable to allow explicit passing of null + "val nonRequiredNullableWithDefaultNonNullList: kotlin.collections.List?", + "val nonRequiredNullableWithDefaultNonNullSet: kotlin.collections.Set?", + "val nonRequiredNullableWithDefaultNonNullString: kotlin.String?", + "val nonRequiredNullableWithDefaultNonNullInt: java.math.BigDecimal?", + "val nonRequiredNullableWithDefaultNonNullLong: java.math.BigDecimal?", + "val nonRequiredNullableWithDefaultNonNullFloat: kotlin.Float?", + "val nonRequiredNullableWithDefaultNonNullDouble: kotlin.Double?", + "val nonRequiredNullableWithDefaultNonNullEnum: SomeNullableEnumWithNonNullDefault?", + "val nonRequiredNullableWithDefaultNonNullEnumList: kotlin.collections.List?", + "val nonRequiredNullableWithDefaultNonNullEnumSet: kotlin.collections.Set?" + ); + } + @Test public void reactiveWithoutFlow() throws Exception { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml index b54ec0cd53ef..6753eb21c403 100644 --- a/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml @@ -523,6 +523,154 @@ components: $ref: '#/components/schemas/Category' name: type: string + nonRequiredWithDefaultList: + type: array + items: + type: string + default: [ "just some default string", "another default string" ] + nonRequiredWithDefaultSet: + type: array + items: + type: string + uniqueItems: true + default: [ "more strings", "look, it's a string!" ] + nonRequiredWithDefaultString: + type: string + default: defaultValue + nonRequiredWithDefaultInt: + type: number + format: int32 + default: 15 + nonRequiredWithDefaultLong: + type: number + format: int64 + default: 15 + nonRequiredWithDefaultFloat: + type: number + format: float + default: 15.45 + nonRequiredWithDefaultDouble: + type: number + format: double + default: 15.45 + nonRequiredWithDefaultEnum: + $ref: '#/components/schemas/SomeEnum' + nonRequiredWithDefaultEnumList: + type: array + items: + $ref: '#/components/schemas/SomeEnum' + default: [ ENUMVALUE3, ENUMVALUE1 ] + nonRequiredWithDefaultEnumSet: + type: array + uniqueItems: true + items: + $ref: '#/components/schemas/SomeEnum' + default: [ ENUMVALUE3, ENUMVALUE1 ] + nonRequiredNullableWithDefaultNullList: + type: array + items: + type: string + nullable: true + default: null + nonRequiredNullableWithDefaultNullSet: + type: array + items: + type: string + uniqueItems: true + nullable: true + default: null + nonRequiredNullableWithDefaultNullString: + type: string + nullable: true + default: null + nonRequiredNullableWithDefaultNullInt: + type: number + format: int32 + nullable: true + default: null + nonRequiredNullableWithDefaultNullLong: + type: number + format: int64 + nullable: true + default: null + nonRequiredNullableWithDefaultNullFloat: + type: number + format: float + nullable: true + default: null + nonRequiredNullableWithDefaultNullDouble: + type: number + format: double + nullable: true + default: null + nonRequiredNullableWithDefaultNullEnum: + $ref: '#/components/schemas/SomeNullableEnumWithNullDefault' + nonRequiredNullableWithDefaultNullEnumList: + type: array + items: + $ref: '#/components/schemas/SomeEnum' + nullable: true + default: null + nonRequiredNullableWithDefaultNullEnumSet: + type: array + uniqueItems: true + items: + $ref: '#/components/schemas/SomeEnum' + nullable: true + default: null + ###---#### + nonRequiredNullableWithDefaultNonNullList: + type: array + items: + type: string + nullable: true + default: ["some string", "another string"] + nonRequiredNullableWithDefaultNonNullSet: + type: array + items: + type: string + uniqueItems: true + nullable: true + default: ["some string", "another string"] + nonRequiredNullableWithDefaultNonNullString: + type: string + nullable: true + default: "some string" + nonRequiredNullableWithDefaultNonNullInt: + type: number + format: int32 + nullable: true + default: 42 + nonRequiredNullableWithDefaultNonNullLong: + type: number + format: int64 + nullable: true + default: 42 + nonRequiredNullableWithDefaultNonNullFloat: + type: number + format: float + nullable: true + default: 15.45 + nonRequiredNullableWithDefaultNonNullDouble: + type: number + format: double + nullable: true + default: 15.45 + nonRequiredNullableWithDefaultNonNullEnum: + $ref: '#/components/schemas/SomeNullableEnumWithNonNullDefault' + nonRequiredNullableWithDefaultNonNullEnumList: + type: array + items: + $ref: '#/components/schemas/SomeEnum' + nullable: true + default: [ ENUMVALUE1 ] + nonRequiredNullableWithDefaultNonNullEnumSet: + type: array + uniqueItems: true + items: + $ref: '#/components/schemas/SomeEnum' + nullable: true + default: [ ENUMVALUE1 ] photoUrls: type: array items: @@ -580,6 +728,29 @@ components: format: int64 name: type: string + SomeEnum: + type: string + enum: + - ENUMVALUE1 + - ENUMVALUE2 + - ENUMVALUE3 + default: ENUMVALUE1 + SomeNullableEnumWithNullDefault: + type: string + enum: + - ENUMVALUE1 + - ENUMVALUE2 + - ENUMVALUE3 + nullable: true + default: null + SomeNullableEnumWithNonNullDefault: + type: string + enum: + - ENUMVALUE1 + - ENUMVALUE2 + - ENUMVALUE3 + nullable: true + default: ENUMVALUE1 Color: x-kotlin-implements: [ com.some.pack.WithDefaultMethods ] type: string diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt index 98a854a51b39..d4b187439cd2 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt @@ -21,10 +21,12 @@ import javax.validation.Valid */ data class Category( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") - @get:JsonProperty("name") val name: kotlin.String? = null + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index f520047d850d..43c9b8f30f1b 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -22,11 +22,14 @@ import javax.validation.Valid */ data class ModelApiResponse( - @get:JsonProperty("code") val code: kotlin.Int? = null, + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @get:JsonProperty("type") val type: kotlin.String? = null, + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @get:JsonProperty("message") val message: kotlin.String? = null + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt index 4ebe51e765ed..7aec2196ea67 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt @@ -27,17 +27,23 @@ import javax.validation.Valid */ data class Order( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @get:JsonProperty("status") val status: Order.Status? = null, + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt index 2f7be6be5cec..4848a46e3290 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt @@ -29,20 +29,26 @@ import javax.validation.Valid */ data class Pet( - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @get:JsonProperty("category") val category: Category? = null, + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, @Deprecated(message = "") - @get:JsonProperty("status") val status: Pet.Status? = null + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt index 36f841600047..3393d7d4b6e6 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt @@ -21,9 +21,11 @@ import javax.validation.Valid */ data class Tag( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("name") val name: kotlin.String? = null + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt index b04c9e312592..65a7ce5299f4 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt @@ -27,21 +27,29 @@ import javax.validation.Valid */ data class User( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("username") val username: kotlin.String? = null, + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @get:JsonProperty("email") val email: kotlin.String? = null, + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @get:JsonProperty("password") val password: kotlin.String? = null, + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Annotation.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Annotation.kt index fbe2546e842b..6ff3ccb7a69a 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Annotation.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Annotation.kt @@ -20,8 +20,9 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Annotation( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: java.util.UUID? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: java.util.UUID? = null ) { } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt index 2e2b228abcb3..9a03826d59a8 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt @@ -39,46 +39,59 @@ import io.swagger.v3.oas.annotations.media.Schema data class AnyOfUserOrPet( @Schema(example = "null", required = true, description = "") - @get:JsonProperty("username", required = true) val username: kotlin.String, + @get:JsonProperty("username", required = true) + val username: kotlin.String, @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") val category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @Schema(example = "null", description = "pet status in the store") + @Schema(example = "null", required = false, description = "pet status in the store") @Deprecated(message = "") - @get:JsonProperty("status") val status: AnyOfUserOrPet.Status? = null + @get:JsonProperty("status", required = false) + val status: AnyOfUserOrPet.Status? = null ) { /** diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt index 926a00f8a5e5..9f4caa350f94 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt @@ -39,46 +39,59 @@ import io.swagger.v3.oas.annotations.media.Schema data class AnyOfUserOrPetOrArrayString( @Schema(example = "null", required = true, description = "") - @get:JsonProperty("username", required = true) val username: kotlin.String, + @get:JsonProperty("username", required = true) + val username: kotlin.String, @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") val category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @Schema(example = "null", description = "pet status in the store") + @Schema(example = "null", required = false, description = "pet status in the store") @Deprecated(message = "") - @get:JsonProperty("status") val status: AnyOfUserOrPetOrArrayString.Status? = null + @get:JsonProperty("status", required = false) + val status: AnyOfUserOrPetOrArrayString.Status? = null ) { /** diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Category.kt index 4f5e1ae1bcd4..19515fc3afc5 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Category.kt @@ -21,12 +21,14 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Category( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 29636f4bad1e..9458eff01277 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -22,14 +22,17 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class ModelApiResponse( - @Schema(example = "null", description = "") - @get:JsonProperty("code") val code: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("type") val type: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("message") val message: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt index 5225690f54ba..25d76e8905b5 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt @@ -27,23 +27,29 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Order( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @Schema(example = "null", description = "Order Status") - @get:JsonProperty("status") val status: Order.Status? = null, + @Schema(example = "null", required = false, description = "Order Status") + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) { /** diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt index 963d5c056403..d6f2167b6fec 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt @@ -30,25 +30,31 @@ import io.swagger.v3.oas.annotations.media.Schema data class Pet( @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") val category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @Schema(example = "null", description = "pet status in the store") + @Schema(example = "null", required = false, description = "pet status in the store") @Deprecated(message = "") - @get:JsonProperty("status") val status: Pet.Status? = null + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) { /** diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Tag.kt index 179b6d27b5c4..db84f24d4939 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Tag.kt @@ -21,11 +21,13 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Tag( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/User.kt index afae2dbbf1fa..6c5b1640c27a 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/User.kt @@ -28,28 +28,36 @@ import io.swagger.v3.oas.annotations.media.Schema data class User( @Schema(example = "null", required = true, description = "") - @get:JsonProperty("username", required = true) val username: kotlin.String, + @get:JsonProperty("username", required = true) + val username: kotlin.String, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) { } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPet.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPet.kt index b4e44ad9fc3a..eb760bca8990 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPet.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPet.kt @@ -39,46 +39,59 @@ import io.swagger.v3.oas.annotations.media.Schema data class UserOrPet( @Schema(example = "null", required = true, description = "") - @get:JsonProperty("username", required = true) val username: kotlin.String, + @get:JsonProperty("username", required = true) + val username: kotlin.String, @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") val category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @Schema(example = "null", description = "pet status in the store") + @Schema(example = "null", required = false, description = "pet status in the store") @Deprecated(message = "") - @get:JsonProperty("status") val status: UserOrPet.Status? = null + @get:JsonProperty("status", required = false) + val status: UserOrPet.Status? = null ) { /** diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPetOrArrayString.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPetOrArrayString.kt index 929d8d32d286..5108ca45031f 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPetOrArrayString.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPetOrArrayString.kt @@ -39,46 +39,59 @@ import io.swagger.v3.oas.annotations.media.Schema data class UserOrPetOrArrayString( @Schema(example = "null", required = true, description = "") - @get:JsonProperty("username", required = true) val username: kotlin.String, + @get:JsonProperty("username", required = true) + val username: kotlin.String, @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") val category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @Schema(example = "null", description = "pet status in the store") + @Schema(example = "null", required = false, description = "pet status in the store") @Deprecated(message = "") - @get:JsonProperty("status") val status: UserOrPetOrArrayString.Status? = null + @get:JsonProperty("status", required = false) + val status: UserOrPetOrArrayString.Status? = null ) { /** diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Category.kt index 50cfbcf80623..50461806cc42 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Category.kt @@ -21,10 +21,12 @@ import jakarta.validation.Valid */ data class Category( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") - @get:JsonProperty("name") val name: kotlin.String? = null + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 4d12f23ba411..afe1ed2f7fc6 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -22,11 +22,14 @@ import jakarta.validation.Valid */ data class ModelApiResponse( - @get:JsonProperty("code") val code: kotlin.Int? = null, + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @get:JsonProperty("type") val type: kotlin.String? = null, + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @get:JsonProperty("message") val message: kotlin.String? = null + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt index bee507c64e65..ad144aa25604 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt @@ -27,17 +27,23 @@ import jakarta.validation.Valid */ data class Order( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @get:JsonProperty("status") val status: Order.Status? = null, + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt index e78365b47814..e4c1e73ba699 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt @@ -29,20 +29,26 @@ import jakarta.validation.Valid */ data class Pet( - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @get:JsonProperty("category") val category: Category? = null, + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, @Deprecated(message = "") - @get:JsonProperty("status") val status: Pet.Status? = null + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Tag.kt index bee0b3c419dd..4ca008d58be5 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Tag.kt @@ -21,9 +21,11 @@ import jakarta.validation.Valid */ data class Tag( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("name") val name: kotlin.String? = null + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/User.kt index df4b7c3b5883..791a29397fd9 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/User.kt @@ -27,21 +27,29 @@ import jakarta.validation.Valid */ data class User( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("username") val username: kotlin.String? = null, + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @get:JsonProperty("email") val email: kotlin.String? = null, + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @get:JsonProperty("password") val password: kotlin.String? = null, + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Category.kt index 50cfbcf80623..50461806cc42 100644 --- a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Category.kt @@ -21,10 +21,12 @@ import jakarta.validation.Valid */ data class Category( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") - @get:JsonProperty("name") val name: kotlin.String? = null + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 4d12f23ba411..afe1ed2f7fc6 100644 --- a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -22,11 +22,14 @@ import jakarta.validation.Valid */ data class ModelApiResponse( - @get:JsonProperty("code") val code: kotlin.Int? = null, + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @get:JsonProperty("type") val type: kotlin.String? = null, + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @get:JsonProperty("message") val message: kotlin.String? = null + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Order.kt index bee507c64e65..ad144aa25604 100644 --- a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Order.kt @@ -27,17 +27,23 @@ import jakarta.validation.Valid */ data class Order( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @get:JsonProperty("status") val status: Order.Status? = null, + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Pet.kt index af4edaccf4fb..8a56b5a3cfd8 100644 --- a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Pet.kt @@ -29,20 +29,26 @@ import jakarta.validation.Valid */ data class Pet( - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @get:JsonProperty("category") val category: Category? = null, + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, @Deprecated(message = "") - @get:JsonProperty("status") val status: Pet.Status? = null + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) : kotlin.collections.HashMap(), Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Tag.kt index bee0b3c419dd..4ca008d58be5 100644 --- a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/Tag.kt @@ -21,9 +21,11 @@ import jakarta.validation.Valid */ data class Tag( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("name") val name: kotlin.String? = null + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/User.kt index df4b7c3b5883..791a29397fd9 100644 --- a/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-additionalproperties/src/main/kotlin/org/openapitools/model/User.kt @@ -27,21 +27,29 @@ import jakarta.validation.Valid */ data class User( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("username") val username: kotlin.String? = null, + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @get:JsonProperty("email") val email: kotlin.String? = null, + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @get:JsonProperty("password") val password: kotlin.String? = null, + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-bigdecimal-default/src/main/kotlin/org/openapitools/model/Apa.kt b/samples/server/petstore/kotlin-springboot-bigdecimal-default/src/main/kotlin/org/openapitools/model/Apa.kt index 1277bb029783..e2118224ed2e 100644 --- a/samples/server/petstore/kotlin-springboot-bigdecimal-default/src/main/kotlin/org/openapitools/model/Apa.kt +++ b/samples/server/petstore/kotlin-springboot-bigdecimal-default/src/main/kotlin/org/openapitools/model/Apa.kt @@ -26,23 +26,29 @@ import io.swagger.v3.oas.annotations.media.Schema data class Apa( @Schema(example = "null", required = true, description = "") - @get:JsonProperty("bepa", required = true) val bepa: java.math.BigDecimal = java.math.BigDecimal("0"), + @get:JsonProperty("bepa", required = true) + val bepa: java.math.BigDecimal = java.math.BigDecimal("0"), @Schema(example = "null", required = true, description = "") - @get:JsonProperty("cepa", required = true) val cepa: java.math.BigDecimal = java.math.BigDecimal("6.28318"), + @get:JsonProperty("cepa", required = true) + val cepa: java.math.BigDecimal = java.math.BigDecimal("6.28318"), - @Schema(example = "null", description = "") - @get:JsonProperty("depa") val depa: java.math.BigDecimal? = java.math.BigDecimal("71"), + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("depa", required = false) + val depa: java.math.BigDecimal = java.math.BigDecimal("71"), - @Schema(example = "null", description = "") - @get:JsonProperty("epa") val epa: java.math.BigDecimal? = java.math.BigDecimal("-71"), + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("epa", required = false) + val epa: java.math.BigDecimal = java.math.BigDecimal("-71"), - @Schema(example = "null", description = "") + @Schema(example = "null", required = false, description = "") @Deprecated(message = "") - @get:JsonProperty("fepa") val fepa: java.math.BigDecimal? = java.math.BigDecimal("100"), + @get:JsonProperty("fepa", required = false) + val fepa: java.math.BigDecimal? = java.math.BigDecimal("100"), - @Schema(example = "null", description = "") - @get:JsonProperty("gepa") val gepa: java.math.BigDecimal? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("gepa", required = false) + val gepa: java.math.BigDecimal? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Category.kt index fe6df76075ec..5255821b3220 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Category.kt @@ -21,12 +21,14 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Category( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 5c9e5e3de7ff..d59946504d1f 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -22,14 +22,17 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class ModelApiResponse( - @Schema(example = "null", description = "") - @get:JsonProperty("code") val code: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("type") val type: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("message") val message: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt index f6fd42546c7c..b00863937203 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt @@ -27,23 +27,29 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Order( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @Schema(example = "null", description = "Order Status") - @get:JsonProperty("status") val status: Order.Status? = null, + @Schema(example = "null", required = false, description = "Order Status") + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) { /** diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt index a107c48f16be..145e92f5998b 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt @@ -30,25 +30,31 @@ import io.swagger.v3.oas.annotations.media.Schema data class Pet( @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") val category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @Schema(example = "null", description = "pet status in the store") + @Schema(example = "null", required = false, description = "pet status in the store") @Deprecated(message = "") - @get:JsonProperty("status") val status: Pet.Status? = null + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) { /** diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Tag.kt index 73b86b861f5a..c713bfd13709 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Tag.kt @@ -21,11 +21,13 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Tag( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/User.kt index 14ce728a1e49..0d535791edd8 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/User.kt @@ -27,29 +27,37 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class User( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("username") val username: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Category.kt index 4f5e1ae1bcd4..19515fc3afc5 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Category.kt @@ -21,12 +21,14 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Category( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 29636f4bad1e..9458eff01277 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -22,14 +22,17 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class ModelApiResponse( - @Schema(example = "null", description = "") - @get:JsonProperty("code") val code: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("type") val type: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("message") val message: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt index 5225690f54ba..25d76e8905b5 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt @@ -27,23 +27,29 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Order( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @Schema(example = "null", description = "Order Status") - @get:JsonProperty("status") val status: Order.Status? = null, + @Schema(example = "null", required = false, description = "Order Status") + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) { /** diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt index 963d5c056403..d6f2167b6fec 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt @@ -30,25 +30,31 @@ import io.swagger.v3.oas.annotations.media.Schema data class Pet( @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") val category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @Schema(example = "null", description = "pet status in the store") + @Schema(example = "null", required = false, description = "pet status in the store") @Deprecated(message = "") - @get:JsonProperty("status") val status: Pet.Status? = null + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) { /** diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Tag.kt index 179b6d27b5c4..db84f24d4939 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Tag.kt @@ -21,11 +21,13 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Tag( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/User.kt index c51087a6f57e..f24cfd0451e5 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/User.kt @@ -27,29 +27,37 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class User( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("username") val username: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt b/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt index b4c348328e47..77e145efddc4 100644 --- a/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt +++ b/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt @@ -23,10 +23,12 @@ import jakarta.validation.Valid */ data class ApiError( - @get:JsonProperty("errorCode", required = true) val errorCode: ApiError.ErrorCode, + @get:JsonProperty("errorCode", required = true) + val errorCode: ApiError.ErrorCode, @field:Valid - @get:JsonProperty("reasonCode") val reasonCode: ReasonCode? = null + @get:JsonProperty("reasonCode", required = false) + val reasonCode: ReasonCode? = null ) { /** diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt index 5df427d75794..a0a5a91391f9 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt @@ -22,11 +22,13 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Category( - @Schema(example = "null", description = "") - @get:JsonProperty("id") var id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + var id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("name") var name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + var name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index e504e4f5221b..41e4e928f354 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -23,14 +23,17 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class ModelApiResponse( - @Schema(example = "null", description = "") - @get:JsonProperty("code") var code: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("code", required = false) + var code: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("type") var type: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("type", required = false) + var type: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("message") var message: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("message", required = false) + var message: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt index e75d0e40cdcf..a7fc1aaa7294 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt @@ -28,23 +28,29 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Order( - @Schema(example = "null", description = "") - @get:JsonProperty("id") var id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + var id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("petId") var petId: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("petId", required = false) + var petId: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("quantity") var quantity: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("quantity", required = false) + var quantity: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("shipDate") var shipDate: java.time.OffsetDateTime? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("shipDate", required = false) + var shipDate: java.time.OffsetDateTime? = null, - @Schema(example = "null", description = "Order Status") - @get:JsonProperty("status") var status: Order.Status? = null, + @Schema(example = "null", required = false, description = "Order Status") + @get:JsonProperty("status", required = false) + var status: Order.Status? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("complete") var complete: kotlin.Boolean? = false + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("complete", required = false) + var complete: kotlin.Boolean = false ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt index 7f59bf951d8f..f70de712e4e2 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt @@ -31,24 +31,30 @@ import io.swagger.v3.oas.annotations.media.Schema data class Pet( @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) var name: kotlin.String, + @get:JsonProperty("name", required = true) + var name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) var photoUrls: kotlin.collections.MutableList, + @get:JsonProperty("photoUrls", required = true) + var photoUrls: kotlin.collections.MutableList, - @Schema(example = "null", description = "") - @get:JsonProperty("id") var id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + var id: kotlin.Long? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") var category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + var category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") var tags: kotlin.collections.MutableList? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + var tags: kotlin.collections.MutableList? = null, - @Schema(example = "null", description = "pet status in the store") - @get:JsonProperty("status") var status: Pet.Status? = null + @Schema(example = "null", required = false, description = "pet status in the store") + @get:JsonProperty("status", required = false) + var status: Pet.Status? = null ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt index fc7c99144cad..86451032a5d2 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt @@ -22,11 +22,13 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Tag( - @Schema(example = "null", description = "") - @get:JsonProperty("id") var id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + var id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("name") var name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + var name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt index acf3fff184a9..2e363c881eb3 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt @@ -28,29 +28,37 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class User( - @Schema(example = "null", description = "") - @get:JsonProperty("id") var id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + var id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("username") var username: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("username", required = false) + var username: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") var firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + var firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") var lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + var lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") var email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + var email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") var password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + var password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") var phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + var phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") var userStatus: kotlin.Int? = null + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + var userStatus: kotlin.Int? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedRequestMarker.kt b/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedRequestMarker.kt index ec1d852f4e9c..2614a6286100 100644 --- a/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedRequestMarker.kt +++ b/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedRequestMarker.kt @@ -20,8 +20,9 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class MultipartMixedRequestMarker( - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Category.kt index 4f5e1ae1bcd4..19515fc3afc5 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Category.kt @@ -21,12 +21,14 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Category( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 29636f4bad1e..9458eff01277 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -22,14 +22,17 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class ModelApiResponse( - @Schema(example = "null", description = "") - @get:JsonProperty("code") val code: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("type") val type: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("message") val message: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt index 5225690f54ba..25d76e8905b5 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt @@ -27,23 +27,29 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Order( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @Schema(example = "null", description = "Order Status") - @get:JsonProperty("status") val status: Order.Status? = null, + @Schema(example = "null", required = false, description = "Order Status") + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) { /** diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt index 963d5c056403..d6f2167b6fec 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt @@ -30,25 +30,31 @@ import io.swagger.v3.oas.annotations.media.Schema data class Pet( @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") val category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @Schema(example = "null", description = "pet status in the store") + @Schema(example = "null", required = false, description = "pet status in the store") @Deprecated(message = "") - @get:JsonProperty("status") val status: Pet.Status? = null + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) { /** diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Tag.kt index 179b6d27b5c4..db84f24d4939 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Tag.kt @@ -21,11 +21,13 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Tag( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/User.kt index c51087a6f57e..f24cfd0451e5 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/User.kt @@ -27,29 +27,37 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class User( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("username") val username: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt index 4f5e1ae1bcd4..19515fc3afc5 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt @@ -21,12 +21,14 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Category( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 29636f4bad1e..9458eff01277 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -22,14 +22,17 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class ModelApiResponse( - @Schema(example = "null", description = "") - @get:JsonProperty("code") val code: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("type") val type: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("message") val message: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt index 5225690f54ba..25d76e8905b5 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt @@ -27,23 +27,29 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Order( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @Schema(example = "null", description = "Order Status") - @get:JsonProperty("status") val status: Order.Status? = null, + @Schema(example = "null", required = false, description = "Order Status") + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) { /** diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt index 963d5c056403..d6f2167b6fec 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt @@ -30,25 +30,31 @@ import io.swagger.v3.oas.annotations.media.Schema data class Pet( @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") val category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @Schema(example = "null", description = "pet status in the store") + @Schema(example = "null", required = false, description = "pet status in the store") @Deprecated(message = "") - @get:JsonProperty("status") val status: Pet.Status? = null + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) { /** diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt index 179b6d27b5c4..db84f24d4939 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt @@ -21,11 +21,13 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Tag( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt index c51087a6f57e..f24cfd0451e5 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt @@ -27,29 +27,37 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class User( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("username") val username: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Animal.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Animal.kt index c65f0ca8ac6a..707171aceaf9 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Animal.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Animal.kt @@ -33,11 +33,11 @@ import io.swagger.v3.oas.annotations.media.Schema ) interface Animal { - @get:Schema(example = "null", requiredMode = Schema.RequiredMode.REQUIRED, description = "") - val className: kotlin.String + @get:Schema(example = "null", requiredMode = Schema.RequiredMode.REQUIRED, description = "") + val className: kotlin.String - @get:Schema(example = "null", description = "") - val color: kotlin.String? + @get:Schema(example = "null", description = "") + val color: kotlin.String } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Cat.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Cat.kt index 55337a40dfc2..0ac7edeaf202 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Cat.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Cat.kt @@ -22,13 +22,16 @@ import io.swagger.v3.oas.annotations.media.Schema data class Cat( @Schema(example = "null", required = true, description = "") - @get:JsonProperty("className", required = true) override val className: kotlin.String, + @get:JsonProperty("className", required = true) + override val className: kotlin.String, - @Schema(example = "null", description = "") - @get:JsonProperty("declawed") val declawed: kotlin.Boolean? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("declawed", required = false) + val declawed: kotlin.Boolean? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("color") override val color: kotlin.String? = "red" + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("color", required = false) + override val color: kotlin.String = "red" ) : Animal { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Category.kt index a900b0267637..6b1c2041354c 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Category.kt @@ -22,10 +22,12 @@ import io.swagger.v3.oas.annotations.media.Schema data class Category( @Schema(example = "null", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String = "default-name", + @get:JsonProperty("name", required = true) + val name: kotlin.String = "default-name", - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Client.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Client.kt index c235e7f12d12..102a4a315077 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Client.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Client.kt @@ -20,8 +20,9 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Client( - @Schema(example = "null", description = "") - @get:JsonProperty("client") val client: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("client", required = false) + val client: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Dog.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Dog.kt index 62085ab06dfe..da3db8aae7db 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Dog.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Dog.kt @@ -22,13 +22,16 @@ import io.swagger.v3.oas.annotations.media.Schema data class Dog( @Schema(example = "null", required = true, description = "") - @get:JsonProperty("className", required = true) override val className: kotlin.String, + @get:JsonProperty("className", required = true) + override val className: kotlin.String, - @Schema(example = "null", description = "") - @get:JsonProperty("breed") val breed: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("breed", required = false) + val breed: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("color") override val color: kotlin.String? = "red" + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("color", required = false) + override val color: kotlin.String = "red" ) : Animal { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Foo.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Foo.kt index 04e8d84844d6..69eb74467b80 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Foo.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Foo.kt @@ -20,8 +20,9 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Foo( - @Schema(example = "null", description = "") - @get:JsonProperty("bar") val bar: kotlin.String? = "bar" + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("bar", required = false) + val bar: kotlin.String = "bar" ) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/FooGetDefaultResponse.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/FooGetDefaultResponse.kt index 8b422b6fd292..dd72041a662b 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/FooGetDefaultResponse.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/FooGetDefaultResponse.kt @@ -22,8 +22,9 @@ import io.swagger.v3.oas.annotations.media.Schema data class FooGetDefaultResponse( @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("string") val string: Foo? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("string", required = false) + val string: Foo? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index e2594ffae0e1..0b1cee1cc1e2 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -22,14 +22,17 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class ModelApiResponse( - @Schema(example = "null", description = "") - @get:JsonProperty("code") val code: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("type") val type: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("message") val message: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt index 5f4608b1f490..7f00d2ea28b4 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt @@ -27,23 +27,29 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Order( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @Schema(example = "null", description = "Order Status") - @get:JsonProperty("status") val status: Order.Status? = null, + @Schema(example = "null", required = false, description = "Order Status") + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) { /** diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt index 0683dc03dd0f..f624bde123e5 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt @@ -30,24 +30,30 @@ import io.swagger.v3.oas.annotations.media.Schema data class Pet( @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.Set, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.Set, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") val category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @Schema(example = "null", description = "pet status in the store") - @get:JsonProperty("status") val status: Pet.Status? = null + @Schema(example = "null", required = false, description = "pet status in the store") + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) { /** diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Tag.kt index 4a9ea5f1f250..246a551f77fb 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Tag.kt @@ -21,11 +21,13 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Tag( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/User.kt index 8b13675d3db7..3ecdbe4a080f 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/User.kt @@ -27,29 +27,37 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class User( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("username") val username: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Category.kt index 8514f2c8ba00..ecae179b740d 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Category.kt @@ -22,11 +22,13 @@ import io.swagger.annotations.ApiModelProperty */ data class Category( - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 58be39aeacfc..f17743e88076 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -23,14 +23,17 @@ import io.swagger.annotations.ApiModelProperty */ data class ModelApiResponse( - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("code") val code: kotlin.Int? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("type") val type: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("message") val message: kotlin.String? = null + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt index c67dc14ec918..2a4e81a35974 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt @@ -28,23 +28,29 @@ import io.swagger.annotations.ApiModelProperty */ data class Order( - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @ApiModelProperty(example = "null", value = "Order Status") - @get:JsonProperty("status") val status: Order.Status? = null, + @ApiModelProperty(example = "null", required = false, value = "Order Status") + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt index 0303d2d9d3d2..9c5d7f2acf1f 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt @@ -31,24 +31,30 @@ import io.swagger.annotations.ApiModelProperty data class Pet( @ApiModelProperty(example = "doggie", required = true, value = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @ApiModelProperty(example = "null", required = true, value = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("category") val category: Category? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @ApiModelProperty(example = "null", value = "pet status in the store") - @get:JsonProperty("status") val status: Pet.Status? = null + @ApiModelProperty(example = "null", required = false, value = "pet status in the store") + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Tag.kt index d8a5928093c7..4239b7e85c99 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Tag.kt @@ -22,11 +22,13 @@ import io.swagger.annotations.ApiModelProperty */ data class Tag( - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/User.kt index 8d982852e321..f5091f93a1dd 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/User.kt @@ -28,29 +28,37 @@ import io.swagger.annotations.ApiModelProperty */ data class User( - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("username") val username: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @ApiModelProperty(example = "null", required = false, value = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Category.kt index 90635595b377..f7d55fb8716f 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Category.kt @@ -22,11 +22,13 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Category( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 331d9196ed74..2274fc1b80c6 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -23,14 +23,17 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class ModelApiResponse( - @Schema(example = "null", description = "") - @get:JsonProperty("code") val code: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("type") val type: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("message") val message: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt index 3453faf1bae0..059105e8b512 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt @@ -28,23 +28,29 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Order( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @Schema(example = "null", description = "Order Status") - @get:JsonProperty("status") val status: Order.Status? = null, + @Schema(example = "null", required = false, description = "Order Status") + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt index 28a0e7e268f2..27ff7d96e38e 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt @@ -31,24 +31,30 @@ import io.swagger.v3.oas.annotations.media.Schema data class Pet( @Schema(example = "doggie", required = true, description = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @Schema(example = "null", required = true, description = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("category") val category: Category? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @Schema(example = "null", description = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @Schema(example = "null", description = "pet status in the store") - @get:JsonProperty("status") val status: Pet.Status? = null + @Schema(example = "null", required = false, description = "pet status in the store") + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Tag.kt index ef9382e70b56..07a5fb45060e 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Tag.kt @@ -22,11 +22,13 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class Tag( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/User.kt index a88450a17f84..9e486abef9cd 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/User.kt @@ -28,29 +28,37 @@ import io.swagger.v3.oas.annotations.media.Schema */ data class User( - @Schema(example = "null", description = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("username") val username: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @Schema(example = "null", description = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @Schema(example = "null", required = false, description = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @Schema(example = "null", description = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @Schema(example = "null", required = false, description = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Category.kt index 8514f2c8ba00..ecae179b740d 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Category.kt @@ -22,11 +22,13 @@ import io.swagger.annotations.ApiModelProperty */ data class Category( - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 58be39aeacfc..f17743e88076 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -23,14 +23,17 @@ import io.swagger.annotations.ApiModelProperty */ data class ModelApiResponse( - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("code") val code: kotlin.Int? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("type") val type: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("message") val message: kotlin.String? = null + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Order.kt index c67dc14ec918..2a4e81a35974 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Order.kt @@ -28,23 +28,29 @@ import io.swagger.annotations.ApiModelProperty */ data class Order( - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @ApiModelProperty(example = "null", value = "Order Status") - @get:JsonProperty("status") val status: Order.Status? = null, + @ApiModelProperty(example = "null", required = false, value = "Order Status") + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Pet.kt index 0303d2d9d3d2..9c5d7f2acf1f 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Pet.kt @@ -31,24 +31,30 @@ import io.swagger.annotations.ApiModelProperty data class Pet( @ApiModelProperty(example = "doggie", required = true, value = "") - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, @ApiModelProperty(example = "null", required = true, value = "") - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("category") val category: Category? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @ApiModelProperty(example = "null", value = "pet status in the store") - @get:JsonProperty("status") val status: Pet.Status? = null + @ApiModelProperty(example = "null", required = false, value = "pet status in the store") + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Tag.kt index d8a5928093c7..4239b7e85c99 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Tag.kt @@ -22,11 +22,13 @@ import io.swagger.annotations.ApiModelProperty */ data class Tag( - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("name") val name: kotlin.String? = null + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/User.kt index 8d982852e321..f5091f93a1dd 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/User.kt @@ -28,29 +28,37 @@ import io.swagger.annotations.ApiModelProperty */ data class User( - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("id") val id: kotlin.Long? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("username") val username: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("email") val email: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("password") val password: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "") - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @ApiModelProperty(example = "null", required = false, value = "") + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @ApiModelProperty(example = "null", value = "User Status") - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @ApiModelProperty(example = "null", required = false, value = "User Status") + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/FILES index 59aed4399e9f..7a7d42b45a0e 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/FILES @@ -19,5 +19,8 @@ src/main/kotlin/org/openapitools/model/Dog.kt src/main/kotlin/org/openapitools/model/ModelApiResponse.kt src/main/kotlin/org/openapitools/model/Order.kt src/main/kotlin/org/openapitools/model/Pet.kt +src/main/kotlin/org/openapitools/model/SomeEnum.kt +src/main/kotlin/org/openapitools/model/SomeNullableEnumWithNonNullDefault.kt +src/main/kotlin/org/openapitools/model/SomeNullableEnumWithNullDefault.kt src/main/kotlin/org/openapitools/model/Tag.kt src/main/kotlin/org/openapitools/model/User.kt diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/configuration/EnumConverterConfiguration.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/configuration/EnumConverterConfiguration.kt index 20229410386f..24940e362d22 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/configuration/EnumConverterConfiguration.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/configuration/EnumConverterConfiguration.kt @@ -1,6 +1,9 @@ package org.openapitools.configuration import org.openapitools.model.Color +import org.openapitools.model.SomeEnum +import org.openapitools.model.SomeNullableEnumWithNonNullDefault +import org.openapitools.model.SomeNullableEnumWithNullDefault import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -22,5 +25,23 @@ class EnumConverterConfiguration { override fun convert(source: kotlin.String): Color = Color.forValue(source) } } + @Bean(name = ["org.openapitools.configuration.EnumConverterConfiguration.someEnumConverter"]) + fun someEnumConverter(): Converter { + return object: Converter { + override fun convert(source: kotlin.String): SomeEnum = SomeEnum.forValue(source) + } + } + @Bean(name = ["org.openapitools.configuration.EnumConverterConfiguration.someNullableEnumWithNonNullDefaultConverter"]) + fun someNullableEnumWithNonNullDefaultConverter(): Converter { + return object: Converter { + override fun convert(source: kotlin.String): SomeNullableEnumWithNonNullDefault = SomeNullableEnumWithNonNullDefault.forValue(source) + } + } + @Bean(name = ["org.openapitools.configuration.EnumConverterConfiguration.someNullableEnumWithNullDefaultConverter"]) + fun someNullableEnumWithNullDefaultConverter(): Converter { + return object: Converter { + override fun convert(source: kotlin.String): SomeNullableEnumWithNullDefault = SomeNullableEnumWithNullDefault.forValue(source) + } + } } diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Cat.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Cat.kt index 147ed4ff31a4..9fe7eb785037 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Cat.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Cat.kt @@ -8,6 +8,9 @@ import com.fasterxml.jackson.annotation.JsonValue import org.openapitools.model.Category import org.openapitools.model.Color import org.openapitools.model.Pet +import org.openapitools.model.SomeEnum +import org.openapitools.model.SomeNullableEnumWithNonNullDefault +import org.openapitools.model.SomeNullableEnumWithNullDefault import org.openapitools.model.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -27,26 +30,134 @@ import javax.validation.Valid */ data class Cat( - @get:JsonProperty("name", required = true) override val name: kotlin.String, + @get:JsonProperty("name", required = true) + override val name: kotlin.String, - @get:JsonProperty("photoUrls", required = true) override val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + override val photoUrls: kotlin.collections.List, - @get:JsonProperty("petType", required = true) override val petType: kotlin.String, + @get:JsonProperty("petType", required = true) + override val petType: kotlin.String, - @get:JsonProperty("hunts") val hunts: kotlin.Boolean? = null, + @get:JsonProperty("hunts", required = false) + val hunts: kotlin.Boolean? = null, - @get:JsonProperty("age") val age: kotlin.Int? = null, + @get:JsonProperty("age", required = false) + val age: kotlin.Int? = null, - @get:JsonProperty("id") override val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + override val id: kotlin.Long? = null, @field:Valid - @get:JsonProperty("category") override val category: Category? = null, + @get:JsonProperty("category", required = false) + override val category: Category? = null, + + @get:JsonProperty("nonRequiredWithDefaultList", required = false) + override val nonRequiredWithDefaultList: kotlin.collections.List = arrayListOf("just some default string","another default string"), + + @get:JsonProperty("nonRequiredWithDefaultSet", required = false) + override val nonRequiredWithDefaultSet: kotlin.collections.Set = setOf("more strings","look, it's a string!"), + + @get:JsonProperty("nonRequiredWithDefaultString", required = false) + override val nonRequiredWithDefaultString: kotlin.String = "defaultValue", + + @get:JsonProperty("nonRequiredWithDefaultInt", required = false) + override val nonRequiredWithDefaultInt: java.math.BigDecimal = java.math.BigDecimal("15"), + + @get:JsonProperty("nonRequiredWithDefaultLong", required = false) + override val nonRequiredWithDefaultLong: java.math.BigDecimal = java.math.BigDecimal("15"), + + @get:JsonProperty("nonRequiredWithDefaultFloat", required = false) + override val nonRequiredWithDefaultFloat: kotlin.Float = 15.45f, + + @get:JsonProperty("nonRequiredWithDefaultDouble", required = false) + override val nonRequiredWithDefaultDouble: kotlin.Double = 15.45, + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultEnum", required = false) + override val nonRequiredWithDefaultEnum: SomeEnum = SomeEnum.ENUMVALUE1, + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultEnumList", required = false) + override val nonRequiredWithDefaultEnumList: kotlin.collections.List = arrayListOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1), + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultEnumSet", required = false) + override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1), + + @get:JsonProperty("nonRequiredNullableWithDefaultNullList", required = false) + override val nonRequiredNullableWithDefaultNullList: kotlin.collections.List? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullSet", required = false) + override val nonRequiredNullableWithDefaultNullSet: kotlin.collections.Set? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullString", required = false) + override val nonRequiredNullableWithDefaultNullString: kotlin.String? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullInt", required = false) + override val nonRequiredNullableWithDefaultNullInt: java.math.BigDecimal? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullLong", required = false) + override val nonRequiredNullableWithDefaultNullLong: java.math.BigDecimal? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullFloat", required = false) + override val nonRequiredNullableWithDefaultNullFloat: kotlin.Float? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullDouble", required = false) + override val nonRequiredNullableWithDefaultNullDouble: kotlin.Double? = null, + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNullEnum", required = false) + override val nonRequiredNullableWithDefaultNullEnum: SomeNullableEnumWithNullDefault? = null, + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNullEnumList", required = false) + override val nonRequiredNullableWithDefaultNullEnumList: kotlin.collections.List? = null, + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNullEnumSet", required = false) + override val nonRequiredNullableWithDefaultNullEnumSet: kotlin.collections.Set? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullList", required = false) + override val nonRequiredNullableWithDefaultNonNullList: kotlin.collections.List? = arrayListOf("some string","another string"), + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullSet", required = false) + override val nonRequiredNullableWithDefaultNonNullSet: kotlin.collections.Set? = setOf("some string","another string"), + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullString", required = false) + override val nonRequiredNullableWithDefaultNonNullString: kotlin.String? = "some string", + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullInt", required = false) + override val nonRequiredNullableWithDefaultNonNullInt: java.math.BigDecimal? = java.math.BigDecimal("42"), + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullLong", required = false) + override val nonRequiredNullableWithDefaultNonNullLong: java.math.BigDecimal? = java.math.BigDecimal("42"), + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullFloat", required = false) + override val nonRequiredNullableWithDefaultNonNullFloat: kotlin.Float? = 15.45f, + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullDouble", required = false) + override val nonRequiredNullableWithDefaultNonNullDouble: kotlin.Double? = 15.45, + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullEnum", required = false) + override val nonRequiredNullableWithDefaultNonNullEnum: SomeNullableEnumWithNonNullDefault? = SomeNullableEnumWithNonNullDefault.ENUMVALUE1, + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullEnumList", required = false) + override val nonRequiredNullableWithDefaultNonNullEnumList: kotlin.collections.List? = arrayListOf(SomeEnum.ENUMVALUE1), + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullEnumSet", required = false) + override val nonRequiredNullableWithDefaultNonNullEnumSet: kotlin.collections.Set? = setOf(SomeEnum.ENUMVALUE1), @field:Valid - @get:JsonProperty("tags") override val tags: kotlin.collections.List? = null, + @get:JsonProperty("tags", required = false) + override val tags: kotlin.collections.List? = null, @field:Valid - @get:JsonProperty("color") override val color: Color? = null + @get:JsonProperty("color", required = false) + override val color: Color? = null ) : Pet, Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Category.kt index f98ea616ec26..c076a6f856cb 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Category.kt @@ -21,9 +21,11 @@ import javax.validation.Valid */ data class Category( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("name") val name: kotlin.String? = null + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt index 789cb452e748..5aee0aaf17ea 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt @@ -8,6 +8,9 @@ import com.fasterxml.jackson.annotation.JsonValue import org.openapitools.model.Category import org.openapitools.model.Color import org.openapitools.model.Pet +import org.openapitools.model.SomeEnum +import org.openapitools.model.SomeNullableEnumWithNonNullDefault +import org.openapitools.model.SomeNullableEnumWithNullDefault import org.openapitools.model.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -28,28 +31,137 @@ import javax.validation.Valid */ data class Dog( - @get:JsonProperty("bark", required = true) val bark: kotlin.Boolean, + @get:JsonProperty("bark", required = true) + val bark: kotlin.Boolean, - @get:JsonProperty("breed", required = true) val breed: Dog.Breed, + @get:JsonProperty("breed", required = true) + val breed: Dog.Breed, - @get:JsonProperty("likesFetch", required = true) override val likesFetch: kotlin.Boolean, + @get:JsonProperty("likesFetch", required = true) + override val likesFetch: kotlin.Boolean, - @get:JsonProperty("name", required = true) override val name: kotlin.String, + @get:JsonProperty("name", required = true) + override val name: kotlin.String, - @get:JsonProperty("photoUrls", required = true) override val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + override val photoUrls: kotlin.collections.List, - @get:JsonProperty("petType", required = true) override val petType: kotlin.String, + @get:JsonProperty("petType", required = true) + override val petType: kotlin.String, - @get:JsonProperty("id") override val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + override val id: kotlin.Long? = null, @field:Valid - @get:JsonProperty("category") override val category: Category? = null, + @get:JsonProperty("category", required = false) + override val category: Category? = null, + + @get:JsonProperty("nonRequiredWithDefaultList", required = false) + override val nonRequiredWithDefaultList: kotlin.collections.List = arrayListOf("just some default string","another default string"), + + @get:JsonProperty("nonRequiredWithDefaultSet", required = false) + override val nonRequiredWithDefaultSet: kotlin.collections.Set = setOf("more strings","look, it's a string!"), + + @get:JsonProperty("nonRequiredWithDefaultString", required = false) + override val nonRequiredWithDefaultString: kotlin.String = "defaultValue", + + @get:JsonProperty("nonRequiredWithDefaultInt", required = false) + override val nonRequiredWithDefaultInt: java.math.BigDecimal = java.math.BigDecimal("15"), + + @get:JsonProperty("nonRequiredWithDefaultLong", required = false) + override val nonRequiredWithDefaultLong: java.math.BigDecimal = java.math.BigDecimal("15"), + + @get:JsonProperty("nonRequiredWithDefaultFloat", required = false) + override val nonRequiredWithDefaultFloat: kotlin.Float = 15.45f, + + @get:JsonProperty("nonRequiredWithDefaultDouble", required = false) + override val nonRequiredWithDefaultDouble: kotlin.Double = 15.45, + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultEnum", required = false) + override val nonRequiredWithDefaultEnum: SomeEnum = SomeEnum.ENUMVALUE1, + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultEnumList", required = false) + override val nonRequiredWithDefaultEnumList: kotlin.collections.List = arrayListOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1), + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultEnumSet", required = false) + override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1), + + @get:JsonProperty("nonRequiredNullableWithDefaultNullList", required = false) + override val nonRequiredNullableWithDefaultNullList: kotlin.collections.List? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullSet", required = false) + override val nonRequiredNullableWithDefaultNullSet: kotlin.collections.Set? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullString", required = false) + override val nonRequiredNullableWithDefaultNullString: kotlin.String? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullInt", required = false) + override val nonRequiredNullableWithDefaultNullInt: java.math.BigDecimal? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullLong", required = false) + override val nonRequiredNullableWithDefaultNullLong: java.math.BigDecimal? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullFloat", required = false) + override val nonRequiredNullableWithDefaultNullFloat: kotlin.Float? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNullDouble", required = false) + override val nonRequiredNullableWithDefaultNullDouble: kotlin.Double? = null, + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNullEnum", required = false) + override val nonRequiredNullableWithDefaultNullEnum: SomeNullableEnumWithNullDefault? = null, + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNullEnumList", required = false) + override val nonRequiredNullableWithDefaultNullEnumList: kotlin.collections.List? = null, + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNullEnumSet", required = false) + override val nonRequiredNullableWithDefaultNullEnumSet: kotlin.collections.Set? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullList", required = false) + override val nonRequiredNullableWithDefaultNonNullList: kotlin.collections.List? = arrayListOf("some string","another string"), + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullSet", required = false) + override val nonRequiredNullableWithDefaultNonNullSet: kotlin.collections.Set? = setOf("some string","another string"), + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullString", required = false) + override val nonRequiredNullableWithDefaultNonNullString: kotlin.String? = "some string", + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullInt", required = false) + override val nonRequiredNullableWithDefaultNonNullInt: java.math.BigDecimal? = java.math.BigDecimal("42"), + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullLong", required = false) + override val nonRequiredNullableWithDefaultNonNullLong: java.math.BigDecimal? = java.math.BigDecimal("42"), + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullFloat", required = false) + override val nonRequiredNullableWithDefaultNonNullFloat: kotlin.Float? = 15.45f, + + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullDouble", required = false) + override val nonRequiredNullableWithDefaultNonNullDouble: kotlin.Double? = 15.45, + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullEnum", required = false) + override val nonRequiredNullableWithDefaultNonNullEnum: SomeNullableEnumWithNonNullDefault? = SomeNullableEnumWithNonNullDefault.ENUMVALUE1, + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullEnumList", required = false) + override val nonRequiredNullableWithDefaultNonNullEnumList: kotlin.collections.List? = arrayListOf(SomeEnum.ENUMVALUE1), + + @field:Valid + @get:JsonProperty("nonRequiredNullableWithDefaultNonNullEnumSet", required = false) + override val nonRequiredNullableWithDefaultNonNullEnumSet: kotlin.collections.Set? = setOf(SomeEnum.ENUMVALUE1), @field:Valid - @get:JsonProperty("tags") override val tags: kotlin.collections.List? = null, + @get:JsonProperty("tags", required = false) + override val tags: kotlin.collections.List? = null, @field:Valid - @get:JsonProperty("color") override val color: Color? = null + @get:JsonProperty("color", required = false) + override val color: Color? = null ) : Pet, Serializable, com.some.pack.Fetchable { /** diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index d5f1bfed6348..f14c5f0b81b1 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -22,11 +22,14 @@ import javax.validation.Valid */ data class ModelApiResponse( - @get:JsonProperty("code") val code: kotlin.Int? = null, + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @get:JsonProperty("type") val type: kotlin.String? = null, + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @get:JsonProperty("message") val message: kotlin.String? = null + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Order.kt index b9cf389785aa..4d91be4b0d41 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Order.kt @@ -27,17 +27,23 @@ import javax.validation.Valid */ data class Order( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @get:JsonProperty("status") val status: Order.Status? = null, + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Pet.kt index a3dbd5258a11..3674b918d776 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Pet.kt @@ -10,6 +10,9 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo import com.fasterxml.jackson.annotation.JsonValue import org.openapitools.model.Category import org.openapitools.model.Color +import org.openapitools.model.SomeEnum +import org.openapitools.model.SomeNullableEnumWithNonNullDefault +import org.openapitools.model.SomeNullableEnumWithNullDefault import org.openapitools.model.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -29,6 +32,36 @@ import javax.validation.Valid * @param petType * @param id * @param category + * @param nonRequiredWithDefaultList + * @param nonRequiredWithDefaultSet + * @param nonRequiredWithDefaultString + * @param nonRequiredWithDefaultInt + * @param nonRequiredWithDefaultLong + * @param nonRequiredWithDefaultFloat + * @param nonRequiredWithDefaultDouble + * @param nonRequiredWithDefaultEnum + * @param nonRequiredWithDefaultEnumList + * @param nonRequiredWithDefaultEnumSet + * @param nonRequiredNullableWithDefaultNullList + * @param nonRequiredNullableWithDefaultNullSet + * @param nonRequiredNullableWithDefaultNullString + * @param nonRequiredNullableWithDefaultNullInt + * @param nonRequiredNullableWithDefaultNullLong + * @param nonRequiredNullableWithDefaultNullFloat + * @param nonRequiredNullableWithDefaultNullDouble + * @param nonRequiredNullableWithDefaultNullEnum + * @param nonRequiredNullableWithDefaultNullEnumList + * @param nonRequiredNullableWithDefaultNullEnumSet + * @param nonRequiredNullableWithDefaultNonNullList + * @param nonRequiredNullableWithDefaultNonNullSet + * @param nonRequiredNullableWithDefaultNonNullString + * @param nonRequiredNullableWithDefaultNonNullInt + * @param nonRequiredNullableWithDefaultNonNullLong + * @param nonRequiredNullableWithDefaultNonNullFloat + * @param nonRequiredNullableWithDefaultNonNullDouble + * @param nonRequiredNullableWithDefaultNonNullEnum + * @param nonRequiredNullableWithDefaultNonNullEnumList + * @param nonRequiredNullableWithDefaultNonNullEnumSet * @param tags * @param color */ @@ -43,26 +76,116 @@ import javax.validation.Valid ) interface Pet : Serializable, com.some.pack.Named, com.some.pack.WithCategory, com.some.pack.WithDefaultMethods { - - override val name: kotlin.String - - val photoUrls: kotlin.collections.List + override val name: kotlin.String - - val petType: kotlin.String - - val id: kotlin.Long? + val photoUrls: kotlin.collections.List - - override val category: Category? - - val tags: kotlin.collections.List? + val petType: kotlin.String - - val color: Color? + + val id: kotlin.Long? + + + override val category: Category? + + + val nonRequiredWithDefaultList: kotlin.collections.List + + + val nonRequiredWithDefaultSet: kotlin.collections.Set + + + val nonRequiredWithDefaultString: kotlin.String + + + val nonRequiredWithDefaultInt: java.math.BigDecimal + + + val nonRequiredWithDefaultLong: java.math.BigDecimal + + + val nonRequiredWithDefaultFloat: kotlin.Float + + + val nonRequiredWithDefaultDouble: kotlin.Double + + + val nonRequiredWithDefaultEnum: SomeEnum + + + val nonRequiredWithDefaultEnumList: kotlin.collections.List + + + val nonRequiredWithDefaultEnumSet: kotlin.collections.Set + + + val nonRequiredNullableWithDefaultNullList: kotlin.collections.List? + + + val nonRequiredNullableWithDefaultNullSet: kotlin.collections.Set? + + + val nonRequiredNullableWithDefaultNullString: kotlin.String? + + + val nonRequiredNullableWithDefaultNullInt: java.math.BigDecimal? + + + val nonRequiredNullableWithDefaultNullLong: java.math.BigDecimal? + + + val nonRequiredNullableWithDefaultNullFloat: kotlin.Float? + + + val nonRequiredNullableWithDefaultNullDouble: kotlin.Double? + + + val nonRequiredNullableWithDefaultNullEnum: SomeNullableEnumWithNullDefault? + + + val nonRequiredNullableWithDefaultNullEnumList: kotlin.collections.List? + + + val nonRequiredNullableWithDefaultNullEnumSet: kotlin.collections.Set? + + + val nonRequiredNullableWithDefaultNonNullList: kotlin.collections.List? + + + val nonRequiredNullableWithDefaultNonNullSet: kotlin.collections.Set? + + + val nonRequiredNullableWithDefaultNonNullString: kotlin.String? + + + val nonRequiredNullableWithDefaultNonNullInt: java.math.BigDecimal? + + + val nonRequiredNullableWithDefaultNonNullLong: java.math.BigDecimal? + + + val nonRequiredNullableWithDefaultNonNullFloat: kotlin.Float? + + + val nonRequiredNullableWithDefaultNonNullDouble: kotlin.Double? + + + val nonRequiredNullableWithDefaultNonNullEnum: SomeNullableEnumWithNonNullDefault? + + + val nonRequiredNullableWithDefaultNonNullEnumList: kotlin.collections.List? + + + val nonRequiredNullableWithDefaultNonNullEnumSet: kotlin.collections.Set? + + + val tags: kotlin.collections.List? + + + val color: Color? companion object { diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeEnum.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeEnum.kt new file mode 100644 index 000000000000..b6efb62c64fd --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeEnum.kt @@ -0,0 +1,38 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonValue +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** +* +* Values: ENUMVALUE1,ENUMVALUE2,ENUMVALUE3 +*/ +enum class SomeEnum(@get:JsonValue val value: kotlin.String) { + + ENUMVALUE1("ENUMVALUE1"), + ENUMVALUE2("ENUMVALUE2"), + ENUMVALUE3("ENUMVALUE3"); + + companion object { + @JvmStatic + @JsonCreator + fun forValue(value: kotlin.String): SomeEnum { + return values().firstOrNull{it -> it.value == value} + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'SomeEnum'") + } + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnum.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnum.kt new file mode 100644 index 000000000000..9a6a086a8f46 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnum.kt @@ -0,0 +1,38 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonValue +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** +* +* Values: ENUMVALUE1,ENUMVALUE2,ENUMVALUE3 +*/ +enum class SomeNullableEnum(@get:JsonValue val value: kotlin.String) { + + ENUMVALUE1("ENUMVALUE1"), + ENUMVALUE2("ENUMVALUE2"), + ENUMVALUE3("ENUMVALUE3"); + + companion object { + @JvmStatic + @JsonCreator + fun forValue(value: kotlin.String): SomeNullableEnum { + return values().firstOrNull{it -> it.value == value} + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'SomeNullableEnum'") + } + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnumWithNonNullDefault.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnumWithNonNullDefault.kt new file mode 100644 index 000000000000..22d247f6343a --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnumWithNonNullDefault.kt @@ -0,0 +1,38 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonValue +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** +* +* Values: ENUMVALUE1,ENUMVALUE2,ENUMVALUE3 +*/ +enum class SomeNullableEnumWithNonNullDefault(@get:JsonValue val value: kotlin.String) { + + ENUMVALUE1("ENUMVALUE1"), + ENUMVALUE2("ENUMVALUE2"), + ENUMVALUE3("ENUMVALUE3"); + + companion object { + @JvmStatic + @JsonCreator + fun forValue(value: kotlin.String): SomeNullableEnumWithNonNullDefault { + return values().firstOrNull{it -> it.value == value} + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'SomeNullableEnumWithNonNullDefault'") + } + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnumWithNullDefault.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnumWithNullDefault.kt new file mode 100644 index 000000000000..fcdb4ca33b68 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnumWithNullDefault.kt @@ -0,0 +1,38 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonValue +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** +* +* Values: ENUMVALUE1,ENUMVALUE2,ENUMVALUE3 +*/ +enum class SomeNullableEnumWithNullDefault(@get:JsonValue val value: kotlin.String) { + + ENUMVALUE1("ENUMVALUE1"), + ENUMVALUE2("ENUMVALUE2"), + ENUMVALUE3("ENUMVALUE3"); + + companion object { + @JvmStatic + @JsonCreator + fun forValue(value: kotlin.String): SomeNullableEnumWithNullDefault { + return values().firstOrNull{it -> it.value == value} + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'SomeNullableEnumWithNullDefault'") + } + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Tag.kt index cce8583e6d59..e32ece55d262 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Tag.kt @@ -21,9 +21,11 @@ import javax.validation.Valid */ data class Tag( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("name") val name: kotlin.String? = null + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/User.kt index f24ba91ffb73..e653e65a48ee 100644 --- a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/User.kt @@ -27,21 +27,29 @@ import javax.validation.Valid */ data class User( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("username") val username: kotlin.String? = null, + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @get:JsonProperty("email") val email: kotlin.String? = null, + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @get:JsonProperty("password") val password: kotlin.String? = null, + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt index 0638b1718f3d..8f92649a83bc 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt @@ -21,9 +21,11 @@ import javax.validation.Valid */ data class Category( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("name") val name: kotlin.String? = null + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index f520047d850d..43c9b8f30f1b 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -22,11 +22,14 @@ import javax.validation.Valid */ data class ModelApiResponse( - @get:JsonProperty("code") val code: kotlin.Int? = null, + @get:JsonProperty("code", required = false) + val code: kotlin.Int? = null, - @get:JsonProperty("type") val type: kotlin.String? = null, + @get:JsonProperty("type", required = false) + val type: kotlin.String? = null, - @get:JsonProperty("message") val message: kotlin.String? = null + @get:JsonProperty("message", required = false) + val message: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt index 4ebe51e765ed..7aec2196ea67 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt @@ -27,17 +27,23 @@ import javax.validation.Valid */ data class Order( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("petId") val petId: kotlin.Long? = null, + @get:JsonProperty("petId", required = false) + val petId: kotlin.Long? = null, - @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + @get:JsonProperty("quantity", required = false) + val quantity: kotlin.Int? = null, - @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + @get:JsonProperty("shipDate", required = false) + val shipDate: java.time.OffsetDateTime? = null, - @get:JsonProperty("status") val status: Order.Status? = null, + @get:JsonProperty("status", required = false) + val status: Order.Status? = null, - @get:JsonProperty("complete") val complete: kotlin.Boolean? = false + @get:JsonProperty("complete", required = false) + val complete: kotlin.Boolean = false ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt index cf9ccf2f4f7d..3336d045fdef 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt @@ -29,19 +29,25 @@ import javax.validation.Valid */ data class Pet( - @get:JsonProperty("name", required = true) val name: kotlin.String, + @get:JsonProperty("name", required = true) + val name: kotlin.String, - @get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, + @get:JsonProperty("photoUrls", required = true) + val photoUrls: kotlin.collections.List, - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, @field:Valid - @get:JsonProperty("category") val category: Category? = null, + @get:JsonProperty("category", required = false) + val category: Category? = null, @field:Valid - @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, + @get:JsonProperty("tags", required = false) + val tags: kotlin.collections.List? = null, - @get:JsonProperty("status") val status: Pet.Status? = null + @get:JsonProperty("status", required = false) + val status: Pet.Status? = null ) : Serializable { /** diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt index 36f841600047..3393d7d4b6e6 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt @@ -21,9 +21,11 @@ import javax.validation.Valid */ data class Tag( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("name") val name: kotlin.String? = null + @get:JsonProperty("name", required = false) + val name: kotlin.String? = null ) : Serializable { companion object { diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt index b04c9e312592..65a7ce5299f4 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt @@ -27,21 +27,29 @@ import javax.validation.Valid */ data class User( - @get:JsonProperty("id") val id: kotlin.Long? = null, + @get:JsonProperty("id", required = false) + val id: kotlin.Long? = null, - @get:JsonProperty("username") val username: kotlin.String? = null, + @get:JsonProperty("username", required = false) + val username: kotlin.String? = null, - @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + @get:JsonProperty("firstName", required = false) + val firstName: kotlin.String? = null, - @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + @get:JsonProperty("lastName", required = false) + val lastName: kotlin.String? = null, - @get:JsonProperty("email") val email: kotlin.String? = null, + @get:JsonProperty("email", required = false) + val email: kotlin.String? = null, - @get:JsonProperty("password") val password: kotlin.String? = null, + @get:JsonProperty("password", required = false) + val password: kotlin.String? = null, - @get:JsonProperty("phone") val phone: kotlin.String? = null, + @get:JsonProperty("phone", required = false) + val phone: kotlin.String? = null, - @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null + @get:JsonProperty("userStatus", required = false) + val userStatus: kotlin.Int? = null ) : Serializable { companion object {