From 574db8c6d92fc99f05172f3ab776eaa1c3de38a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 30 Oct 2025 22:23:29 +0100 Subject: [PATCH 01/12] attempts to make non required with default non-nullable --- .../kotlin-spring/dataClass.mustache | 12 ++-- .../kotlin-spring/dataClassOptVar.mustache | 30 ++++++++-- .../kotlin-spring/dataClassReqVar.mustache | 27 +++++++-- .../kotlin-spring/interfaceOptVar.mustache | 24 ++++++-- .../kotlin-spring/interfaceReqVar.mustache | 22 ++++++-- .../petstore-with-x-kotlin-implements.yaml | 56 +++++++++++++++++++ 6 files changed, 146 insertions(+), 25 deletions(-) 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..1fa593438ce0 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}} = {{! + }}{{^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..f7840df11104 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,22 @@ -{{#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..62e7182d7ac9 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,21 @@ +{{! 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}}{{! +}}{{^defaultValue}}?{{/defaultValue}}{{! +}}{{^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/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..8c507f908847 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,62 @@ components: $ref: '#/components/schemas/Category' name: type: string + nonRequiredWithDefaultList: + type: array + required: false + default: [ ] + nonRequiredWithDefaultSet: + type: array + uniqueItems: true + required: false + default: [ ] + nonRequiredWithDefaultString: + type: string + required: false + default: defaultValue + nonRequiredWithDefaultInt: + type: number + format: int32 + required: false + default: 15 + nonRequiredWithDefaultLong: + type: number + format: int64 + required: false + default: 15 + nonRequiredWithDefaultFloat: + type: number + format: float + required: false + default: 15.45 + requiredWithDefaultList: + type: array + required: true + default: [ ] + requiredWithDefaultSet: + type: array + uniqueItems: true + required: true + default: [ ] + requiredWithDefaultString: + type: string + required: true + default: defaultValue + requiredWithDefaultInt: + type: number + format: int32 + required: true + default: 15 + requiredWithDefaultLong: + type: number + format: int64 + required: true + default: 15 + requiredWithDefaultFloat: + type: number + format: float + required: true + default: 15.45 photoUrls: type: array items: From 299cc80f1b199d8061e5e69e15e07929738f57eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 30 Oct 2025 22:31:46 +0100 Subject: [PATCH 02/12] add more complex cases to the open api definition --- .../petstore-with-x-kotlin-implements.yaml | 53 +++++++++---------- 1 file changed, 24 insertions(+), 29 deletions(-) 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 8c507f908847..7af0b785f0e7 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 @@ -546,39 +546,34 @@ components: format: int64 required: false default: 15 - nonRequiredWithDefaultFloat: - type: number - format: float + nonRequiredWithDefaultEnum: + type: string + enum: + - THIS + - THAT required: false - default: 15.45 - requiredWithDefaultList: + default: THIS + nonRequiredWithDefaultEnumList: type: array - required: true - default: [ ] - requiredWithDefaultSet: + items: + type: string + enum: + - THESE + - THOSE + - THEM + required: false + default: [THESE, THOSE] + nonRequiredWithDefaultEnumSet: type: array uniqueItems: true - required: true - default: [ ] - requiredWithDefaultString: - type: string - required: true - default: defaultValue - requiredWithDefaultInt: - type: number - format: int32 - required: true - default: 15 - requiredWithDefaultLong: - type: number - format: int64 - required: true - default: 15 - requiredWithDefaultFloat: - type: number - format: float - required: true - default: 15.45 + items: + type: string + enum: + - THESE + - THOSE + - THEM + required: false + default: [THEM, THOSE] photoUrls: type: array items: From 421b4389c4ce9ad04e7eb73059fccfe805b32ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Fri, 31 Oct 2025 00:12:41 +0100 Subject: [PATCH 03/12] add java unit test --- .../spring/KotlinSpringServerCodegenTest.java | 67 +++++++++++++++++++ .../petstore-with-x-kotlin-implements.yaml | 14 +++- 2 files changed, 79 insertions(+), 2 deletions(-) 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..2d769be8160e 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,73 @@ 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, + "@get:JsonProperty(\"category\", required = false)", + "override val category: Category? = null", // without default (fallback) value is nullable + "@get:JsonProperty(\"nonRequiredWithDefaultList\", required = false)", + "override val nonRequiredWithDefaultList: kotlin.collections.List = arrayListOf()", // elsewhere with default (fallback) value is not nullable + "@get:JsonProperty(\"nonRequiredWithDefaultSet\", required = false)", + "override val nonRequiredWithDefaultSet: kotlin.collections.Set = setOf()", + "@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: Dog.NonRequiredWithDefaultEnum = NonRequiredWithDefaultEnum.THIS", + "@get:JsonProperty(\"nonRequiredWithDefaultEnumList\", required = false)", + "override val nonRequiredWithDefaultEnumList: kotlin.collections.List = arrayListOf(NonRequiredWithDefaultEnumList.THESE,NonRequiredWithDefaultEnumList.THOSE)", + "@get:JsonProperty(\"nonRequiredWithDefaultEnumSet\", required = false)", + "override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(NonRequiredWithDefaultEnumSet.THEM,NonRequiredWithDefaultEnumSet.THOSE)" + ); + + Path petPath = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Pet.kt"); + assertFileContains( + petPath, + "override val category: Category?", // without default (fallback) value is nullable + "val nonRequiredWithDefaultList: kotlin.collections.List", // elsewhere with default (fallback) value is not nullable + "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: Pet.NonRequiredWithDefaultEnum", + "val nonRequiredWithDefaultEnumList: Pet.NonRequiredWithDefaultEnumList", + "val nonRequiredWithDefaultEnumSet: Pet.NonRequiredWithDefaultEnumSet" + ); + } + @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 7af0b785f0e7..f6ad7b8786f9 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 @@ -546,6 +546,16 @@ components: format: int64 required: false default: 15 + nonRequiredWithDefaultFloat: + type: number + format: float + required: false + default: 15.45 + nonRequiredWithDefaultDouble: + type: number + format: double + required: false + default: 15.45 nonRequiredWithDefaultEnum: type: string enum: @@ -562,7 +572,7 @@ components: - THOSE - THEM required: false - default: [THESE, THOSE] + default: [ THESE, THOSE ] nonRequiredWithDefaultEnumSet: type: array uniqueItems: true @@ -573,7 +583,7 @@ components: - THOSE - THEM required: false - default: [THEM, THOSE] + default: [ THEM, THOSE ] photoUrls: type: array items: From 5d00c834458d3963b8579412b0e84c15af5947a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Fri, 31 Oct 2025 00:31:33 +0100 Subject: [PATCH 04/12] fix dataClass attribute formatting --- .../main/resources/kotlin-spring/dataClassOptVar.mustache | 6 +++--- .../main/resources/kotlin-spring/dataClassReqVar.mustache | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) 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 1fa593438ce0..7366b4aaeea7 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache @@ -12,9 +12,9 @@ }}{{#vendorExtensions.x-field-extra-annotation}} {{{.}}}{{! }}{{/vendorExtensions.x-field-extra-annotation}} - @get:JsonProperty("{{{baseName}}}", required = false){{! -}}{{#isInherited}} - override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{! + @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}}{{! 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 f7840df11104..9f38710d55d1 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache @@ -9,10 +9,9 @@ }}{{#vendorExtensions.x-field-extra-annotation}} {{{.}}}{{! }}{{/vendorExtensions.x-field-extra-annotation}} - @get:JsonProperty("{{{baseName}}}", required = true){{! -}}{{#isInherited}} - override {{! -}}{{/isInherited}}{{>modelMutable}} {{{name}}}: {{! + @get:JsonProperty("{{{baseName}}}", required = true) + {{#isInherited}}{{! +}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{! }}{{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInPascalCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{! }}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{! }}{{#isNullable}}?{{/isNullable}}{{! From e837d3e20c6dc9c468f54133a620d2650a2fda15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Fri, 31 Oct 2025 00:33:57 +0100 Subject: [PATCH 05/12] add updated files --- .../petstore-with-x-kotlin-implements.yaml | 14 +- .../kotlin/org/openapitools/model/Category.kt | 6 +- .../openapitools/model/ModelApiResponse.kt | 9 +- .../kotlin/org/openapitools/model/Order.kt | 18 ++- .../main/kotlin/org/openapitools/model/Pet.kt | 18 ++- .../main/kotlin/org/openapitools/model/Tag.kt | 6 +- .../kotlin/org/openapitools/model/User.kt | 24 ++-- .../org/openapitools/model/Annotation.kt | 5 +- .../org/openapitools/model/AnyOfUserOrPet.kt | 59 ++++---- .../model/AnyOfUserOrPetOrArrayString.kt | 59 ++++---- .../kotlin/org/openapitools/model/Category.kt | 10 +- .../openapitools/model/ModelApiResponse.kt | 15 ++- .../kotlin/org/openapitools/model/Order.kt | 30 +++-- .../main/kotlin/org/openapitools/model/Pet.kt | 26 ++-- .../main/kotlin/org/openapitools/model/Tag.kt | 10 +- .../kotlin/org/openapitools/model/User.kt | 38 +++--- .../org/openapitools/model/UserOrPet.kt | 59 ++++---- .../model/UserOrPetOrArrayString.kt | 59 ++++---- .../kotlin/org/openapitools/model/Category.kt | 6 +- .../openapitools/model/ModelApiResponse.kt | 9 +- .../kotlin/org/openapitools/model/Order.kt | 18 ++- .../main/kotlin/org/openapitools/model/Pet.kt | 18 ++- .../main/kotlin/org/openapitools/model/Tag.kt | 6 +- .../kotlin/org/openapitools/model/User.kt | 24 ++-- .../kotlin/org/openapitools/model/Category.kt | 6 +- .../openapitools/model/ModelApiResponse.kt | 9 +- .../kotlin/org/openapitools/model/Order.kt | 18 ++- .../main/kotlin/org/openapitools/model/Pet.kt | 18 ++- .../main/kotlin/org/openapitools/model/Tag.kt | 6 +- .../kotlin/org/openapitools/model/User.kt | 24 ++-- .../main/kotlin/org/openapitools/model/Apa.kt | 26 ++-- .../kotlin/org/openapitools/model/Category.kt | 10 +- .../openapitools/model/ModelApiResponse.kt | 15 ++- .../kotlin/org/openapitools/model/Order.kt | 30 +++-- .../main/kotlin/org/openapitools/model/Pet.kt | 26 ++-- .../main/kotlin/org/openapitools/model/Tag.kt | 10 +- .../kotlin/org/openapitools/model/User.kt | 40 +++--- .../kotlin/org/openapitools/model/Category.kt | 10 +- .../openapitools/model/ModelApiResponse.kt | 15 ++- .../kotlin/org/openapitools/model/Order.kt | 30 +++-- .../main/kotlin/org/openapitools/model/Pet.kt | 26 ++-- .../main/kotlin/org/openapitools/model/Tag.kt | 10 +- .../kotlin/org/openapitools/model/User.kt | 40 +++--- .../kotlin/org/openapitools/model/ApiError.kt | 6 +- .../kotlin/org/openapitools/model/Category.kt | 10 +- .../openapitools/model/ModelApiResponse.kt | 15 ++- .../kotlin/org/openapitools/model/Order.kt | 30 +++-- .../main/kotlin/org/openapitools/model/Pet.kt | 26 ++-- .../main/kotlin/org/openapitools/model/Tag.kt | 10 +- .../kotlin/org/openapitools/model/User.kt | 40 +++--- .../model/MultipartMixedRequestMarker.kt | 5 +- .../kotlin/org/openapitools/model/Category.kt | 10 +- .../openapitools/model/ModelApiResponse.kt | 15 ++- .../kotlin/org/openapitools/model/Order.kt | 30 +++-- .../main/kotlin/org/openapitools/model/Pet.kt | 26 ++-- .../main/kotlin/org/openapitools/model/Tag.kt | 10 +- .../kotlin/org/openapitools/model/User.kt | 40 +++--- .../kotlin/org/openapitools/model/Category.kt | 10 +- .../openapitools/model/ModelApiResponse.kt | 15 ++- .../kotlin/org/openapitools/model/Order.kt | 30 +++-- .../main/kotlin/org/openapitools/model/Pet.kt | 26 ++-- .../main/kotlin/org/openapitools/model/Tag.kt | 10 +- .../kotlin/org/openapitools/model/User.kt | 40 +++--- .../kotlin/org/openapitools/model/Animal.kt | 8 +- .../main/kotlin/org/openapitools/model/Cat.kt | 13 +- .../kotlin/org/openapitools/model/Category.kt | 8 +- .../kotlin/org/openapitools/model/Client.kt | 5 +- .../main/kotlin/org/openapitools/model/Dog.kt | 13 +- .../main/kotlin/org/openapitools/model/Foo.kt | 5 +- .../model/FooGetDefaultResponse.kt | 5 +- .../openapitools/model/ModelApiResponse.kt | 15 ++- .../kotlin/org/openapitools/model/Order.kt | 30 +++-- .../main/kotlin/org/openapitools/model/Pet.kt | 26 ++-- .../main/kotlin/org/openapitools/model/Tag.kt | 10 +- .../kotlin/org/openapitools/model/User.kt | 40 +++--- .../kotlin/org/openapitools/model/Category.kt | 10 +- .../openapitools/model/ModelApiResponse.kt | 15 ++- .../kotlin/org/openapitools/model/Order.kt | 30 +++-- .../main/kotlin/org/openapitools/model/Pet.kt | 26 ++-- .../main/kotlin/org/openapitools/model/Tag.kt | 10 +- .../kotlin/org/openapitools/model/User.kt | 40 +++--- .../kotlin/org/openapitools/model/Category.kt | 10 +- .../openapitools/model/ModelApiResponse.kt | 15 ++- .../kotlin/org/openapitools/model/Order.kt | 30 +++-- .../main/kotlin/org/openapitools/model/Pet.kt | 26 ++-- .../main/kotlin/org/openapitools/model/Tag.kt | 10 +- .../kotlin/org/openapitools/model/User.kt | 40 +++--- .../kotlin/org/openapitools/model/Category.kt | 10 +- .../openapitools/model/ModelApiResponse.kt | 15 ++- .../kotlin/org/openapitools/model/Order.kt | 30 +++-- .../main/kotlin/org/openapitools/model/Pet.kt | 26 ++-- .../main/kotlin/org/openapitools/model/Tag.kt | 10 +- .../kotlin/org/openapitools/model/User.kt | 40 +++--- .../main/kotlin/org/openapitools/model/Cat.kt | 57 ++++++-- .../kotlin/org/openapitools/model/Category.kt | 6 +- .../main/kotlin/org/openapitools/model/Dog.kt | 60 +++++++-- .../openapitools/model/ModelApiResponse.kt | 9 +- .../kotlin/org/openapitools/model/Order.kt | 18 ++- .../main/kotlin/org/openapitools/model/Pet.kt | 127 ++++++++++++++++-- .../main/kotlin/org/openapitools/model/Tag.kt | 6 +- .../kotlin/org/openapitools/model/User.kt | 24 ++-- .../kotlin/org/openapitools/model/Category.kt | 6 +- .../openapitools/model/ModelApiResponse.kt | 9 +- .../kotlin/org/openapitools/model/Order.kt | 18 ++- .../main/kotlin/org/openapitools/model/Pet.kt | 18 ++- .../main/kotlin/org/openapitools/model/Tag.kt | 6 +- .../kotlin/org/openapitools/model/User.kt | 24 ++-- 107 files changed, 1460 insertions(+), 818 deletions(-) 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 f6ad7b8786f9..01ad605e0373 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 @@ -525,43 +525,39 @@ components: type: string nonRequiredWithDefaultList: type: array - required: false + items: + type: string default: [ ] nonRequiredWithDefaultSet: type: array + items: + type: string uniqueItems: true - required: false default: [ ] nonRequiredWithDefaultString: type: string - required: false default: defaultValue nonRequiredWithDefaultInt: type: number format: int32 - required: false default: 15 nonRequiredWithDefaultLong: type: number format: int64 - required: false default: 15 nonRequiredWithDefaultFloat: type: number format: float - required: false default: 15.45 nonRequiredWithDefaultDouble: type: number format: double - required: false default: 15.45 nonRequiredWithDefaultEnum: type: string enum: - THIS - THAT - required: false default: THIS nonRequiredWithDefaultEnumList: type: array @@ -571,7 +567,6 @@ components: - THESE - THOSE - THEM - required: false default: [ THESE, THOSE ] nonRequiredWithDefaultEnumSet: type: array @@ -582,7 +577,6 @@ components: - THESE - THOSE - THEM - required: false default: [ THEM, THOSE ] photoUrls: type: array 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..773a3881bfd8 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/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..401281919aa2 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 @@ -27,26 +27,65 @@ 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(), + + @get:JsonProperty("nonRequiredWithDefaultSet", required = false) + override val nonRequiredWithDefaultSet: kotlin.collections.Set = setOf(), + + @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: Cat.NonRequiredWithDefaultEnum = NonRequiredWithDefaultEnum.THIS, + + @get:JsonProperty("nonRequiredWithDefaultEnumList", required = false) + override val nonRequiredWithDefaultEnumList: kotlin.collections.List = arrayListOf(NonRequiredWithDefaultEnumList.THESE,NonRequiredWithDefaultEnumList.THOSE), + + @get:JsonProperty("nonRequiredWithDefaultEnumSet", required = false) + override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(NonRequiredWithDefaultEnumSet.THEM,NonRequiredWithDefaultEnumSet.THOSE), @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..22fd9d471d4c 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 @@ -28,28 +28,68 @@ 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(), + + @get:JsonProperty("nonRequiredWithDefaultSet", required = false) + override val nonRequiredWithDefaultSet: kotlin.collections.Set = setOf(), + + @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: Dog.NonRequiredWithDefaultEnum = NonRequiredWithDefaultEnum.THIS, + + @get:JsonProperty("nonRequiredWithDefaultEnumList", required = false) + override val nonRequiredWithDefaultEnumList: kotlin.collections.List = arrayListOf(NonRequiredWithDefaultEnumList.THESE,NonRequiredWithDefaultEnumList.THOSE), + + @get:JsonProperty("nonRequiredWithDefaultEnumSet", required = false) + override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(NonRequiredWithDefaultEnumSet.THEM,NonRequiredWithDefaultEnumSet.THOSE), @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..53277f0afeaa 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 @@ -29,6 +29,16 @@ 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 tags * @param color */ @@ -43,27 +53,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: Pet.NonRequiredWithDefaultEnum + + + val nonRequiredWithDefaultEnumList: Pet.NonRequiredWithDefaultEnumList + + + val nonRequiredWithDefaultEnumSet: Pet.NonRequiredWithDefaultEnumSet + + + val tags: kotlin.collections.List? + + + val color: Color? + + + /** + * + * Values: THIS,THAT + */ + enum class NonRequiredWithDefaultEnum(@get:JsonValue val value: kotlin.String) { + + THIS("THIS"), + THAT("THAT"); + + companion object { + @JvmStatic + @JsonCreator + fun forValue(value: kotlin.String): NonRequiredWithDefaultEnum { + return values().firstOrNull{it -> it.value == value} + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Pet'") + } + } + } + + /** + * + * Values: THESE,THOSE,THEM + */ + enum class NonRequiredWithDefaultEnumList(@get:JsonValue val value: kotlin.String) { + + THESE("THESE"), + THOSE("THOSE"), + THEM("THEM"); + + companion object { + @JvmStatic + @JsonCreator + fun forValue(value: kotlin.String): NonRequiredWithDefaultEnumList { + return values().firstOrNull{it -> it.value == value} + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Pet'") + } + } + } + + /** + * + * Values: THESE,THOSE,THEM + */ + enum class NonRequiredWithDefaultEnumSet(@get:JsonValue val value: kotlin.String) { + + THESE("THESE"), + THOSE("THOSE"), + THEM("THEM"); + + companion object { + @JvmStatic + @JsonCreator + fun forValue(value: kotlin.String): NonRequiredWithDefaultEnumSet { + return values().firstOrNull{it -> it.value == value} + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Pet'") + } + } + } companion object { private const val serialVersionUID: kotlin.Long = 1 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 { From 00f079cea7bd98aa96d889124a044569372934ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Fri, 31 Oct 2025 00:38:17 +0100 Subject: [PATCH 06/12] add some default strings and fix test --- .../codegen/kotlin/spring/KotlinSpringServerCodegenTest.java | 4 ++-- .../3_0/kotlin/petstore-with-x-kotlin-implements.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 2d769be8160e..9136be280536 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 @@ -1093,9 +1093,9 @@ public void generateModelWithRequiredFalseWithDefaults() throws Exception { "@get:JsonProperty(\"category\", required = false)", "override val category: Category? = null", // without default (fallback) value is nullable "@get:JsonProperty(\"nonRequiredWithDefaultList\", required = false)", - "override val nonRequiredWithDefaultList: kotlin.collections.List = arrayListOf()", // elsewhere with default (fallback) value is not nullable + "override val nonRequiredWithDefaultList: kotlin.collections.List = arrayListOf(\"just some default string\",\"another default string\"),", // elsewhere with default (fallback) value is not nullable "@get:JsonProperty(\"nonRequiredWithDefaultSet\", required = false)", - "override val nonRequiredWithDefaultSet: kotlin.collections.Set = setOf()", + "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)", 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 01ad605e0373..528f5e92f4cf 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 @@ -527,13 +527,13 @@ components: type: array items: type: string - default: [ ] + default: [ "just some default string", "another default string" ] nonRequiredWithDefaultSet: type: array items: type: string uniqueItems: true - default: [ ] + default: [ "more strings", "look, it's a string!" ] nonRequiredWithDefaultString: type: string default: defaultValue From 6159bcacb5996b64394ee3aa1871f9cfbfa4f09b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Fri, 31 Oct 2025 01:06:18 +0100 Subject: [PATCH 07/12] add some default strings and fix test --- .../src/main/kotlin/org/openapitools/model/Cat.kt | 4 ++-- .../src/main/kotlin/org/openapitools/model/Dog.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 401281919aa2..dc2cbaa69f4a 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 @@ -50,10 +50,10 @@ data class Cat( override val category: Category? = null, @get:JsonProperty("nonRequiredWithDefaultList", required = false) - override val nonRequiredWithDefaultList: kotlin.collections.List = arrayListOf(), + 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(), + 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", 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 22fd9d471d4c..023ca245dff9 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 @@ -54,10 +54,10 @@ data class Dog( override val category: Category? = null, @get:JsonProperty("nonRequiredWithDefaultList", required = false) - override val nonRequiredWithDefaultList: kotlin.collections.List = arrayListOf(), + 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(), + 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", From 611eb879aa6753faa2bd7de4380326b90c681c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Fri, 31 Oct 2025 08:50:37 +0100 Subject: [PATCH 08/12] fix open api definition to side-step issues with local enum schema definition (basically avoid existing bug) --- .../spring/KotlinSpringServerCodegenTest.java | 12 ++-- .../petstore-with-x-kotlin-implements.yaml | 29 ++++---- .../.openapi-generator/FILES | 1 + .../EnumConverterConfiguration.kt | 7 ++ .../main/kotlin/org/openapitools/model/Cat.kt | 10 ++- .../main/kotlin/org/openapitools/model/Dog.kt | 10 ++- .../main/kotlin/org/openapitools/model/Pet.kt | 66 ++----------------- .../kotlin/org/openapitools/model/SomeEnum.kt | 38 +++++++++++ 8 files changed, 82 insertions(+), 91 deletions(-) create mode 100644 samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeEnum.kt 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 9136be280536..5e273f6a0336 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 @@ -1107,11 +1107,11 @@ public void generateModelWithRequiredFalseWithDefaults() throws Exception { "@get:JsonProperty(\"nonRequiredWithDefaultDouble\", required = false)", "override val nonRequiredWithDefaultDouble: kotlin.Double = 15.45", "@get:JsonProperty(\"nonRequiredWithDefaultEnum\", required = false)", - "override val nonRequiredWithDefaultEnum: Dog.NonRequiredWithDefaultEnum = NonRequiredWithDefaultEnum.THIS", + "override val nonRequiredWithDefaultEnum: SomeEnum = SomeEnum.ENUMVALUE1", "@get:JsonProperty(\"nonRequiredWithDefaultEnumList\", required = false)", - "override val nonRequiredWithDefaultEnumList: kotlin.collections.List = arrayListOf(NonRequiredWithDefaultEnumList.THESE,NonRequiredWithDefaultEnumList.THOSE)", + "override val nonRequiredWithDefaultEnumList: kotlin.collections.List = arrayListOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1)", "@get:JsonProperty(\"nonRequiredWithDefaultEnumSet\", required = false)", - "override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(NonRequiredWithDefaultEnumSet.THEM,NonRequiredWithDefaultEnumSet.THOSE)" + "override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1)" ); Path petPath = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Pet.kt"); @@ -1125,9 +1125,9 @@ public void generateModelWithRequiredFalseWithDefaults() throws Exception { "val nonRequiredWithDefaultLong: java.math.BigDecimal", "val nonRequiredWithDefaultFloat: kotlin.Float", "val nonRequiredWithDefaultDouble: kotlin.Double", - "val nonRequiredWithDefaultEnum: Pet.NonRequiredWithDefaultEnum", - "val nonRequiredWithDefaultEnumList: Pet.NonRequiredWithDefaultEnumList", - "val nonRequiredWithDefaultEnumSet: Pet.NonRequiredWithDefaultEnumSet" + "val nonRequiredWithDefaultEnum: SomeEnum", + "val nonRequiredWithDefaultEnumList: kotlin.collections.List", + "val nonRequiredWithDefaultEnumSet: kotlin.collections.Set" ); } 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 528f5e92f4cf..51a80053906e 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 @@ -554,30 +554,18 @@ components: format: double default: 15.45 nonRequiredWithDefaultEnum: - type: string - enum: - - THIS - - THAT - default: THIS + $ref: '#/components/schemas/SomeEnum' nonRequiredWithDefaultEnumList: type: array items: - type: string - enum: - - THESE - - THOSE - - THEM - default: [ THESE, THOSE ] + $ref: '#/components/schemas/SomeEnum' + default: [ ENUMVALUE3, ENUMVALUE1 ] nonRequiredWithDefaultEnumSet: type: array uniqueItems: true items: - type: string - enum: - - THESE - - THOSE - - THEM - default: [ THEM, THOSE ] + $ref: '#/components/schemas/SomeEnum' + default: [ ENUMVALUE3, ENUMVALUE1 ] photoUrls: type: array items: @@ -635,6 +623,13 @@ components: format: int64 name: type: string + SomeEnum: + type: string + enum: + - ENUMVALUE1 + - ENUMVALUE2 + - ENUMVALUE3 + default: ENUMVALUE1 Color: x-kotlin-implements: [ com.some.pack.WithDefaultMethods ] type: string 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..b9db975526ff 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,6 @@ 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/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..9295860135bd 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,7 @@ package org.openapitools.configuration import org.openapitools.model.Color +import org.openapitools.model.SomeEnum import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -22,5 +23,11 @@ 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) + } + } } 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 dc2cbaa69f4a..cc87d657a78d 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,7 @@ 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.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -70,14 +71,17 @@ data class Cat( @get:JsonProperty("nonRequiredWithDefaultDouble", required = false) override val nonRequiredWithDefaultDouble: kotlin.Double = 15.45, + @field:Valid @get:JsonProperty("nonRequiredWithDefaultEnum", required = false) - override val nonRequiredWithDefaultEnum: Cat.NonRequiredWithDefaultEnum = NonRequiredWithDefaultEnum.THIS, + override val nonRequiredWithDefaultEnum: SomeEnum = SomeEnum.ENUMVALUE1, + @field:Valid @get:JsonProperty("nonRequiredWithDefaultEnumList", required = false) - override val nonRequiredWithDefaultEnumList: kotlin.collections.List = arrayListOf(NonRequiredWithDefaultEnumList.THESE,NonRequiredWithDefaultEnumList.THOSE), + 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(NonRequiredWithDefaultEnumSet.THEM,NonRequiredWithDefaultEnumSet.THOSE), + override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1), @field:Valid @get:JsonProperty("tags", required = false) 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 023ca245dff9..48469cafa590 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,7 @@ 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.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -74,14 +75,17 @@ data class Dog( @get:JsonProperty("nonRequiredWithDefaultDouble", required = false) override val nonRequiredWithDefaultDouble: kotlin.Double = 15.45, + @field:Valid @get:JsonProperty("nonRequiredWithDefaultEnum", required = false) - override val nonRequiredWithDefaultEnum: Dog.NonRequiredWithDefaultEnum = NonRequiredWithDefaultEnum.THIS, + override val nonRequiredWithDefaultEnum: SomeEnum = SomeEnum.ENUMVALUE1, + @field:Valid @get:JsonProperty("nonRequiredWithDefaultEnumList", required = false) - override val nonRequiredWithDefaultEnumList: kotlin.collections.List = arrayListOf(NonRequiredWithDefaultEnumList.THESE,NonRequiredWithDefaultEnumList.THOSE), + 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(NonRequiredWithDefaultEnumSet.THEM,NonRequiredWithDefaultEnumSet.THOSE), + override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1), @field:Valid @get:JsonProperty("tags", required = false) 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 53277f0afeaa..5b489bb2073f 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,7 @@ 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.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -90,13 +91,13 @@ interface Pet : Serializable, com.some.pack.Named, com.some.pack.WithCategory, c val nonRequiredWithDefaultDouble: kotlin.Double - val nonRequiredWithDefaultEnum: Pet.NonRequiredWithDefaultEnum + val nonRequiredWithDefaultEnum: SomeEnum - val nonRequiredWithDefaultEnumList: Pet.NonRequiredWithDefaultEnumList + val nonRequiredWithDefaultEnumList: kotlin.collections.List - val nonRequiredWithDefaultEnumSet: Pet.NonRequiredWithDefaultEnumSet + val nonRequiredWithDefaultEnumSet: kotlin.collections.Set val tags: kotlin.collections.List? @@ -105,65 +106,6 @@ interface Pet : Serializable, com.some.pack.Named, com.some.pack.WithCategory, c val color: Color? - /** - * - * Values: THIS,THAT - */ - enum class NonRequiredWithDefaultEnum(@get:JsonValue val value: kotlin.String) { - - THIS("THIS"), - THAT("THAT"); - - companion object { - @JvmStatic - @JsonCreator - fun forValue(value: kotlin.String): NonRequiredWithDefaultEnum { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Pet'") - } - } - } - - /** - * - * Values: THESE,THOSE,THEM - */ - enum class NonRequiredWithDefaultEnumList(@get:JsonValue val value: kotlin.String) { - - THESE("THESE"), - THOSE("THOSE"), - THEM("THEM"); - - companion object { - @JvmStatic - @JsonCreator - fun forValue(value: kotlin.String): NonRequiredWithDefaultEnumList { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Pet'") - } - } - } - - /** - * - * Values: THESE,THOSE,THEM - */ - enum class NonRequiredWithDefaultEnumSet(@get:JsonValue val value: kotlin.String) { - - THESE("THESE"), - THOSE("THOSE"), - THEM("THEM"); - - companion object { - @JvmStatic - @JsonCreator - fun forValue(value: kotlin.String): NonRequiredWithDefaultEnumSet { - return values().firstOrNull{it -> it.value == value} - ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Pet'") - } - } - } - companion object { private const val serialVersionUID: kotlin.Long = 1 } 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'") + } + } +} + From 10195730c5b889f05f7b267850939c9559562668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Fri, 31 Oct 2025 09:09:09 +0100 Subject: [PATCH 09/12] add a case with nullable attribute with non-null default. That breaks the logic. Needs fix --- .../petstore-with-x-kotlin-implements.yaml | 64 +++++++++++++++++++ .../.openapi-generator/FILES | 1 + .../EnumConverterConfiguration.kt | 7 ++ .../main/kotlin/org/openapitools/model/Cat.kt | 37 +++++++++++ .../main/kotlin/org/openapitools/model/Dog.kt | 37 +++++++++++ .../main/kotlin/org/openapitools/model/Pet.kt | 45 +++++++++++++ .../openapitools/model/SomeNullableEnum.kt | 38 +++++++++++ 7 files changed, 229 insertions(+) create mode 100644 samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnum.kt 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 51a80053906e..26eb30c1034b 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 @@ -566,6 +566,62 @@ components: items: $ref: '#/components/schemas/SomeEnum' default: [ ENUMVALUE3, ENUMVALUE1 ] + nonRequiredWithDefaultNullList: + type: array + items: + type: string + nullable: true + default: null + nonRequiredWithDefaultNullSet: + type: array + items: + type: string + uniqueItems: true + nullable: true + default: null + nonRequiredWithDefaultNullString: + type: string + nullable: true + default: null + nonRequiredWithDefaultNullInt: + type: number + format: int32 + nullable: true + default: null + nonRequiredWithDefaultNullLong: + type: number + format: int64 + nullable: true + default: null + nonRequiredWithDefaultNullFloat: + type: number + format: float + nullable: true + default: null + nonRequiredWithDefaultNullDouble: + type: number + format: double + nullable: true + default: null + nonRequiredWithDefaultNullEnum: + $ref: '#/components/schemas/SomeNullableEnum' + nonRequiredWithDefaultNullEnumList: + type: array + items: + $ref: '#/components/schemas/SomeEnum' + nullable: true + default: null + nonRequiredWithDefaultNullEnumSet: + type: array + uniqueItems: true + items: + $ref: '#/components/schemas/SomeEnum' + nullable: true + default: null + nonRequiredNullableWithDefaultString: + type: string + nullable: true + default: "someString" photoUrls: type: array items: @@ -630,6 +686,14 @@ components: - ENUMVALUE2 - ENUMVALUE3 default: ENUMVALUE1 + SomeNullableEnum: + type: string + enum: + - ENUMVALUE1 + - ENUMVALUE2 + - ENUMVALUE3 + nullable: true + default: null Color: x-kotlin-implements: [ com.some.pack.WithDefaultMethods ] type: string 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 b9db975526ff..97705b35ead0 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 @@ -20,5 +20,6 @@ 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/SomeNullableEnum.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 9295860135bd..82f3c9477b95 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 @@ -2,6 +2,7 @@ package org.openapitools.configuration import org.openapitools.model.Color import org.openapitools.model.SomeEnum +import org.openapitools.model.SomeNullableEnum import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -29,5 +30,11 @@ class EnumConverterConfiguration { override fun convert(source: kotlin.String): SomeEnum = SomeEnum.forValue(source) } } + @Bean(name = ["org.openapitools.configuration.EnumConverterConfiguration.someNullableEnumConverter"]) + fun someNullableEnumConverter(): Converter { + return object: Converter { + override fun convert(source: kotlin.String): SomeNullableEnum = SomeNullableEnum.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 cc87d657a78d..57796bb7d17f 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 @@ -9,6 +9,7 @@ import org.openapitools.model.Category import org.openapitools.model.Color import org.openapitools.model.Pet import org.openapitools.model.SomeEnum +import org.openapitools.model.SomeNullableEnum import org.openapitools.model.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -83,6 +84,42 @@ data class Cat( @get:JsonProperty("nonRequiredWithDefaultEnumSet", required = false) override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1), + @get:JsonProperty("nonRequiredWithDefaultNullList", required = false) + override val nonRequiredWithDefaultNullList: kotlin.collections.List? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullSet", required = false) + override val nonRequiredWithDefaultNullSet: kotlin.collections.Set? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullString", required = false) + override val nonRequiredWithDefaultNullString: kotlin.String? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullInt", required = false) + override val nonRequiredWithDefaultNullInt: java.math.BigDecimal? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullLong", required = false) + override val nonRequiredWithDefaultNullLong: java.math.BigDecimal? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullFloat", required = false) + override val nonRequiredWithDefaultNullFloat: kotlin.Float? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullDouble", required = false) + override val nonRequiredWithDefaultNullDouble: kotlin.Double? = null, + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultNullEnum", required = false) + override val nonRequiredWithDefaultNullEnum: SomeNullableEnum? = null, + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultNullEnumList", required = false) + override val nonRequiredWithDefaultNullEnumList: kotlin.collections.List? = null, + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultNullEnumSet", required = false) + override val nonRequiredWithDefaultNullEnumSet: kotlin.collections.Set? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultString", required = false) + override val nonRequiredNullableWithDefaultString: kotlin.String = "someString", + @field:Valid @get:JsonProperty("tags", required = false) override val tags: kotlin.collections.List? = null, 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 48469cafa590..9c0953130606 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 @@ -9,6 +9,7 @@ import org.openapitools.model.Category import org.openapitools.model.Color import org.openapitools.model.Pet import org.openapitools.model.SomeEnum +import org.openapitools.model.SomeNullableEnum import org.openapitools.model.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -87,6 +88,42 @@ data class Dog( @get:JsonProperty("nonRequiredWithDefaultEnumSet", required = false) override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1), + @get:JsonProperty("nonRequiredWithDefaultNullList", required = false) + override val nonRequiredWithDefaultNullList: kotlin.collections.List? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullSet", required = false) + override val nonRequiredWithDefaultNullSet: kotlin.collections.Set? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullString", required = false) + override val nonRequiredWithDefaultNullString: kotlin.String? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullInt", required = false) + override val nonRequiredWithDefaultNullInt: java.math.BigDecimal? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullLong", required = false) + override val nonRequiredWithDefaultNullLong: java.math.BigDecimal? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullFloat", required = false) + override val nonRequiredWithDefaultNullFloat: kotlin.Float? = null, + + @get:JsonProperty("nonRequiredWithDefaultNullDouble", required = false) + override val nonRequiredWithDefaultNullDouble: kotlin.Double? = null, + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultNullEnum", required = false) + override val nonRequiredWithDefaultNullEnum: SomeNullableEnum? = null, + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultNullEnumList", required = false) + override val nonRequiredWithDefaultNullEnumList: kotlin.collections.List? = null, + + @field:Valid + @get:JsonProperty("nonRequiredWithDefaultNullEnumSet", required = false) + override val nonRequiredWithDefaultNullEnumSet: kotlin.collections.Set? = null, + + @get:JsonProperty("nonRequiredNullableWithDefaultString", required = false) + override val nonRequiredNullableWithDefaultString: kotlin.String = "someString", + @field:Valid @get:JsonProperty("tags", required = false) override val tags: kotlin.collections.List? = null, 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 5b489bb2073f..587beac6b02f 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 @@ -11,6 +11,7 @@ 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.SomeNullableEnum import org.openapitools.model.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -40,6 +41,17 @@ import javax.validation.Valid * @param nonRequiredWithDefaultEnum * @param nonRequiredWithDefaultEnumList * @param nonRequiredWithDefaultEnumSet + * @param nonRequiredWithDefaultNullList + * @param nonRequiredWithDefaultNullSet + * @param nonRequiredWithDefaultNullString + * @param nonRequiredWithDefaultNullInt + * @param nonRequiredWithDefaultNullLong + * @param nonRequiredWithDefaultNullFloat + * @param nonRequiredWithDefaultNullDouble + * @param nonRequiredWithDefaultNullEnum + * @param nonRequiredWithDefaultNullEnumList + * @param nonRequiredWithDefaultNullEnumSet + * @param nonRequiredNullableWithDefaultString * @param tags * @param color */ @@ -100,6 +112,39 @@ interface Pet : Serializable, com.some.pack.Named, com.some.pack.WithCategory, c val nonRequiredWithDefaultEnumSet: kotlin.collections.Set + val nonRequiredWithDefaultNullList: kotlin.collections.List? + + + val nonRequiredWithDefaultNullSet: kotlin.collections.Set? + + + val nonRequiredWithDefaultNullString: kotlin.String? + + + val nonRequiredWithDefaultNullInt: java.math.BigDecimal? + + + val nonRequiredWithDefaultNullLong: java.math.BigDecimal? + + + val nonRequiredWithDefaultNullFloat: kotlin.Float? + + + val nonRequiredWithDefaultNullDouble: kotlin.Double? + + + val nonRequiredWithDefaultNullEnum: SomeNullableEnum? + + + val nonRequiredWithDefaultNullEnumList: kotlin.collections.List? + + + val nonRequiredWithDefaultNullEnumSet: kotlin.collections.Set? + + + val nonRequiredNullableWithDefaultString: kotlin.String + + val tags: kotlin.collections.List? 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'") + } + } +} + From 6428dded43910f322e11e9f96eaf4a92b4034a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Fri, 31 Oct 2025 09:46:25 +0100 Subject: [PATCH 10/12] fix behavior for nullable with null and non-null default --- .../kotlin-spring/dataClassOptVar.mustache | 2 +- .../kotlin-spring/interfaceOptVar.mustache | 3 +- .../spring/KotlinSpringServerCodegenTest.java | 232 +++++++++++------- .../petstore-with-x-kotlin-implements.yaml | 85 +++++-- .../.openapi-generator/FILES | 3 +- .../EnumConverterConfiguration.kt | 17 +- .../main/kotlin/org/openapitools/model/Cat.kt | 77 ++++-- .../main/kotlin/org/openapitools/model/Dog.kt | 77 ++++-- .../main/kotlin/org/openapitools/model/Pet.kt | 87 +++++-- .../SomeNullableEnumWithNonNullDefault.kt | 38 +++ .../model/SomeNullableEnumWithNullDefault.kt | 38 +++ 11 files changed, 483 insertions(+), 176 deletions(-) create mode 100644 samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnumWithNonNullDefault.kt create mode 100644 samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/SomeNullableEnumWithNullDefault.kt 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 7366b4aaeea7..34ade5ec8501 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache @@ -18,7 +18,7 @@ }}{{#isEnum}}{{#isArray}}{{baseType}}<{{/isArray}}{{classname}}.{{{nameInPascalCase}}}{{#isArray}}>{{/isArray}}{{/isEnum}}{{! }}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{! }}{{^defaultValue}}? = null{{/defaultValue}}{{! -}}{{#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/interfaceOptVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache index 62e7182d7ac9..69aabb5f526d 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache @@ -17,5 +17,6 @@ {{#isInherited}}override {{/isInherited}}{{>modelMutable}} {{{name}}}: {{! }}{{#isEnum}}{{classname}}.{{nameInPascalCase}}{{/isEnum}}{{! }}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{! -}}{{^defaultValue}}?{{/defaultValue}}{{! +}}{{#isNullable}}?{{/isNullable}}{{! +}}{{^isNullable}}{{^defaultValue}}?{{/defaultValue}}{{/isNullable}}{{! }}{{^discriminator}} = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/discriminator}} 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 5e273f6a0336..dfeacb1bece4 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 @@ -6,9 +6,6 @@ import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.parser.core.models.ParseOptions; -import java.util.HashMap; -import java.util.function.Consumer; -import java.util.stream.Stream; import org.apache.commons.io.FileUtils; import org.assertj.core.api.Assertions; import org.jetbrains.annotations.NotNull; @@ -34,10 +31,13 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; +import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; import static org.openapitools.codegen.TestUtils.assertFileContains; @@ -372,7 +372,6 @@ public void delegateReactiveWithTags() throws Exception { "ApiUtil"); } - @Test public void testNullableMultipartFile() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); @@ -440,7 +439,6 @@ public void arrayItemsCanBeNullable() throws IOException { assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/ArrayWithNullableItemsModel.kt"), "List"); } - @Test public void doNotGenerateRequestParamForObjectQueryParam() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); @@ -693,12 +691,12 @@ private static void testMultiLineOperationDescription(final boolean isInterfaceO Paths.get( outputPath + "/src/main/kotlin/org/openapitools/api/" + pingApiFileName), "description = \"\"\"# Multi-line descriptions\n" - + "\n" - + "This is an example of a multi-line description.\n" - + "\n" - + "It:\n" - + "- has multiple lines\n" - + "- uses Markdown (CommonMark) for rich text representation\"\"\"" + + "\n" + + "This is an example of a multi-line description.\n" + + "\n" + + "It:\n" + + "- has multiple lines\n" + + "- uses Markdown (CommonMark) for rich text representation\"\"\"" ); } @@ -817,10 +815,10 @@ public void contractWithEnumContainsEnumConverter() throws IOException { @Test public void contractWithResolvedInnerEnumContainsEnumConverter() throws IOException { Map files = generateFromContract( - "src/test/resources/3_0/inner_enum.yaml", - new HashMap<>(), - new HashMap<>(), - configurator -> configurator.addInlineSchemaOption("RESOLVE_INLINE_ENUMS", "true") + "src/test/resources/3_0/inner_enum.yaml", + new HashMap<>(), + new HashMap<>(), + configurator -> configurator.addInlineSchemaOption("RESOLVE_INLINE_ENUMS", "true") ); File enumConverterFile = files.get("EnumConverterConfiguration.kt"); @@ -864,7 +862,6 @@ public void givenMultipartFormArray_whenGenerateDelegateAndService_thenParameter Path controllerFile = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PetApi.kt"); assertFileContains(controllerFile, "images: Array"); - Path serviceFile = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PetApiService.kt"); assertFileContains(serviceFile, "images: Array"); } @@ -994,6 +991,7 @@ public void generateSerializableModel() throws Exception { "private const val serialVersionUID: kotlin.Long = 1" ); } + @Test public void generateSerializableModelWithXimplements() throws Exception { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); @@ -1090,10 +1088,12 @@ public void generateModelWithRequiredFalseWithDefaults() throws Exception { 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", // without default (fallback) value is nullable + "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\"),", // elsewhere with default (fallback) value is not nullable + "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)", @@ -1111,14 +1111,58 @@ public void generateModelWithRequiredFalseWithDefaults() throws Exception { "@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)" + "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, - "override val category: Category?", // without default (fallback) value is nullable - "val nonRequiredWithDefaultList: kotlin.collections.List", // elsewhere with default (fallback) value is not nullable + // [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", @@ -1127,7 +1171,29 @@ public void generateModelWithRequiredFalseWithDefaults() throws Exception { "val nonRequiredWithDefaultDouble: kotlin.Double", "val nonRequiredWithDefaultEnum: SomeEnum", "val nonRequiredWithDefaultEnumList: kotlin.collections.List", - "val nonRequiredWithDefaultEnumSet: kotlin.collections.Set" + "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?" ); } @@ -1413,43 +1479,43 @@ public void testValidationsInQueryParams_issue21238_Api_Delegate() throws IOExce @DataProvider public Object[][] issue17997DocumentationProviders() { - return new Object[][]{ - {DocumentationProviderFeatures.DocumentationProvider.SPRINGDOC.name(), - (Consumer) outputPath -> - assertFileContains( - outputPath, - "allowableValues = [\"0\", \"1\"], defaultValue = \"0\"", - "@PathVariable" - ), - (Consumer) outputPath -> - assertFileContains( - outputPath, - "allowableValues = [\"sleeping\", \"awake\"]", "@PathVariable", - "@PathVariable" - ) - }, - {DocumentationProviderFeatures.DocumentationProvider.SPRINGFOX.name(), - (Consumer) outputPath -> - assertFileContains( - outputPath, - "allowableValues = \"0, 1\", defaultValue = \"0\"", - "@PathVariable" - ), - (Consumer) outputPath -> - assertFileContains( - outputPath, - "allowableValues = \"sleeping, awake\"", "@PathVariable", - "@PathVariable" - ) - } + return new Object[][] { + { DocumentationProviderFeatures.DocumentationProvider.SPRINGDOC.name(), + (Consumer) outputPath -> + assertFileContains( + outputPath, + "allowableValues = [\"0\", \"1\"], defaultValue = \"0\"", + "@PathVariable" + ), + (Consumer) outputPath -> + assertFileContains( + outputPath, + "allowableValues = [\"sleeping\", \"awake\"]", "@PathVariable", + "@PathVariable" + ) + }, + { DocumentationProviderFeatures.DocumentationProvider.SPRINGFOX.name(), + (Consumer) outputPath -> + assertFileContains( + outputPath, + "allowableValues = \"0, 1\", defaultValue = \"0\"", + "@PathVariable" + ), + (Consumer) outputPath -> + assertFileContains( + outputPath, + "allowableValues = \"sleeping, awake\"", "@PathVariable", + "@PathVariable" + ) + } }; } @Test(dataProvider = "issue17997DocumentationProviders") public void testDocumentationAnnotationInPathParams_Issue17997( - String documentProvider, - Consumer intEnumAssertFunction, - Consumer stringEnumAssertFunction + String documentProvider, + Consumer intEnumAssertFunction, + Consumer stringEnumAssertFunction ) throws IOException { Map additionalProperties = new HashMap<>(); additionalProperties.put(DOCUMENTATION_PROVIDER, documentProvider); @@ -1460,14 +1526,14 @@ public void testDocumentationAnnotationInPathParams_Issue17997( generatorPropertyDefaults.put(CodegenConstants.APIS, "true"); Map files = generateFromContract( - "src/test/resources/3_0/issue_6762.yaml", - additionalProperties, - generatorPropertyDefaults + "src/test/resources/3_0/issue_6762.yaml", + additionalProperties, + generatorPropertyDefaults ); Stream.of( - "ZebrasApiController.kt", - "GiraffesApiController.kt" + "ZebrasApiController.kt", + "GiraffesApiController.kt" ).forEach(filename -> { File file = files.get(filename); assertThat(file).isNotNull(); @@ -1475,8 +1541,8 @@ public void testDocumentationAnnotationInPathParams_Issue17997( }); Stream.of( - "BearsApiController.kt", - "CamelsApiController.kt" + "BearsApiController.kt", + "CamelsApiController.kt" ).forEach(filename -> { File file = files.get(filename); assertThat(file).isNotNull(); @@ -1775,13 +1841,13 @@ public void testXMinimumMessageAndXMaximumMessage_long() throws IOException { .assertParameter("number") .assertParameterAnnotation("Min") .hasAttributes(ImmutableMap.of( - "value", "1L", + "value", "1L", "message", "\"Must be positive\"" )) .toParameter() .assertParameterAnnotation("Max") .hasAttributes(ImmutableMap.of( - "value", "99L", + "value", "99L", "message", "\"Must be less than 100\"" )) .toParameter() @@ -1789,13 +1855,13 @@ public void testXMinimumMessageAndXMaximumMessage_long() throws IOException { .assertParameter("token") .assertParameterAnnotation("Min") .hasAttributes(ImmutableMap.of( - "value", "1L", + "value", "1L", "message", "\"Must be positive\"" )) .toParameter() .assertParameterAnnotation("Max") .hasAttributes(ImmutableMap.of( - "value", "99L", + "value", "99L", "message", "\"Must be less than 100\"" )) .toParameter() @@ -1803,13 +1869,13 @@ public void testXMinimumMessageAndXMaximumMessage_long() throws IOException { .assertParameter("clientNumber") .assertParameterAnnotation("Min") .hasAttributes(ImmutableMap.of( - "value", "1L", + "value", "1L", "message", "\"Must be positive\"" )) .toParameter() .assertParameterAnnotation("Max") .hasAttributes(ImmutableMap.of( - "value", "99L", + "value", "99L", "message", "\"Must be less than 100\"" )); KotlinFileAssert.assertThat(files.get("LongTest.kt")) @@ -1817,13 +1883,13 @@ public void testXMinimumMessageAndXMaximumMessage_long() throws IOException { .assertPrimaryConstructorParameter("field1") .assertParameterAnnotation("Min", "get") .hasAttributes(ImmutableMap.of( - "value", "1L", + "value", "1L", "message", "\"Must be positive\"" )) .toPrimaryConstructorParameter() .assertParameterAnnotation("Max", "get") .hasAttributes(ImmutableMap.of( - "value", "99L", + "value", "99L", "message", "\"Must be less than 100\"" )) .toPrimaryConstructorParameter() @@ -1845,9 +1911,9 @@ private Map generateFromContract(String url, Map a } private Map generateFromContract( - String url, - Map additionalProperties, - Map generatorPropertyDefaults + String url, + Map additionalProperties, + Map generatorPropertyDefaults ) throws IOException { return generateFromContract(url, additionalProperties, generatorPropertyDefaults, codegen -> { }); @@ -1859,22 +1925,22 @@ private Map generateFromContract( * use CodegenConfigurator instead of CodegenConfig for easier configuration like in JavaClientCodeGenTest */ private Map generateFromContract( - String url, - Map additionalProperties, - Map generatorPropertyDefaults, - Consumer consumer + String url, + Map additionalProperties, + Map generatorPropertyDefaults, + Consumer consumer ) throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); output.deleteOnExit(); final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("kotlin-spring") - .setAdditionalProperties(additionalProperties) - .setValidateSpec(false) - .setInputSpec(url) - .setLibrary(SPRING_BOOT) - .setOutputDir(output.getAbsolutePath()); + .setGeneratorName("kotlin-spring") + .setAdditionalProperties(additionalProperties) + .setValidateSpec(false) + .setInputSpec(url) + .setLibrary(SPRING_BOOT) + .setOutputDir(output.getAbsolutePath()); consumer.accept(configurator); @@ -1884,6 +1950,6 @@ private Map generateFromContract( generatorPropertyDefaults.forEach(generator::setGeneratorPropertyDefault); return generator.opts(input).generate().stream() - .collect(Collectors.toMap(File::getName, Function.identity())); + .collect(Collectors.toMap(File::getName, Function.identity())); } } 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 26eb30c1034b..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 @@ -566,62 +566,111 @@ components: items: $ref: '#/components/schemas/SomeEnum' default: [ ENUMVALUE3, ENUMVALUE1 ] - nonRequiredWithDefaultNullList: + nonRequiredNullableWithDefaultNullList: type: array items: type: string nullable: true default: null - nonRequiredWithDefaultNullSet: + nonRequiredNullableWithDefaultNullSet: type: array items: type: string uniqueItems: true nullable: true default: null - nonRequiredWithDefaultNullString: + nonRequiredNullableWithDefaultNullString: type: string nullable: true default: null - nonRequiredWithDefaultNullInt: + nonRequiredNullableWithDefaultNullInt: type: number format: int32 nullable: true default: null - nonRequiredWithDefaultNullLong: + nonRequiredNullableWithDefaultNullLong: type: number format: int64 nullable: true default: null - nonRequiredWithDefaultNullFloat: + nonRequiredNullableWithDefaultNullFloat: type: number format: float nullable: true default: null - nonRequiredWithDefaultNullDouble: + nonRequiredNullableWithDefaultNullDouble: type: number format: double nullable: true default: null - nonRequiredWithDefaultNullEnum: - $ref: '#/components/schemas/SomeNullableEnum' - nonRequiredWithDefaultNullEnumList: + nonRequiredNullableWithDefaultNullEnum: + $ref: '#/components/schemas/SomeNullableEnumWithNullDefault' + nonRequiredNullableWithDefaultNullEnumList: type: array items: $ref: '#/components/schemas/SomeEnum' nullable: true default: null - nonRequiredWithDefaultNullEnumSet: + nonRequiredNullableWithDefaultNullEnumSet: type: array uniqueItems: true items: $ref: '#/components/schemas/SomeEnum' nullable: true default: null - nonRequiredNullableWithDefaultString: + ###---#### + 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: "someString" + 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: @@ -686,7 +735,7 @@ components: - ENUMVALUE2 - ENUMVALUE3 default: ENUMVALUE1 - SomeNullableEnum: + SomeNullableEnumWithNullDefault: type: string enum: - ENUMVALUE1 @@ -694,6 +743,14 @@ components: - 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-springboot-x-kotlin-implements/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/FILES index 97705b35ead0..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 @@ -20,6 +20,7 @@ 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/SomeNullableEnum.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 82f3c9477b95..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 @@ -2,7 +2,8 @@ package org.openapitools.configuration import org.openapitools.model.Color import org.openapitools.model.SomeEnum -import org.openapitools.model.SomeNullableEnum +import org.openapitools.model.SomeNullableEnumWithNonNullDefault +import org.openapitools.model.SomeNullableEnumWithNullDefault import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -30,10 +31,16 @@ class EnumConverterConfiguration { override fun convert(source: kotlin.String): SomeEnum = SomeEnum.forValue(source) } } - @Bean(name = ["org.openapitools.configuration.EnumConverterConfiguration.someNullableEnumConverter"]) - fun someNullableEnumConverter(): Converter { - return object: Converter { - override fun convert(source: kotlin.String): SomeNullableEnum = SomeNullableEnum.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 57796bb7d17f..bdbc98857783 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 @@ -9,7 +9,8 @@ import org.openapitools.model.Category import org.openapitools.model.Color import org.openapitools.model.Pet import org.openapitools.model.SomeEnum -import org.openapitools.model.SomeNullableEnum +import org.openapitools.model.SomeNullableEnumWithNonNullDefault +import org.openapitools.model.SomeNullableEnumWithNullDefault import org.openapitools.model.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -83,42 +84,72 @@ data class Cat( @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, + @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) + 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), - @get:JsonProperty("nonRequiredWithDefaultNullList", required = false) - override val nonRequiredWithDefaultNullList: kotlin.collections.List? = null, - @get:JsonProperty("nonRequiredWithDefaultNullSet", required = false) - override val nonRequiredWithDefaultNullSet: kotlin.collections.Set? = null, - @get:JsonProperty("nonRequiredWithDefaultNullString", required = false) - override val nonRequiredWithDefaultNullString: kotlin.String? = null, - @get:JsonProperty("nonRequiredWithDefaultNullInt", required = false) - override val nonRequiredWithDefaultNullInt: java.math.BigDecimal? = null, - @get:JsonProperty("nonRequiredWithDefaultNullLong", required = false) - override val nonRequiredWithDefaultNullLong: java.math.BigDecimal? = null, - @get:JsonProperty("nonRequiredWithDefaultNullFloat", required = false) - override val nonRequiredWithDefaultNullFloat: kotlin.Float? = null, - @get:JsonProperty("nonRequiredWithDefaultNullDouble", required = false) - override val nonRequiredWithDefaultNullDouble: kotlin.Double? = null, @field:Valid - @get:JsonProperty("nonRequiredWithDefaultNullEnum", required = false) - override val nonRequiredWithDefaultNullEnum: SomeNullableEnum? = null, @field:Valid - @get:JsonProperty("nonRequiredWithDefaultNullEnumList", required = false) - override val nonRequiredWithDefaultNullEnumList: kotlin.collections.List? = null, @field:Valid - @get:JsonProperty("nonRequiredWithDefaultNullEnumSet", required = false) - override val nonRequiredWithDefaultNullEnumSet: kotlin.collections.Set? = null, - @get:JsonProperty("nonRequiredNullableWithDefaultString", required = false) - override val nonRequiredNullableWithDefaultString: kotlin.String = "someString", + + + + + + + + @field:Valid + + @field:Valid + + @field:Valid @field:Valid @get:JsonProperty("tags", required = false) 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 9c0953130606..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 @@ -9,7 +9,8 @@ import org.openapitools.model.Category import org.openapitools.model.Color import org.openapitools.model.Pet import org.openapitools.model.SomeEnum -import org.openapitools.model.SomeNullableEnum +import org.openapitools.model.SomeNullableEnumWithNonNullDefault +import org.openapitools.model.SomeNullableEnumWithNullDefault import org.openapitools.model.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -88,41 +89,71 @@ data class Dog( @get:JsonProperty("nonRequiredWithDefaultEnumSet", required = false) override val nonRequiredWithDefaultEnumSet: kotlin.collections.Set = setOf(SomeEnum.ENUMVALUE3,SomeEnum.ENUMVALUE1), - @get:JsonProperty("nonRequiredWithDefaultNullList", required = false) - override val nonRequiredWithDefaultNullList: kotlin.collections.List? = null, + @get:JsonProperty("nonRequiredNullableWithDefaultNullList", required = false) + override val nonRequiredNullableWithDefaultNullList: kotlin.collections.List? = null, - @get:JsonProperty("nonRequiredWithDefaultNullSet", required = false) - override val nonRequiredWithDefaultNullSet: kotlin.collections.Set? = null, + @get:JsonProperty("nonRequiredNullableWithDefaultNullSet", required = false) + override val nonRequiredNullableWithDefaultNullSet: kotlin.collections.Set? = null, - @get:JsonProperty("nonRequiredWithDefaultNullString", required = false) - override val nonRequiredWithDefaultNullString: kotlin.String? = null, + @get:JsonProperty("nonRequiredNullableWithDefaultNullString", required = false) + override val nonRequiredNullableWithDefaultNullString: kotlin.String? = null, - @get:JsonProperty("nonRequiredWithDefaultNullInt", required = false) - override val nonRequiredWithDefaultNullInt: java.math.BigDecimal? = null, + @get:JsonProperty("nonRequiredNullableWithDefaultNullInt", required = false) + override val nonRequiredNullableWithDefaultNullInt: java.math.BigDecimal? = null, - @get:JsonProperty("nonRequiredWithDefaultNullLong", required = false) - override val nonRequiredWithDefaultNullLong: java.math.BigDecimal? = null, + @get:JsonProperty("nonRequiredNullableWithDefaultNullLong", required = false) + override val nonRequiredNullableWithDefaultNullLong: java.math.BigDecimal? = null, - @get:JsonProperty("nonRequiredWithDefaultNullFloat", required = false) - override val nonRequiredWithDefaultNullFloat: kotlin.Float? = null, + @get:JsonProperty("nonRequiredNullableWithDefaultNullFloat", required = false) + override val nonRequiredNullableWithDefaultNullFloat: kotlin.Float? = null, - @get:JsonProperty("nonRequiredWithDefaultNullDouble", required = false) - override val nonRequiredWithDefaultNullDouble: kotlin.Double? = null, + @get:JsonProperty("nonRequiredNullableWithDefaultNullDouble", required = false) + override val nonRequiredNullableWithDefaultNullDouble: kotlin.Double? = null, @field:Valid - @get:JsonProperty("nonRequiredWithDefaultNullEnum", required = false) - override val nonRequiredWithDefaultNullEnum: SomeNullableEnum? = null, + @get:JsonProperty("nonRequiredNullableWithDefaultNullEnum", required = false) + override val nonRequiredNullableWithDefaultNullEnum: SomeNullableEnumWithNullDefault? = null, @field:Valid - @get:JsonProperty("nonRequiredWithDefaultNullEnumList", required = false) - override val nonRequiredWithDefaultNullEnumList: kotlin.collections.List? = null, + @get:JsonProperty("nonRequiredNullableWithDefaultNullEnumList", required = false) + override val nonRequiredNullableWithDefaultNullEnumList: kotlin.collections.List? = null, @field:Valid - @get:JsonProperty("nonRequiredWithDefaultNullEnumSet", required = false) - override val nonRequiredWithDefaultNullEnumSet: kotlin.collections.Set? = null, + @get:JsonProperty("nonRequiredNullableWithDefaultNullEnumSet", required = false) + override val nonRequiredNullableWithDefaultNullEnumSet: kotlin.collections.Set? = null, - @get:JsonProperty("nonRequiredNullableWithDefaultString", required = false) - override val nonRequiredNullableWithDefaultString: kotlin.String = "someString", + @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", required = false) 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 587beac6b02f..ed44d588ecac 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 @@ -11,7 +11,8 @@ 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.SomeNullableEnum +import org.openapitools.model.SomeNullableEnumWithNonNullDefault +import org.openapitools.model.SomeNullableEnumWithNullDefault import org.openapitools.model.Tag import java.io.Serializable import javax.validation.constraints.DecimalMax @@ -41,17 +42,26 @@ import javax.validation.Valid * @param nonRequiredWithDefaultEnum * @param nonRequiredWithDefaultEnumList * @param nonRequiredWithDefaultEnumSet - * @param nonRequiredWithDefaultNullList - * @param nonRequiredWithDefaultNullSet - * @param nonRequiredWithDefaultNullString - * @param nonRequiredWithDefaultNullInt - * @param nonRequiredWithDefaultNullLong - * @param nonRequiredWithDefaultNullFloat - * @param nonRequiredWithDefaultNullDouble - * @param nonRequiredWithDefaultNullEnum - * @param nonRequiredWithDefaultNullEnumList - * @param nonRequiredWithDefaultNullEnumSet - * @param nonRequiredNullableWithDefaultString + * @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 */ @@ -104,45 +114,72 @@ interface Pet : Serializable, com.some.pack.Named, com.some.pack.WithCategory, c 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 nonRequiredWithDefaultEnumList: kotlin.collections.List - val nonRequiredWithDefaultEnumSet: kotlin.collections.Set - val nonRequiredWithDefaultNullList: kotlin.collections.List? - val nonRequiredWithDefaultNullSet: kotlin.collections.Set? - val nonRequiredWithDefaultNullString: kotlin.String? - val nonRequiredWithDefaultNullInt: java.math.BigDecimal? - val nonRequiredWithDefaultNullLong: java.math.BigDecimal? - val nonRequiredWithDefaultNullFloat: kotlin.Float? - val nonRequiredWithDefaultNullDouble: kotlin.Double? - val nonRequiredWithDefaultNullEnum: SomeNullableEnum? - val nonRequiredWithDefaultNullEnumList: kotlin.collections.List? - val nonRequiredWithDefaultNullEnumSet: kotlin.collections.Set? - val nonRequiredNullableWithDefaultString: kotlin.String val tags: kotlin.collections.List? 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'") + } + } +} + From c9f57fcc05171883075e958e2ff0e91b7c94b538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Fri, 31 Oct 2025 09:48:31 +0100 Subject: [PATCH 11/12] regenerate code --- .../main/kotlin/org/openapitools/model/Apa.kt | 2 +- .../main/kotlin/org/openapitools/model/Cat.kt | 52 +++++++++---------- .../main/kotlin/org/openapitools/model/Pet.kt | 44 ++++++++-------- 3 files changed, 49 insertions(+), 49 deletions(-) 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 773a3881bfd8..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 @@ -44,7 +44,7 @@ data class Apa( @Schema(example = "null", required = false, description = "") @Deprecated(message = "") @get:JsonProperty("fepa", required = false) - val fepa: java.math.BigDecimal = java.math.BigDecimal("100"), + val fepa: java.math.BigDecimal? = java.math.BigDecimal("100"), @Schema(example = "null", required = false, description = "") @get:JsonProperty("gepa", required = false) 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 bdbc98857783..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 @@ -84,72 +84,72 @@ data class Cat( @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, - @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), - - - - - - - - - @field:Valid - - @field:Valid - - @field:Valid - - - - - - - @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", required = false) 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 ed44d588ecac..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 @@ -114,72 +114,72 @@ interface Pet : Serializable, com.some.pack.Named, com.some.pack.WithCategory, c 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 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? From 499312405ceb59dd05178f6da2e395b5d6f62b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Fri, 31 Oct 2025 10:16:16 +0100 Subject: [PATCH 12/12] revert unrelated formatting changes in test --- .../spring/KotlinSpringServerCodegenTest.java | 152 +++++++++--------- 1 file changed, 77 insertions(+), 75 deletions(-) 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 dfeacb1bece4..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 @@ -6,6 +6,9 @@ import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.parser.core.models.ParseOptions; +import java.util.HashMap; +import java.util.function.Consumer; +import java.util.stream.Stream; import org.apache.commons.io.FileUtils; import org.assertj.core.api.Assertions; import org.jetbrains.annotations.NotNull; @@ -31,13 +34,10 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; -import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; import static org.openapitools.codegen.TestUtils.assertFileContains; @@ -372,6 +372,7 @@ public void delegateReactiveWithTags() throws Exception { "ApiUtil"); } + @Test public void testNullableMultipartFile() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); @@ -439,6 +440,7 @@ public void arrayItemsCanBeNullable() throws IOException { assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/ArrayWithNullableItemsModel.kt"), "List"); } + @Test public void doNotGenerateRequestParamForObjectQueryParam() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); @@ -691,12 +693,12 @@ private static void testMultiLineOperationDescription(final boolean isInterfaceO Paths.get( outputPath + "/src/main/kotlin/org/openapitools/api/" + pingApiFileName), "description = \"\"\"# Multi-line descriptions\n" - + "\n" - + "This is an example of a multi-line description.\n" - + "\n" - + "It:\n" - + "- has multiple lines\n" - + "- uses Markdown (CommonMark) for rich text representation\"\"\"" + + "\n" + + "This is an example of a multi-line description.\n" + + "\n" + + "It:\n" + + "- has multiple lines\n" + + "- uses Markdown (CommonMark) for rich text representation\"\"\"" ); } @@ -815,10 +817,10 @@ public void contractWithEnumContainsEnumConverter() throws IOException { @Test public void contractWithResolvedInnerEnumContainsEnumConverter() throws IOException { Map files = generateFromContract( - "src/test/resources/3_0/inner_enum.yaml", - new HashMap<>(), - new HashMap<>(), - configurator -> configurator.addInlineSchemaOption("RESOLVE_INLINE_ENUMS", "true") + "src/test/resources/3_0/inner_enum.yaml", + new HashMap<>(), + new HashMap<>(), + configurator -> configurator.addInlineSchemaOption("RESOLVE_INLINE_ENUMS", "true") ); File enumConverterFile = files.get("EnumConverterConfiguration.kt"); @@ -862,6 +864,7 @@ public void givenMultipartFormArray_whenGenerateDelegateAndService_thenParameter Path controllerFile = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PetApi.kt"); assertFileContains(controllerFile, "images: Array"); + Path serviceFile = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PetApiService.kt"); assertFileContains(serviceFile, "images: Array"); } @@ -991,7 +994,6 @@ public void generateSerializableModel() throws Exception { "private const val serialVersionUID: kotlin.Long = 1" ); } - @Test public void generateSerializableModelWithXimplements() throws Exception { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); @@ -1479,43 +1481,43 @@ public void testValidationsInQueryParams_issue21238_Api_Delegate() throws IOExce @DataProvider public Object[][] issue17997DocumentationProviders() { - return new Object[][] { - { DocumentationProviderFeatures.DocumentationProvider.SPRINGDOC.name(), - (Consumer) outputPath -> - assertFileContains( - outputPath, - "allowableValues = [\"0\", \"1\"], defaultValue = \"0\"", - "@PathVariable" - ), - (Consumer) outputPath -> - assertFileContains( - outputPath, - "allowableValues = [\"sleeping\", \"awake\"]", "@PathVariable", - "@PathVariable" - ) - }, - { DocumentationProviderFeatures.DocumentationProvider.SPRINGFOX.name(), - (Consumer) outputPath -> - assertFileContains( - outputPath, - "allowableValues = \"0, 1\", defaultValue = \"0\"", - "@PathVariable" - ), - (Consumer) outputPath -> - assertFileContains( - outputPath, - "allowableValues = \"sleeping, awake\"", "@PathVariable", - "@PathVariable" - ) - } + return new Object[][]{ + {DocumentationProviderFeatures.DocumentationProvider.SPRINGDOC.name(), + (Consumer) outputPath -> + assertFileContains( + outputPath, + "allowableValues = [\"0\", \"1\"], defaultValue = \"0\"", + "@PathVariable" + ), + (Consumer) outputPath -> + assertFileContains( + outputPath, + "allowableValues = [\"sleeping\", \"awake\"]", "@PathVariable", + "@PathVariable" + ) + }, + {DocumentationProviderFeatures.DocumentationProvider.SPRINGFOX.name(), + (Consumer) outputPath -> + assertFileContains( + outputPath, + "allowableValues = \"0, 1\", defaultValue = \"0\"", + "@PathVariable" + ), + (Consumer) outputPath -> + assertFileContains( + outputPath, + "allowableValues = \"sleeping, awake\"", "@PathVariable", + "@PathVariable" + ) + } }; } @Test(dataProvider = "issue17997DocumentationProviders") public void testDocumentationAnnotationInPathParams_Issue17997( - String documentProvider, - Consumer intEnumAssertFunction, - Consumer stringEnumAssertFunction + String documentProvider, + Consumer intEnumAssertFunction, + Consumer stringEnumAssertFunction ) throws IOException { Map additionalProperties = new HashMap<>(); additionalProperties.put(DOCUMENTATION_PROVIDER, documentProvider); @@ -1526,14 +1528,14 @@ public void testDocumentationAnnotationInPathParams_Issue17997( generatorPropertyDefaults.put(CodegenConstants.APIS, "true"); Map files = generateFromContract( - "src/test/resources/3_0/issue_6762.yaml", - additionalProperties, - generatorPropertyDefaults + "src/test/resources/3_0/issue_6762.yaml", + additionalProperties, + generatorPropertyDefaults ); Stream.of( - "ZebrasApiController.kt", - "GiraffesApiController.kt" + "ZebrasApiController.kt", + "GiraffesApiController.kt" ).forEach(filename -> { File file = files.get(filename); assertThat(file).isNotNull(); @@ -1541,8 +1543,8 @@ public void testDocumentationAnnotationInPathParams_Issue17997( }); Stream.of( - "BearsApiController.kt", - "CamelsApiController.kt" + "BearsApiController.kt", + "CamelsApiController.kt" ).forEach(filename -> { File file = files.get(filename); assertThat(file).isNotNull(); @@ -1841,13 +1843,13 @@ public void testXMinimumMessageAndXMaximumMessage_long() throws IOException { .assertParameter("number") .assertParameterAnnotation("Min") .hasAttributes(ImmutableMap.of( - "value", "1L", + "value", "1L", "message", "\"Must be positive\"" )) .toParameter() .assertParameterAnnotation("Max") .hasAttributes(ImmutableMap.of( - "value", "99L", + "value", "99L", "message", "\"Must be less than 100\"" )) .toParameter() @@ -1855,13 +1857,13 @@ public void testXMinimumMessageAndXMaximumMessage_long() throws IOException { .assertParameter("token") .assertParameterAnnotation("Min") .hasAttributes(ImmutableMap.of( - "value", "1L", + "value", "1L", "message", "\"Must be positive\"" )) .toParameter() .assertParameterAnnotation("Max") .hasAttributes(ImmutableMap.of( - "value", "99L", + "value", "99L", "message", "\"Must be less than 100\"" )) .toParameter() @@ -1869,13 +1871,13 @@ public void testXMinimumMessageAndXMaximumMessage_long() throws IOException { .assertParameter("clientNumber") .assertParameterAnnotation("Min") .hasAttributes(ImmutableMap.of( - "value", "1L", + "value", "1L", "message", "\"Must be positive\"" )) .toParameter() .assertParameterAnnotation("Max") .hasAttributes(ImmutableMap.of( - "value", "99L", + "value", "99L", "message", "\"Must be less than 100\"" )); KotlinFileAssert.assertThat(files.get("LongTest.kt")) @@ -1883,13 +1885,13 @@ public void testXMinimumMessageAndXMaximumMessage_long() throws IOException { .assertPrimaryConstructorParameter("field1") .assertParameterAnnotation("Min", "get") .hasAttributes(ImmutableMap.of( - "value", "1L", + "value", "1L", "message", "\"Must be positive\"" )) .toPrimaryConstructorParameter() .assertParameterAnnotation("Max", "get") .hasAttributes(ImmutableMap.of( - "value", "99L", + "value", "99L", "message", "\"Must be less than 100\"" )) .toPrimaryConstructorParameter() @@ -1911,9 +1913,9 @@ private Map generateFromContract(String url, Map a } private Map generateFromContract( - String url, - Map additionalProperties, - Map generatorPropertyDefaults + String url, + Map additionalProperties, + Map generatorPropertyDefaults ) throws IOException { return generateFromContract(url, additionalProperties, generatorPropertyDefaults, codegen -> { }); @@ -1925,22 +1927,22 @@ private Map generateFromContract( * use CodegenConfigurator instead of CodegenConfig for easier configuration like in JavaClientCodeGenTest */ private Map generateFromContract( - String url, - Map additionalProperties, - Map generatorPropertyDefaults, - Consumer consumer + String url, + Map additionalProperties, + Map generatorPropertyDefaults, + Consumer consumer ) throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); output.deleteOnExit(); final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("kotlin-spring") - .setAdditionalProperties(additionalProperties) - .setValidateSpec(false) - .setInputSpec(url) - .setLibrary(SPRING_BOOT) - .setOutputDir(output.getAbsolutePath()); + .setGeneratorName("kotlin-spring") + .setAdditionalProperties(additionalProperties) + .setValidateSpec(false) + .setInputSpec(url) + .setLibrary(SPRING_BOOT) + .setOutputDir(output.getAbsolutePath()); consumer.accept(configurator); @@ -1950,6 +1952,6 @@ private Map generateFromContract( generatorPropertyDefaults.forEach(generator::setGeneratorPropertyDefault); return generator.opts(input).generate().stream() - .collect(Collectors.toMap(File::getName, Function.identity())); + .collect(Collectors.toMap(File::getName, Function.identity())); } }