From 82564602c5ad70abedfa17eb992a3030e2376a0d Mon Sep 17 00:00:00 2001 From: jpfinne Date: Fri, 14 Aug 2026 17:43:48 +0200 Subject: [PATCH 01/17] Java/Spring handling of required+nullable in models --- .../Java/nullable_var_annotations.mustache | 2 +- .../nullableAnnotation_jspecify.mustache | 2 +- .../nullableArgument_chainSetter.mustache | 1 + .../nullableArgument_constructor.mustache | 1 + .../main/resources/JavaSpring/pojo.mustache | 6 +- .../codegen/java/JavaClientCodegenTest.java | 4 + .../java/spring/SpringCodegenTest.java | 67 ++++- .../src/test/resources/3_0/java/jspecify.yaml | 46 ++- .../.openapi-generator/FILES | 4 + .../java/native-jackson3-jspecify/README.md | 3 + .../native-jackson3-jspecify/api/openapi.yaml | 49 +++ .../.openapi-generator/FILES | 4 + .../README.md | 2 + .../api/openapi.yaml | 49 +++ .../.openapi-generator/FILES | 4 + .../README.md | 2 + .../api/openapi.yaml | 49 +++ .../.openapi-generator/FILES | 4 + .../README.md | 2 + .../api/openapi.yaml | 49 +++ .../.openapi-generator/FILES | 4 + .../README.md | 2 + .../api/openapi.yaml | 49 +++ .../.openapi-generator/FILES | 2 + .../api/RequiredAndNullableApi.java | 83 ++++++ .../main/java/org/openapitools/model/Foo.java | 4 +- .../model/RequiredAndNullable.java | 281 ++++++++++++++++++ .../.openapi-generator/FILES | 2 + .../api/RequiredAndNullableApi.java | 83 ++++++ .../main/java/org/openapitools/model/Foo.java | 4 +- .../model/RequiredAndNullable.java | 281 ++++++++++++++++++ .../.openapi-generator/FILES | 2 + .../api/RequiredAndNullableApi.java | 83 ++++++ .../main/java/org/openapitools/model/Foo.java | 4 +- .../model/RequiredAndNullable.java | 265 +++++++++++++++++ 35 files changed, 1481 insertions(+), 18 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_chainSetter.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_constructor.mustache create mode 100644 samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/RequiredAndNullableApi.java create mode 100644 samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java create mode 100644 samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/RequiredAndNullableApi.java create mode 100644 samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java create mode 100644 samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/RequiredAndNullableApi.java create mode 100644 samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java diff --git a/modules/openapi-generator/src/main/resources/Java/nullable_var_annotations.mustache b/modules/openapi-generator/src/main/resources/Java/nullable_var_annotations.mustache index 4f6f6f13dbe1..26a6cc4146f5 100644 --- a/modules/openapi-generator/src/main/resources/Java/nullable_var_annotations.mustache +++ b/modules/openapi-generator/src/main/resources/Java/nullable_var_annotations.mustache @@ -1 +1 @@ -{{^useJspecify}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable{{/isNullable}}{{^isNullable}}@{{javaxPackage}}.annotation.Nonnull{{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable{{/required}}{{/useJspecify}}{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{^required}}@{{javaxPackage}}.annotation.Nullable {{/required}}{{/lambda.jSpecifyNullable}}{{/useJspecify}} \ No newline at end of file +{{^useJspecify}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable{{/isNullable}}{{^isNullable}}@{{javaxPackage}}.annotation.Nonnull{{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable{{/required}}{{/useJspecify}}{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable {{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable {{/required}}{{/lambda.jSpecifyNullable}}{{/useJspecify}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation_jspecify.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation_jspecify.mustache index 225d7f0ff62c..c7624e180091 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation_jspecify.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation_jspecify.mustache @@ -1 +1 @@ -{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{^required}}{{^useOptional}}{{#openApiNullable}}{{^isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/useOptional}}{{/required}}{{/lambda.jSpecifyNullable}}{{/useJspecify}} \ No newline at end of file +{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{#required}}{{#isNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/isNullable}}{{/required}}{{^required}}{{^useOptional}}{{#openApiNullable}}{{^isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/useOptional}}{{/required}}{{/lambda.jSpecifyNullable}}{{/useJspecify}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_chainSetter.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_chainSetter.mustache new file mode 100644 index 000000000000..e2c7181c3585 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_chainSetter.mustache @@ -0,0 +1 @@ +{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{^required}}{{^useOptional}}@Nullable {{/useOptional}}{{#useOptional}}{{#optionalAcceptNullable}}@Nullable {{/optionalAcceptNullable}}{{/useOptional}}{{/required}}{{/lambda.jSpecifyNullable}}{{#lambda.jSpecifyDatatype}}{{{datatypeWithEnum}}}{{/lambda.jSpecifyDatatype}}{{/useJspecify}}{{^useJspecify}}{{>nullableAnnotation_default}}{{{datatypeWithEnum}}}{{/useJspecify}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_constructor.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_constructor.mustache new file mode 100644 index 000000000000..a001ec18760d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_constructor.mustache @@ -0,0 +1 @@ +{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{#required}}{{#isNullable}}@Nullable {{/isNullable}}{{/required}}{{^required}}@Nullable {{/required}}{{/lambda.jSpecifyNullable}}{{#lambda.jSpecifyDatatype}}{{{datatypeWithEnum}}}{{/lambda.jSpecifyDatatype}}{{/useJspecify}}{{^useJspecify}}{{>nullableAnnotation}}{{{datatypeWithEnum}}}{{/useJspecify}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index 964db40884ac..7ccb29ff25b9 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -111,7 +111,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} /** * Constructor with only required parameters{{#generateConstructorWithAllArgs}}{{^vendorExtensions.x-java-all-args-constructor}} and all parameters{{/vendorExtensions.x-java-all-args-constructor}}{{/generateConstructorWithAllArgs}} */ - public {{classname}}({{#requiredVars}}{{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}}{{/requiredVars}}) { + public {{classname}}({{#requiredVars}}{{>nullableArgument_constructor}} {{name}}{{^-last}}, {{/-last}}{{/requiredVars}}) { {{#parent}} super({{#parentRequiredVars}}{{name}}{{^-last}}, {{/-last}}{{/parentRequiredVars}}); {{/parent}} @@ -134,7 +134,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} /** * Constructor with all args parameters */ - public {{classname}}({{#vendorExtensions.x-java-all-args-constructor-vars}}{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{^required}}@Nullable {{/required}}{{/lambda.jSpecifyNullable}}{{#lambda.jSpecifyDatatype}}{{{datatypeWithEnum}}}{{/lambda.jSpecifyDatatype}}{{/useJspecify}}{{^useJspecify}}{{>nullableAnnotation}}{{{datatypeWithEnum}}}{{/useJspecify}} {{name}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-java-all-args-constructor-vars}}) { + public {{classname}}({{#vendorExtensions.x-java-all-args-constructor-vars}}{{>nullableArgument_constructor}} {{name}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-java-all-args-constructor-vars}}) { {{#parent}} super({{#parentVars}}{{name}}{{^-last}}, {{/-last}}{{/parentVars}}); {{/parent}} @@ -153,7 +153,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} {{^lombok.Data}} {{! begin feature: fluent setter methods }} - public {{classname}} {{name}}({{#useJspecify}}{{#lambda.jSpecifyNullable}}{{^required}}{{^useOptional}}@Nullable {{/useOptional}}{{#useOptional}}{{#optionalAcceptNullable}}@Nullable {{/optionalAcceptNullable}}{{/useOptional}}{{/required}}{{/lambda.jSpecifyNullable}}{{#lambda.jSpecifyDatatype}}{{{datatypeWithEnum}}}{{/lambda.jSpecifyDatatype}}{{/useJspecify}}{{^useJspecify}}{{>nullableAnnotation_default}}{{{datatypeWithEnum}}}{{/useJspecify}} {{name}}) { + public {{classname}} {{name}}({{>nullableArgument_chainSetter}} {{name}}) { {{#openApiNullable}} this.{{name}} = {{#isNullable}}JsonNullable.of({{/isNullable}}{{#useOptional}}{{^required}}{{^isNullable}}{{^isContainer}}Optional.of{{#optionalAcceptNullable}}Nullable{{/optionalAcceptNullable}}({{/isContainer}}{{/isNullable}}{{/required}}{{/useOptional}}{{name}}{{#isNullable}}){{/isNullable}}{{#useOptional}}{{^required}}{{^isNullable}}{{^isContainer}}){{/isContainer}}{{/isNullable}}{{/required}}{{/useOptional}}; {{/openApiNullable}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index bd2a9ed544c9..678898a30df5 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -4760,6 +4760,10 @@ public void testJspecify(String library, boolean useSpringBoot4, boolean hasJspe .fileContains( "public Foo(@JsonProperty(JSON_PROPERTY_DT) java.time.@Nullable Instant dt, @JsonProperty(JSON_PROPERTY_NULLABLE_DT) java.time.@Nullable Instant nullableDt, @JsonProperty(JSON_PROPERTY_BINARY) @Nullable File binary, @JsonProperty(JSON_PROPERTY_NULLABLE_BINARY) @Nullable File nullableBinary, @JsonProperty(JSON_PROPERTY_LIST_OF_DT) @Nullable List listOfDt, @JsonProperty(JSON_PROPERTY_LIST_MIN_INTEMS) @Nullable List listMinIntems, @JsonProperty(JSON_PROPERTY_NULLABLE_LIST_MIN_INTEMS) @Nullable List nullableListMinIntems, @JsonProperty(JSON_PROPERTY_REQUIRED_DT) java.time.Instant requiredDt, @JsonProperty(JSON_PROPERTY_NUMBER) java.math.@Nullable BigDecimal number, @JsonProperty(JSON_PROPERTY_NULLABLE_NUMBER) java.math.@Nullable BigDecimal nullableNumber, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_REQUIRED_COLOR) String requiredColor, @JsonProperty(JSON_PROPERTY_NULLABLE_COLOR) @Nullable String nullableColor) {"); } + JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) + .fileContains( + "void setStr(@Nullable String str)", + "RequiredAndNullable str(@Nullable String str)"); if (!RESTTEMPLATE.equals(library)) { JavaFileAssert.assertThat(files.get("FooApi.java")) .fileContains("fooDtParamGet(java.time.@Nullable Instant dtParam, java.time.@Nullable Instant dtQuery, java.time.@Nullable Instant dtCookie, @Nullable String color)"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index c77a0ac16cf2..66244214cb53 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -63,6 +63,7 @@ import static org.openapitools.codegen.TestUtils.*; import static org.openapitools.codegen.languages.AbstractJavaCodegen.GENERATE_BUILDERS; import static org.openapitools.codegen.languages.AbstractJavaCodegen.GENERATE_CONSTRUCTOR_WITH_ALL_ARGS; +import static org.openapitools.codegen.languages.JavaClientCodegen.USE_JACKSON_3; import static org.openapitools.codegen.languages.JavaClientCodegen.USE_SPRING_BOOT4; import static org.openapitools.codegen.languages.SpringCodegen.*; import static org.openapitools.codegen.languages.features.DocumentationProviderFeatures.ANNOTATION_LIBRARY; @@ -7046,6 +7047,7 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti SpringCodegen.OPENAPI_NULLABLE, false, USE_BEANVALIDATION, true, GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, true, + GENERATE_CONSTRUCTOR_WITH_REQUIRED_ARGS, true, INTERFACE_ONLY, false, GENERATE_BUILDERS, true, springVersionProperty, springBootVersion > 2 @@ -7082,7 +7084,10 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti "Foo.Builder dt(java.time.@Nullable Instant dt)", "Foo.Builder requiredDt(java.time.Instant requiredDt)", "Foo.Builder nullableNumber(@Nullable BigDecimal nullableNumber)" - ); + ).fileDoesNotContain( + "NotNull", + "javax.annotation.Nullable", + "jakarta.annotation.Nullable"); JavaFileAssert.assertThat(files.get("FooApi.java")) .assertTypeAnnotations().doesImportAnnotation("org.jspecify.annotations.Nullable").toType() .fileContains( @@ -7091,6 +7096,17 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti "java.time.@Nullable Instant dtCookie", " @RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color" ); + JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) + .fileContains( + "private @Nullable String str", + "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String nonNullable)", + "@Nullable String getStr()", + "void setStr(@Nullable String str)" + ); + JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")) + .fileContains( + "Optional param" + ); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) @@ -7113,6 +7129,7 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) CONTAINER_DEFAULT_TO_NULL, true, USE_BEANVALIDATION, true, GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, true, + GENERATE_CONSTRUCTOR_WITH_REQUIRED_ARGS, true, CodegenConstants.OPENAPI_NULLABLE, true, INTERFACE_ONLY, false, GENERATE_BUILDERS, true, @@ -7149,7 +7166,10 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) "Foo.Builder requiredDt(java.time.Instant requiredDt)", "Foo.Builder nullableNumber(@Nullable BigDecimal nullableNumber)", "Foo.Builder nullableNumber(JsonNullable nullableNumber)" - ); + ).fileDoesNotContain( + "@NotNull", + "javax.annotation.Nullable", + "jakarta.annotation.Nullable"); JavaFileAssert.assertThat(files.get("FooApi.java")) .assertTypeAnnotations().doesImportAnnotation("org.jspecify.annotations.Nullable").toType() .fileContains( @@ -7157,6 +7177,17 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) "java.time.@Nullable Instant dtQuery", "java.time.@Nullable Instant dtCookie" ); + JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) + .fileContains( + "private JsonNullable str = JsonNullable.undefined()", + "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired)", + "JsonNullable getStr()", + "void setStr(JsonNullable str)" + ); + JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")) + .fileContains( + "Optional param" + ); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) @@ -7190,6 +7221,7 @@ public void testJspecify_useOptional(String library, int springBootVersion, bool CONTAINER_DEFAULT_TO_NULL, true, USE_BEANVALIDATION, true, GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, true, + GENERATE_CONSTRUCTOR_WITH_REQUIRED_ARGS, true, SpringCodegen.USE_OPTIONAL, true, OPTIONAL_ACCEPT_NULLABLE, optionalAcceptNullable, INTERFACE_ONLY, false, @@ -7222,7 +7254,10 @@ public void testJspecify_useOptional(String library, int springBootVersion, bool "public Foo(java.time.@Nullable Instant dt, java.time.@Nullable Instant nullableDt, org.springframework.core.io.@Nullable Resource binary, org.springframework.core.io.@Nullable Resource nullableBinary, @Nullable List listOfDt, @Nullable List listMinIntems, @Nullable List nullableListMinIntems, java.time.Instant requiredDt, @Nullable BigDecimal number, @Nullable BigDecimal nullableNumber, @Nullable String color, String requiredColor, @Nullable String nullableColor) {", "Foo.Builder requiredDt(java.time.Instant requiredDt)", "Foo.Builder nullableNumber(JsonNullable nullableNumber)" - ); + ).fileDoesNotContain( + "@NotNull", + "javax.annotation.Nullable", + "jakarta.annotation.Nullable"); if (optionalAcceptNullable) { fooAssert.fileContains( "Foo dt(java.time.@Nullable Instant dt) {\n this.dt = Optional.ofNullable(dt);", @@ -7239,6 +7274,17 @@ public void testJspecify_useOptional(String library, int springBootVersion, bool "Optional dtQuery", "Optional dtCookie" ); + JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) + .fileContains( + "private JsonNullable str = JsonNullable.undefined()", + "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired)", + "JsonNullable getStr()", + "void setStr(JsonNullable str)" + ); + JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")) + .fileContains( + "Optional param" + ); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) @@ -8690,4 +8736,19 @@ public void testReactiveSpringHttpInterfaceSupportListOfStringReturnTypeNoRespon "Mono> getUserIdSet" ); } + + @Test + void nullableRequired() throws IOException { + final Map files = generateFromContract( + "src/test/resources/3_0/issue_24686.yaml", + SPRING_BOOT, Map.of( + USE_JSPECIFY, true, + USE_JACKSON_3, true, + USE_SPRING_BOOT4, true, + CodegenConstants.OPENAPI_NULLABLE, false) + ); + JavaFileAssert.assertThat(files.get("Thing.java")).fileContains( + "void setName(@Nullable String name)" + ); + } } \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml b/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml index 99a4de1af48c..9bff0792e938 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml @@ -4,6 +4,8 @@ info: title: jspecify version: 1.0.0 tags: + - name: requiredAndNullable + description: requiredAndNullable - name: foo description: foo - name: upload @@ -45,6 +47,24 @@ paths: application/json: schema: $ref: '#/components/schemas/Foo' + /requiredAndNullable: + post: + tags: + - requiredAndNullable + requestBody: + required: true + description: bodyWithRequiredAndNullableAttributes + content: + application/json: + schema: + $ref: '#/components/schemas/RequiredAndNullable' + responses: + default: + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/RequiredAndNullable' /upload: post: tags: @@ -152,7 +172,25 @@ components: type: string default: red nullable: true - - - - + RequiredAndNullable: + type: object + required: + - str + - file + - color + - onlyRequired + properties: + str: + nullable: true + type: string + file: + nullable: true + type: string + format: binary + color: + type: string + default: red + nullable: true + onlyRequired: + # NON nullable + type: string diff --git a/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES index b6ae45415018..493dab4c9f78 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES @@ -8,6 +8,8 @@ build.sbt docs/FileApi.md docs/Foo.md docs/FooApi.md +docs/RequiredAndNullable.md +docs/RequiredAndNullableApi.md docs/UploadApi.md git_push.sh gradle.properties @@ -31,9 +33,11 @@ src/main/java/org/openapitools/client/ServerConfiguration.java src/main/java/org/openapitools/client/ServerVariable.java src/main/java/org/openapitools/client/api/FileApi.java src/main/java/org/openapitools/client/api/FooApi.java +src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java src/main/java/org/openapitools/client/api/UploadApi.java src/main/java/org/openapitools/client/api/package-info.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/RequiredAndNullable.java src/main/java/org/openapitools/client/model/package-info.java src/main/java/org/openapitools/client/package-info.java diff --git a/samples/client/petstore/java/native-jackson3-jspecify/README.md b/samples/client/petstore/java/native-jackson3-jspecify/README.md index 9692175454f4..8fbbd3016ef1 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/native-jackson3-jspecify/README.md @@ -110,6 +110,8 @@ Class | Method | HTTP request | Description *FileApi* | [**fileIdGetWithHttpInfo**](docs/FileApi.md#fileIdGetWithHttpInfo) | **GET** /file/{id} | *FooApi* | [**fooDtParamGet**](docs/FooApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | *FooApi* | [**fooDtParamGetWithHttpInfo**](docs/FooApi.md#fooDtParamGetWithHttpInfo) | **GET** /foo/{dtParam} | +*RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | +*RequiredAndNullableApi* | [**requiredAndNullablePostWithHttpInfo**](docs/RequiredAndNullableApi.md#requiredAndNullablePostWithHttpInfo) | **POST** /requiredAndNullable | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadFilesPostWithHttpInfo**](docs/UploadApi.md#uploadFilesPostWithHttpInfo) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | @@ -119,6 +121,7 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Foo](docs/Foo.md) + - [RequiredAndNullable](docs/RequiredAndNullable.md) diff --git a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml index b5f967c8460e..96a44984fe5b 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml @@ -6,6 +6,8 @@ info: servers: - url: / tags: +- description: requiredAndNullable + name: requiredAndNullable - description: foo name: foo - description: upload @@ -59,6 +61,27 @@ paths: - foo x-accepts: - application/json + /requiredAndNullable: + post: + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredAndNullable" + description: bodyWithRequiredAndNullableAttributes + required: true + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredAndNullable" + description: response + tags: + - requiredAndNullable + x-content-type: application/json + x-accepts: + - application/json /upload: post: requestBody: @@ -185,6 +208,32 @@ components: required: - requiredColor - requiredDt + RequiredAndNullable: + example: + str: str + file: "" + color: red + onlyRequired: onlyRequired + properties: + str: + nullable: true + type: string + file: + format: binary + nullable: true + type: string + color: + default: red + nullable: true + type: string + onlyRequired: + type: string + required: + - color + - file + - onlyRequired + - str + type: object _upload_post_request: properties: file: diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/.openapi-generator/FILES b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/.openapi-generator/FILES index 905482ebbf2c..91aded50dce4 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/.openapi-generator/FILES +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/.openapi-generator/FILES @@ -8,6 +8,8 @@ build.sbt docs/FileApi.md docs/Foo.md docs/FooApi.md +docs/RequiredAndNullable.md +docs/RequiredAndNullableApi.md docs/UploadApi.md git_push.sh gradle.properties @@ -27,6 +29,7 @@ src/main/java/org/openapitools/client/ServerVariable.java src/main/java/org/openapitools/client/StringUtil.java src/main/java/org/openapitools/client/api/FileApi.java src/main/java/org/openapitools/client/api/FooApi.java +src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java src/main/java/org/openapitools/client/api/UploadApi.java src/main/java/org/openapitools/client/api/package-info.java src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -34,5 +37,6 @@ src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/RequiredAndNullable.java src/main/java/org/openapitools/client/model/package-info.java src/main/java/org/openapitools/client/package-info.java diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/README.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/README.md index 4d406688dd86..f518fee202e8 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/README.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/README.md @@ -116,6 +116,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *FileApi* | [**fileIdGet**](docs/FileApi.md#fileIdGet) | **GET** /file/{id} | *FooApi* | [**fooDtParamGet**](docs/FooApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | +*RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | @@ -123,6 +124,7 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Foo](docs/Foo.md) + - [RequiredAndNullable](docs/RequiredAndNullable.md) diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml index b5f967c8460e..96a44984fe5b 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml @@ -6,6 +6,8 @@ info: servers: - url: / tags: +- description: requiredAndNullable + name: requiredAndNullable - description: foo name: foo - description: upload @@ -59,6 +61,27 @@ paths: - foo x-accepts: - application/json + /requiredAndNullable: + post: + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredAndNullable" + description: bodyWithRequiredAndNullableAttributes + required: true + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredAndNullable" + description: response + tags: + - requiredAndNullable + x-content-type: application/json + x-accepts: + - application/json /upload: post: requestBody: @@ -185,6 +208,32 @@ components: required: - requiredColor - requiredDt + RequiredAndNullable: + example: + str: str + file: "" + color: red + onlyRequired: onlyRequired + properties: + str: + nullable: true + type: string + file: + format: binary + nullable: true + type: string + color: + default: red + nullable: true + type: string + onlyRequired: + type: string + required: + - color + - file + - onlyRequired + - str + type: object _upload_post_request: properties: file: diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES index 905482ebbf2c..91aded50dce4 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES @@ -8,6 +8,8 @@ build.sbt docs/FileApi.md docs/Foo.md docs/FooApi.md +docs/RequiredAndNullable.md +docs/RequiredAndNullableApi.md docs/UploadApi.md git_push.sh gradle.properties @@ -27,6 +29,7 @@ src/main/java/org/openapitools/client/ServerVariable.java src/main/java/org/openapitools/client/StringUtil.java src/main/java/org/openapitools/client/api/FileApi.java src/main/java/org/openapitools/client/api/FooApi.java +src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java src/main/java/org/openapitools/client/api/UploadApi.java src/main/java/org/openapitools/client/api/package-info.java src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -34,5 +37,6 @@ src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/RequiredAndNullable.java src/main/java/org/openapitools/client/model/package-info.java src/main/java/org/openapitools/client/package-info.java diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md index 4d406688dd86..f518fee202e8 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md @@ -116,6 +116,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *FileApi* | [**fileIdGet**](docs/FileApi.md#fileIdGet) | **GET** /file/{id} | *FooApi* | [**fooDtParamGet**](docs/FooApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | +*RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | @@ -123,6 +124,7 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Foo](docs/Foo.md) + - [RequiredAndNullable](docs/RequiredAndNullable.md) diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml index b5f967c8460e..96a44984fe5b 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -6,6 +6,8 @@ info: servers: - url: / tags: +- description: requiredAndNullable + name: requiredAndNullable - description: foo name: foo - description: upload @@ -59,6 +61,27 @@ paths: - foo x-accepts: - application/json + /requiredAndNullable: + post: + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredAndNullable" + description: bodyWithRequiredAndNullableAttributes + required: true + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredAndNullable" + description: response + tags: + - requiredAndNullable + x-content-type: application/json + x-accepts: + - application/json /upload: post: requestBody: @@ -185,6 +208,32 @@ components: required: - requiredColor - requiredDt + RequiredAndNullable: + example: + str: str + file: "" + color: red + onlyRequired: onlyRequired + properties: + str: + nullable: true + type: string + file: + format: binary + nullable: true + type: string + color: + default: red + nullable: true + type: string + onlyRequired: + type: string + required: + - color + - file + - onlyRequired + - str + type: object _upload_post_request: properties: file: diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES index 530107e2c6dc..0779268797b7 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES @@ -8,6 +8,8 @@ build.sbt docs/FileApi.md docs/Foo.md docs/FooApi.md +docs/RequiredAndNullable.md +docs/RequiredAndNullableApi.md docs/UploadApi.md git_push.sh gradle.properties @@ -28,6 +30,7 @@ src/main/java/org/openapitools/client/ServerConfiguration.java src/main/java/org/openapitools/client/ServerVariable.java src/main/java/org/openapitools/client/api/FileApi.java src/main/java/org/openapitools/client/api/FooApi.java +src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java src/main/java/org/openapitools/client/api/UploadApi.java src/main/java/org/openapitools/client/api/package-info.java src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -35,5 +38,6 @@ src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/RequiredAndNullable.java src/main/java/org/openapitools/client/model/package-info.java src/main/java/org/openapitools/client/package-info.java diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md index 26aaed664ac5..b8158468a7d9 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md @@ -116,6 +116,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *FileApi* | [**fileIdGet**](docs/FileApi.md#fileIdGet) | **GET** /file/{id} | *FooApi* | [**fooDtParamGet**](docs/FooApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | +*RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | @@ -123,6 +124,7 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Foo](docs/Foo.md) + - [RequiredAndNullable](docs/RequiredAndNullable.md) diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml index b5f967c8460e..96a44984fe5b 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -6,6 +6,8 @@ info: servers: - url: / tags: +- description: requiredAndNullable + name: requiredAndNullable - description: foo name: foo - description: upload @@ -59,6 +61,27 @@ paths: - foo x-accepts: - application/json + /requiredAndNullable: + post: + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredAndNullable" + description: bodyWithRequiredAndNullableAttributes + required: true + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredAndNullable" + description: response + tags: + - requiredAndNullable + x-content-type: application/json + x-accepts: + - application/json /upload: post: requestBody: @@ -185,6 +208,32 @@ components: required: - requiredColor - requiredDt + RequiredAndNullable: + example: + str: str + file: "" + color: red + onlyRequired: onlyRequired + properties: + str: + nullable: true + type: string + file: + format: binary + nullable: true + type: string + color: + default: red + nullable: true + type: string + onlyRequired: + type: string + required: + - color + - file + - onlyRequired + - str + type: object _upload_post_request: properties: file: diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES index 537a17ba9f7d..35a3c1387612 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES @@ -8,6 +8,8 @@ build.sbt docs/FileApi.md docs/Foo.md docs/FooApi.md +docs/RequiredAndNullable.md +docs/RequiredAndNullableApi.md docs/UploadApi.md git_push.sh gradle.properties @@ -29,6 +31,7 @@ src/main/java/org/openapitools/client/ServerVariable.java src/main/java/org/openapitools/client/StringUtil.java src/main/java/org/openapitools/client/api/FileApi.java src/main/java/org/openapitools/client/api/FooApi.java +src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java src/main/java/org/openapitools/client/api/UploadApi.java src/main/java/org/openapitools/client/api/package-info.java src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -36,5 +39,6 @@ src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/RequiredAndNullable.java src/main/java/org/openapitools/client/model/package-info.java src/main/java/org/openapitools/client/package-info.java diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md index 36aac7266f67..9bcbbb8d7f8f 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md @@ -116,6 +116,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *FileApi* | [**fileIdGet**](docs/FileApi.md#fileIdGet) | **GET** /file/{id} | *FooApi* | [**fooDtParamGet**](docs/FooApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | +*RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | @@ -123,6 +124,7 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Foo](docs/Foo.md) + - [RequiredAndNullable](docs/RequiredAndNullable.md) diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml index b5f967c8460e..96a44984fe5b 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -6,6 +6,8 @@ info: servers: - url: / tags: +- description: requiredAndNullable + name: requiredAndNullable - description: foo name: foo - description: upload @@ -59,6 +61,27 @@ paths: - foo x-accepts: - application/json + /requiredAndNullable: + post: + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredAndNullable" + description: bodyWithRequiredAndNullableAttributes + required: true + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredAndNullable" + description: response + tags: + - requiredAndNullable + x-content-type: application/json + x-accepts: + - application/json /upload: post: requestBody: @@ -185,6 +208,32 @@ components: required: - requiredColor - requiredDt + RequiredAndNullable: + example: + str: str + file: "" + color: red + onlyRequired: onlyRequired + properties: + str: + nullable: true + type: string + file: + format: binary + nullable: true + type: string + color: + default: red + nullable: true + type: string + onlyRequired: + type: string + required: + - color + - file + - onlyRequired + - str + type: object _upload_post_request: properties: file: diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/.openapi-generator/FILES b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/.openapi-generator/FILES index bc1941bdad50..617533e42f99 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/.openapi-generator/FILES @@ -3,8 +3,10 @@ pom.xml src/main/java/org/openapitools/api/ApiUtil.java src/main/java/org/openapitools/api/FileApi.java src/main/java/org/openapitools/api/FooApi.java +src/main/java/org/openapitools/api/RequiredAndNullableApi.java src/main/java/org/openapitools/api/UploadApi.java src/main/java/org/openapitools/api/UploadFilesApi.java src/main/java/org/openapitools/api/package-info.java src/main/java/org/openapitools/model/Foo.java +src/main/java/org/openapitools/model/RequiredAndNullable.java src/main/java/org/openapitools/model/package-info.java diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/RequiredAndNullableApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/RequiredAndNullableApi.java new file mode 100644 index 000000000000..617b12cd447c --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/RequiredAndNullableApi.java @@ -0,0 +1,83 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.RequiredAndNullable; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +@Validated +@Tag(name = "requiredAndNullable", description = "requiredAndNullable") +public interface RequiredAndNullableApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_REQUIRED_AND_NULLABLE_POST = "/requiredAndNullable"; + /** + * POST /requiredAndNullable + * + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) + * @return response (status code 200) + */ + @Operation( + operationId = "requiredAndNullablePost", + tags = { "requiredAndNullable" }, + responses = { + @ApiResponse(responseCode = "default", description = "response", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RequiredAndNullable.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_POST, + produces = { "application/json" }, + consumes = { "application/json" } + ) + default ResponseEntity requiredAndNullablePost( + @Parameter(name = "RequiredAndNullable", description = "bodyWithRequiredAndNullableAttributes", required = true) @Valid @RequestBody RequiredAndNullable requiredAndNullable + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"str\" : \"str\", \"file\" : \"\", \"color\" : \"red\", \"onlyRequired\" : \"onlyRequired\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java index 8e024c35235d..2c319cd42234 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java @@ -309,7 +309,7 @@ public Foo requiredDt(java.time.Instant requiredDt) { * Get requiredDt * @return requiredDt */ - @NotNull @Valid + @Valid @Schema(name = "requiredDt", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredDt") @JacksonXmlProperty(localName = "requiredDt") @@ -403,7 +403,7 @@ public Foo requiredColor(String requiredColor) { * Get requiredColor * @return requiredColor */ - @NotNull + @Schema(name = "requiredColor", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredColor") @JacksonXmlProperty(localName = "requiredColor") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java new file mode 100644 index 000000000000..592f3d66e376 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -0,0 +1,281 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.jspecify.annotations.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import tools.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import tools.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import tools.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import io.swagger.v3.oas.annotations.media.Schema; + +import jakarta.xml.bind.annotation.*; + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * RequiredAndNullable + */ + +@JacksonXmlRootElement(localName = "RequiredAndNullable") +@XmlRootElement(name = "RequiredAndNullable") +@XmlAccessorType(XmlAccessType.FIELD) +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullable { + + private JsonNullable str = JsonNullable.undefined(); + + private JsonNullable file = JsonNullable.undefined(); + + private JsonNullable color = JsonNullable.undefined(); + + private String onlyRequired; + + public RequiredAndNullable() { + super(); + } + + /** + * Constructor with only required parameters and all parameters + */ + public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired) { + this.str = JsonNullable.of(str); + this.file = JsonNullable.of(file); + this.color = JsonNullable.of(color); + this.onlyRequired = onlyRequired; + } + + public RequiredAndNullable str(String str) { + this.str = JsonNullable.of(str); + return this; + } + + /** + * Get str + * @return str + */ + + @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("str") + @JacksonXmlProperty(localName = "str") + @XmlElement(name = "str") + public JsonNullable getStr() { + return str; + } + + @JsonProperty("str") + @JacksonXmlProperty(localName = "str") + public void setStr(JsonNullable str) { + this.str = str; + } + + public RequiredAndNullable file(org.springframework.core.io.Resource file) { + this.file = JsonNullable.of(file); + return this; + } + + /** + * Get file + * @return file + */ + @Valid + @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("file") + @JacksonXmlProperty(localName = "file") + @XmlElement(name = "file") + public JsonNullable getFile() { + return file; + } + + @JsonProperty("file") + @JacksonXmlProperty(localName = "file") + public void setFile(JsonNullable file) { + this.file = file; + } + + public RequiredAndNullable color(String color) { + this.color = JsonNullable.of(color); + return this; + } + + /** + * Get color + * @return color + */ + + @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("color") + @JacksonXmlProperty(localName = "color") + @XmlElement(name = "color") + public JsonNullable getColor() { + return color; + } + + @JsonProperty("color") + @JacksonXmlProperty(localName = "color") + public void setColor(JsonNullable color) { + this.color = color; + } + + public RequiredAndNullable onlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + return this; + } + + /** + * Get onlyRequired + * @return onlyRequired + */ + + @Schema(name = "onlyRequired", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("onlyRequired") + @JacksonXmlProperty(localName = "onlyRequired") + @XmlElement(name = "onlyRequired") + public String getOnlyRequired() { + return onlyRequired; + } + + @JsonProperty("onlyRequired") + @JacksonXmlProperty(localName = "onlyRequired") + public void setOnlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequiredAndNullable requiredAndNullable = (RequiredAndNullable) o; + return Objects.equals(this.str, requiredAndNullable.str) && + Objects.equals(this.file, requiredAndNullable.file) && + Objects.equals(this.color, requiredAndNullable.color) && + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + } + + @Override + public int hashCode() { + return Objects.hash(str, file, color, onlyRequired); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredAndNullable {\n"); + sb.append(" str: ").append(toIndentedString(str)).append("\n"); + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private RequiredAndNullable instance; + + public Builder() { + this(new RequiredAndNullable()); + } + + protected Builder(RequiredAndNullable instance) { + this.instance = instance; + } + + protected Builder copyOf(RequiredAndNullable value) { + this.instance.setStr(value.str); + this.instance.setFile(value.file); + this.instance.setColor(value.color); + this.instance.setOnlyRequired(value.onlyRequired); + return this; + } + + public RequiredAndNullable.Builder str(String str) { + this.instance.str(str); + return this; + } + + public RequiredAndNullable.Builder str(JsonNullable str) { + this.instance.str = str; + return this; + } + + public RequiredAndNullable.Builder file(org.springframework.core.io.Resource file) { + this.instance.file(file); + return this; + } + + public RequiredAndNullable.Builder file(JsonNullable file) { + this.instance.file = file; + return this; + } + + public RequiredAndNullable.Builder color(String color) { + this.instance.color(color); + return this; + } + + public RequiredAndNullable.Builder color(JsonNullable color) { + this.instance.color = color; + return this; + } + + public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { + this.instance.onlyRequired(onlyRequired); + return this; + } + + /** + * returns a built RequiredAndNullable instance. + * + * The builder is not reusable (NullPointerException) + */ + public RequiredAndNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static RequiredAndNullable.Builder builder() { + return new RequiredAndNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public RequiredAndNullable.Builder toBuilder() { + RequiredAndNullable.Builder builder = new RequiredAndNullable.Builder(); + return builder.copyOf(this); + } + +} + diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/.openapi-generator/FILES b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/.openapi-generator/FILES index bc1941bdad50..617533e42f99 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/.openapi-generator/FILES @@ -3,8 +3,10 @@ pom.xml src/main/java/org/openapitools/api/ApiUtil.java src/main/java/org/openapitools/api/FileApi.java src/main/java/org/openapitools/api/FooApi.java +src/main/java/org/openapitools/api/RequiredAndNullableApi.java src/main/java/org/openapitools/api/UploadApi.java src/main/java/org/openapitools/api/UploadFilesApi.java src/main/java/org/openapitools/api/package-info.java src/main/java/org/openapitools/model/Foo.java +src/main/java/org/openapitools/model/RequiredAndNullable.java src/main/java/org/openapitools/model/package-info.java diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/RequiredAndNullableApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/RequiredAndNullableApi.java new file mode 100644 index 000000000000..617b12cd447c --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/RequiredAndNullableApi.java @@ -0,0 +1,83 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.RequiredAndNullable; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +@Validated +@Tag(name = "requiredAndNullable", description = "requiredAndNullable") +public interface RequiredAndNullableApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_REQUIRED_AND_NULLABLE_POST = "/requiredAndNullable"; + /** + * POST /requiredAndNullable + * + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) + * @return response (status code 200) + */ + @Operation( + operationId = "requiredAndNullablePost", + tags = { "requiredAndNullable" }, + responses = { + @ApiResponse(responseCode = "default", description = "response", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RequiredAndNullable.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_POST, + produces = { "application/json" }, + consumes = { "application/json" } + ) + default ResponseEntity requiredAndNullablePost( + @Parameter(name = "RequiredAndNullable", description = "bodyWithRequiredAndNullableAttributes", required = true) @Valid @RequestBody RequiredAndNullable requiredAndNullable + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"str\" : \"str\", \"file\" : \"\", \"color\" : \"red\", \"onlyRequired\" : \"onlyRequired\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java index 5a9e1038639a..af86df6f5386 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java @@ -309,7 +309,7 @@ public Foo requiredDt(java.time.Instant requiredDt) { * Get requiredDt * @return requiredDt */ - @NotNull @Valid + @Valid @Schema(name = "requiredDt", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredDt") @JacksonXmlProperty(localName = "requiredDt") @@ -403,7 +403,7 @@ public Foo requiredColor(String requiredColor) { * Get requiredColor * @return requiredColor */ - @NotNull + @Schema(name = "requiredColor", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredColor") @JacksonXmlProperty(localName = "requiredColor") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java new file mode 100644 index 000000000000..592f3d66e376 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -0,0 +1,281 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.jspecify.annotations.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import tools.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import tools.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import tools.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import io.swagger.v3.oas.annotations.media.Schema; + +import jakarta.xml.bind.annotation.*; + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * RequiredAndNullable + */ + +@JacksonXmlRootElement(localName = "RequiredAndNullable") +@XmlRootElement(name = "RequiredAndNullable") +@XmlAccessorType(XmlAccessType.FIELD) +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullable { + + private JsonNullable str = JsonNullable.undefined(); + + private JsonNullable file = JsonNullable.undefined(); + + private JsonNullable color = JsonNullable.undefined(); + + private String onlyRequired; + + public RequiredAndNullable() { + super(); + } + + /** + * Constructor with only required parameters and all parameters + */ + public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired) { + this.str = JsonNullable.of(str); + this.file = JsonNullable.of(file); + this.color = JsonNullable.of(color); + this.onlyRequired = onlyRequired; + } + + public RequiredAndNullable str(String str) { + this.str = JsonNullable.of(str); + return this; + } + + /** + * Get str + * @return str + */ + + @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("str") + @JacksonXmlProperty(localName = "str") + @XmlElement(name = "str") + public JsonNullable getStr() { + return str; + } + + @JsonProperty("str") + @JacksonXmlProperty(localName = "str") + public void setStr(JsonNullable str) { + this.str = str; + } + + public RequiredAndNullable file(org.springframework.core.io.Resource file) { + this.file = JsonNullable.of(file); + return this; + } + + /** + * Get file + * @return file + */ + @Valid + @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("file") + @JacksonXmlProperty(localName = "file") + @XmlElement(name = "file") + public JsonNullable getFile() { + return file; + } + + @JsonProperty("file") + @JacksonXmlProperty(localName = "file") + public void setFile(JsonNullable file) { + this.file = file; + } + + public RequiredAndNullable color(String color) { + this.color = JsonNullable.of(color); + return this; + } + + /** + * Get color + * @return color + */ + + @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("color") + @JacksonXmlProperty(localName = "color") + @XmlElement(name = "color") + public JsonNullable getColor() { + return color; + } + + @JsonProperty("color") + @JacksonXmlProperty(localName = "color") + public void setColor(JsonNullable color) { + this.color = color; + } + + public RequiredAndNullable onlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + return this; + } + + /** + * Get onlyRequired + * @return onlyRequired + */ + + @Schema(name = "onlyRequired", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("onlyRequired") + @JacksonXmlProperty(localName = "onlyRequired") + @XmlElement(name = "onlyRequired") + public String getOnlyRequired() { + return onlyRequired; + } + + @JsonProperty("onlyRequired") + @JacksonXmlProperty(localName = "onlyRequired") + public void setOnlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequiredAndNullable requiredAndNullable = (RequiredAndNullable) o; + return Objects.equals(this.str, requiredAndNullable.str) && + Objects.equals(this.file, requiredAndNullable.file) && + Objects.equals(this.color, requiredAndNullable.color) && + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + } + + @Override + public int hashCode() { + return Objects.hash(str, file, color, onlyRequired); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredAndNullable {\n"); + sb.append(" str: ").append(toIndentedString(str)).append("\n"); + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private RequiredAndNullable instance; + + public Builder() { + this(new RequiredAndNullable()); + } + + protected Builder(RequiredAndNullable instance) { + this.instance = instance; + } + + protected Builder copyOf(RequiredAndNullable value) { + this.instance.setStr(value.str); + this.instance.setFile(value.file); + this.instance.setColor(value.color); + this.instance.setOnlyRequired(value.onlyRequired); + return this; + } + + public RequiredAndNullable.Builder str(String str) { + this.instance.str(str); + return this; + } + + public RequiredAndNullable.Builder str(JsonNullable str) { + this.instance.str = str; + return this; + } + + public RequiredAndNullable.Builder file(org.springframework.core.io.Resource file) { + this.instance.file(file); + return this; + } + + public RequiredAndNullable.Builder file(JsonNullable file) { + this.instance.file = file; + return this; + } + + public RequiredAndNullable.Builder color(String color) { + this.instance.color(color); + return this; + } + + public RequiredAndNullable.Builder color(JsonNullable color) { + this.instance.color = color; + return this; + } + + public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { + this.instance.onlyRequired(onlyRequired); + return this; + } + + /** + * returns a built RequiredAndNullable instance. + * + * The builder is not reusable (NullPointerException) + */ + public RequiredAndNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static RequiredAndNullable.Builder builder() { + return new RequiredAndNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public RequiredAndNullable.Builder toBuilder() { + RequiredAndNullable.Builder builder = new RequiredAndNullable.Builder(); + return builder.copyOf(this); + } + +} + diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES b/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES index bc1941bdad50..617533e42f99 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES @@ -3,8 +3,10 @@ pom.xml src/main/java/org/openapitools/api/ApiUtil.java src/main/java/org/openapitools/api/FileApi.java src/main/java/org/openapitools/api/FooApi.java +src/main/java/org/openapitools/api/RequiredAndNullableApi.java src/main/java/org/openapitools/api/UploadApi.java src/main/java/org/openapitools/api/UploadFilesApi.java src/main/java/org/openapitools/api/package-info.java src/main/java/org/openapitools/model/Foo.java +src/main/java/org/openapitools/model/RequiredAndNullable.java src/main/java/org/openapitools/model/package-info.java diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/RequiredAndNullableApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/RequiredAndNullableApi.java new file mode 100644 index 000000000000..617b12cd447c --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/RequiredAndNullableApi.java @@ -0,0 +1,83 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.25.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.RequiredAndNullable; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +@Validated +@Tag(name = "requiredAndNullable", description = "requiredAndNullable") +public interface RequiredAndNullableApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_REQUIRED_AND_NULLABLE_POST = "/requiredAndNullable"; + /** + * POST /requiredAndNullable + * + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) + * @return response (status code 200) + */ + @Operation( + operationId = "requiredAndNullablePost", + tags = { "requiredAndNullable" }, + responses = { + @ApiResponse(responseCode = "default", description = "response", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = RequiredAndNullable.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_POST, + produces = { "application/json" }, + consumes = { "application/json" } + ) + default ResponseEntity requiredAndNullablePost( + @Parameter(name = "RequiredAndNullable", description = "bodyWithRequiredAndNullableAttributes", required = true) @Valid @RequestBody RequiredAndNullable requiredAndNullable + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"str\" : \"str\", \"file\" : \"\", \"color\" : \"red\", \"onlyRequired\" : \"onlyRequired\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java index 5afb0bd73c8c..58c69d4c13ed 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java @@ -314,7 +314,7 @@ public Foo requiredDt(java.time.Instant requiredDt) { * Get requiredDt * @return requiredDt */ - @NotNull @Valid + @Valid @Schema(name = "requiredDt", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredDt") @JacksonXmlProperty(localName = "requiredDt") @@ -412,7 +412,7 @@ public Foo requiredColor(String requiredColor) { * Get requiredColor * @return requiredColor */ - @NotNull + @Schema(name = "requiredColor", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredColor") @JacksonXmlProperty(localName = "requiredColor") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java new file mode 100644 index 000000000000..492d4931a599 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -0,0 +1,265 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.jspecify.annotations.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import tools.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import tools.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import tools.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import io.swagger.v3.oas.annotations.media.Schema; + +import jakarta.xml.bind.annotation.*; + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * RequiredAndNullable + */ + +@JacksonXmlRootElement(localName = "RequiredAndNullable") +@XmlRootElement(name = "RequiredAndNullable") +@XmlAccessorType(XmlAccessType.FIELD) +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullable { + + private @Nullable String str = null; + + private org.springframework.core.io.@Nullable Resource file = null; + + private @Nullable String color = null; + + private String onlyRequired; + + public RequiredAndNullable() { + super(); + } + + /** + * Constructor with only required parameters and all parameters + */ + public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired) { + this.str = str; + this.file = file; + this.color = color; + this.onlyRequired = onlyRequired; + } + + public RequiredAndNullable str(String str) { + this.str = str; + return this; + } + + /** + * Get str + * @return str + */ + + @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("str") + @JacksonXmlProperty(localName = "str") + @XmlElement(name = "str") + public @Nullable String getStr() { + return str; + } + + @JsonProperty("str") + @JacksonXmlProperty(localName = "str") + public void setStr(@Nullable String str) { + this.str = str; + } + + public RequiredAndNullable file(org.springframework.core.io.Resource file) { + this.file = file; + return this; + } + + /** + * Get file + * @return file + */ + @Valid + @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("file") + @JacksonXmlProperty(localName = "file") + @XmlElement(name = "file") + public org.springframework.core.io.@Nullable Resource getFile() { + return file; + } + + @JsonProperty("file") + @JacksonXmlProperty(localName = "file") + public void setFile(org.springframework.core.io.@Nullable Resource file) { + this.file = file; + } + + public RequiredAndNullable color(String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + + @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("color") + @JacksonXmlProperty(localName = "color") + @XmlElement(name = "color") + public @Nullable String getColor() { + return color; + } + + @JsonProperty("color") + @JacksonXmlProperty(localName = "color") + public void setColor(@Nullable String color) { + this.color = color; + } + + public RequiredAndNullable onlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + return this; + } + + /** + * Get onlyRequired + * @return onlyRequired + */ + + @Schema(name = "onlyRequired", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("onlyRequired") + @JacksonXmlProperty(localName = "onlyRequired") + @XmlElement(name = "onlyRequired") + public String getOnlyRequired() { + return onlyRequired; + } + + @JsonProperty("onlyRequired") + @JacksonXmlProperty(localName = "onlyRequired") + public void setOnlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequiredAndNullable requiredAndNullable = (RequiredAndNullable) o; + return Objects.equals(this.str, requiredAndNullable.str) && + Objects.equals(this.file, requiredAndNullable.file) && + Objects.equals(this.color, requiredAndNullable.color) && + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + } + + @Override + public int hashCode() { + return Objects.hash(str, file, color, onlyRequired); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredAndNullable {\n"); + sb.append(" str: ").append(toIndentedString(str)).append("\n"); + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private RequiredAndNullable instance; + + public Builder() { + this(new RequiredAndNullable()); + } + + protected Builder(RequiredAndNullable instance) { + this.instance = instance; + } + + protected Builder copyOf(RequiredAndNullable value) { + this.instance.setStr(value.str); + this.instance.setFile(value.file); + this.instance.setColor(value.color); + this.instance.setOnlyRequired(value.onlyRequired); + return this; + } + + public RequiredAndNullable.Builder str(String str) { + this.instance.str(str); + return this; + } + + public RequiredAndNullable.Builder file(org.springframework.core.io.Resource file) { + this.instance.file(file); + return this; + } + + public RequiredAndNullable.Builder color(String color) { + this.instance.color(color); + return this; + } + + public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { + this.instance.onlyRequired(onlyRequired); + return this; + } + + /** + * returns a built RequiredAndNullable instance. + * + * The builder is not reusable (NullPointerException) + */ + public RequiredAndNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static RequiredAndNullable.Builder builder() { + return new RequiredAndNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public RequiredAndNullable.Builder toBuilder() { + RequiredAndNullable.Builder builder = new RequiredAndNullable.Builder(); + return builder.copyOf(this); + } + +} + From c63d561446cb78a03820fe129d7ffd67dcbe61b6 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Fri, 14 Aug 2026 17:44:18 +0200 Subject: [PATCH 02/17] Java/Spring handling of required+nullable in models --- .../docs/RequiredAndNullable.md | 16 + .../docs/RequiredAndNullableApi.md | 140 ++++++++ .../client/api/RequiredAndNullableApi.java | 289 ++++++++++++++++ .../client/model/RequiredAndNullable.java | 318 ++++++++++++++++++ .../api/RequiredAndNullableApiTest.java | 54 +++ .../client/model/RequiredAndNullableTest.java | 73 ++++ .../docs/RequiredAndNullable.md | 16 + .../docs/RequiredAndNullableApi.md | 73 ++++ .../client/api/RequiredAndNullableApi.java | 121 +++++++ .../client/model/RequiredAndNullable.java | 279 +++++++++++++++ .../api/RequiredAndNullableApiTest.java | 48 +++ .../client/model/RequiredAndNullableTest.java | 72 ++++ .../docs/RequiredAndNullable.md | 16 + .../docs/RequiredAndNullableApi.md | 73 ++++ .../client/api/RequiredAndNullableApi.java | 121 +++++++ .../client/model/RequiredAndNullable.java | 279 +++++++++++++++ .../api/RequiredAndNullableApiTest.java | 48 +++ .../client/model/RequiredAndNullableTest.java | 72 ++++ .../docs/RequiredAndNullable.md | 16 + .../docs/RequiredAndNullableApi.md | 73 ++++ .../client/api/RequiredAndNullableApi.java | 113 +++++++ .../client/model/RequiredAndNullable.java | 279 +++++++++++++++ .../api/RequiredAndNullableApiTest.java | 54 +++ .../client/model/RequiredAndNullableTest.java | 72 ++++ .../docs/RequiredAndNullable.md | 16 + .../docs/RequiredAndNullableApi.md | 73 ++++ .../client/api/RequiredAndNullableApi.java | 123 +++++++ .../client/model/RequiredAndNullable.java | 278 +++++++++++++++ .../api/RequiredAndNullableApiTest.java | 50 +++ .../client/model/RequiredAndNullableTest.java | 72 ++++ 30 files changed, 3327 insertions(+) create mode 100644 samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullable.md create mode 100644 samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullableApi.md create mode 100644 samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java create mode 100644 samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java create mode 100644 samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java create mode 100644 samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullable.md create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullableApi.md create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java create mode 100644 samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md create mode 100644 samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md create mode 100644 samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java create mode 100644 samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java create mode 100644 samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java create mode 100644 samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java create mode 100644 samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md create mode 100644 samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md create mode 100644 samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java create mode 100644 samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java create mode 100644 samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java create mode 100644 samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java diff --git a/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullable.md b/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullable.md new file mode 100644 index 000000000000..520992382bdc --- /dev/null +++ b/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullable.md @@ -0,0 +1,16 @@ + + +# RequiredAndNullable + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**str** | **String** | | | +|**_file** | **File** | | | +|**color** | **String** | | | +|**onlyRequired** | **String** | | | + + + diff --git a/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullableApi.md b/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullableApi.md new file mode 100644 index 000000000000..eaad2b9ed25c --- /dev/null +++ b/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullableApi.md @@ -0,0 +1,140 @@ +# RequiredAndNullableApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | +| [**requiredAndNullablePostWithHttpInfo**](RequiredAndNullableApi.md#requiredAndNullablePostWithHttpInfo) | **POST** /requiredAndNullable | | + + + +## requiredAndNullablePost + +> RequiredAndNullable requiredAndNullablePost(requiredAndNullable) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.RequiredAndNullableApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes + try { + RequiredAndNullable result = apiInstance.requiredAndNullablePost(requiredAndNullable); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullablePost"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredAndNullable** | [**RequiredAndNullable**](RequiredAndNullable.md)| bodyWithRequiredAndNullableAttributes | | + +### Return type + +[**RequiredAndNullable**](RequiredAndNullable.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + +## requiredAndNullablePostWithHttpInfo + +> ApiResponse requiredAndNullablePostWithHttpInfo(requiredAndNullable) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.RequiredAndNullableApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes + try { + ApiResponse response = apiInstance.requiredAndNullablePostWithHttpInfo(requiredAndNullable); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullablePost"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredAndNullable** | [**RequiredAndNullable**](RequiredAndNullable.md)| bodyWithRequiredAndNullableAttributes | | + +### Return type + +ApiResponse<[**RequiredAndNullable**](RequiredAndNullable.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java new file mode 100644 index 000000000000..ded956fa8c44 --- /dev/null +++ b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java @@ -0,0 +1,289 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import org.openapitools.client.model.RequiredAndNullable; + +import tools.jackson.core.JacksonException; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.ObjectMapper; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullableApi { + /** + * Utility class for extending HttpRequest.Builder functionality. + */ + private static class HttpRequestBuilderExtensions { + /** + * Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers. + * + * @param builder the HttpRequest.Builder to which headers will be added + * @param headers a map of header names and values to add; may be null + * @return the same HttpRequest.Builder instance with the additional headers set + */ + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public RequiredAndNullableApi() { + this(Configuration.getDefaultApiClient()); + } + + public RequiredAndNullableApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + protected ApiException getApiException(String operationId, HttpResponse response) throws IOException { + InputStream responseBody = ApiClient.getResponseBody(response); + String body = null; + try { + body = responseBody == null ? null : new String(responseBody.readAllBytes()); + } finally { + if (responseBody != null) { + responseBody.close(); + } + } + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Download file from the given response. + * + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(HttpResponse response, InputStream responseBody) throws ApiException { + if (responseBody == null) { + throw new ApiException(new IOException("Response body is empty")); + } + try { + File file = prepareDownloadFile(response); + java.nio.file.Files.copy(responseBody, file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + *

Prepare the file for download from the response.

+ * + * @param response a {@link java.net.http.HttpResponse} object. + * @return a {@link java.io.File} object. + * @throws java.io.IOException if any. + */ + private File prepareDownloadFile(HttpResponse response) throws IOException { + String filename = null; + java.util.Optional contentDisposition = response.headers().firstValue("Content-Disposition"); + if (contentDisposition.isPresent() && !"".equals(contentDisposition.get())) { + // Get filename from the Content-Disposition header. + java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + java.util.regex.Matcher matcher = pattern.matcher(contentDisposition.get()); + if (matcher.find()) + filename = matcher.group(1); + } + File file = null; + if (filename != null) { + java.nio.file.Path tempDir = java.nio.file.Files.createTempDirectory("swagger-gen-native"); + java.nio.file.Path filePath = java.nio.file.Files.createFile(tempDir.resolve(filename)); + file = filePath.toFile(); + tempDir.toFile().deleteOnExit(); // best effort cleanup + file.deleteOnExit(); // best effort cleanup + } else { + file = java.nio.file.Files.createTempFile("download-", "").toFile(); + file.deleteOnExit(); // best effort cleanup + } + return file; + } + + /** + * + * + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) + * @return RequiredAndNullable + * @throws ApiException if fails to make API call + */ + public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredAndNullable) throws ApiException { + return requiredAndNullablePost(requiredAndNullable, null); + } + + /** + * + * + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) + * @param headers Optional headers to include in the request + * @return RequiredAndNullable + * @throws ApiException if fails to make API call + */ + public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredAndNullable, Map headers) throws ApiException { + ApiResponse localVarResponse = requiredAndNullablePostWithHttpInfo(requiredAndNullable, headers); + return localVarResponse.getData(); + } + + /** + * + * + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) + * @return ApiResponse<RequiredAndNullable> + * @throws ApiException if fails to make API call + */ + public ApiResponse requiredAndNullablePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws ApiException { + return requiredAndNullablePostWithHttpInfo(requiredAndNullable, null); + } + + /** + * + * + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<RequiredAndNullable> + * @throws ApiException if fails to make API call + */ + public ApiResponse requiredAndNullablePostWithHttpInfo(RequiredAndNullable requiredAndNullable, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = requiredAndNullablePostRequestBuilder(requiredAndNullable, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + InputStream localVarResponseBody = null; + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("requiredAndNullablePost", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + RequiredAndNullable responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException | JacksonException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder requiredAndNullablePostRequestBuilder(RequiredAndNullable requiredAndNullable, Map headers) throws ApiException { + // verify the required parameter 'requiredAndNullable' is set + if (requiredAndNullable == null) { + throw new ApiException(400, "Missing the required parameter 'requiredAndNullable' when calling requiredAndNullablePost"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/requiredAndNullable"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(requiredAndNullable); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (JacksonException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java new file mode 100644 index 000000000000..0337517f8490 --- /dev/null +++ b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -0,0 +1,318 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import java.util.Arrays; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * RequiredAndNullable + */ +@JsonPropertyOrder({ + RequiredAndNullable.JSON_PROPERTY_STR, + RequiredAndNullable.JSON_PROPERTY_FILE, + RequiredAndNullable.JSON_PROPERTY_COLOR, + RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullable { + public static final String JSON_PROPERTY_STR = "str"; + + private @Nullable String str; + + public static final String JSON_PROPERTY_FILE = "file"; + + private @Nullable File _file; + + public static final String JSON_PROPERTY_COLOR = "color"; + + private @Nullable String color = "red"; + + public static final String JSON_PROPERTY_ONLY_REQUIRED = "onlyRequired"; + + private String onlyRequired; + + public RequiredAndNullable() { + } + + public RequiredAndNullable str(@Nullable String str) { + this.str = str; + return this; + } + + /** + * Get str + * @return str + */ + + @JsonProperty(value = JSON_PROPERTY_STR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public @Nullable String getStr() { + return str; + } + + + @JsonProperty(value = JSON_PROPERTY_STR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStr(@Nullable String str) { + this.str = str; + } + + + public RequiredAndNullable _file(@Nullable File _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public @Nullable File getFile() { + return _file; + } + + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setFile(@Nullable File _file) { + this._file = _file; + } + + + public RequiredAndNullable color(@Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public @Nullable String getColor() { + return color; + } + + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setColor(@Nullable String color) { + this.color = color; + } + + + public RequiredAndNullable onlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + return this; + } + + /** + * Get onlyRequired + * @return onlyRequired + */ + + @JsonProperty(value = JSON_PROPERTY_ONLY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getOnlyRequired() { + return onlyRequired; + } + + + @JsonProperty(value = JSON_PROPERTY_ONLY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setOnlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + } + + + /** + * Return true if this RequiredAndNullable object is equal to o. + */ + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredAndNullable {\n"); + sb.append(" str: ").append(toIndentedString(str)).append("\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `str` to the URL query string + if (getStr() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sstr%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStr())))); + } + + // add `file` to the URL query string + if (getFile() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sfile%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getFile())))); + } + + // add `color` to the URL query string + if (getColor() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%scolor%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getColor())))); + } + + // add `onlyRequired` to the URL query string + if (getOnlyRequired() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sonlyRequired%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getOnlyRequired())))); + } + + return joiner.toString(); + } + + public static class Builder { + + private RequiredAndNullable instance; + + public Builder() { + this(new RequiredAndNullable()); + } + + protected Builder(RequiredAndNullable instance) { + this.instance = instance; + } + + public RequiredAndNullable.Builder str(String str) { + this.instance.str = str; + return this; + } + public RequiredAndNullable.Builder _file(File _file) { + this.instance._file = _file; + return this; + } + public RequiredAndNullable.Builder color(String color) { + this.instance.color = color; + return this; + } + public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { + this.instance.onlyRequired = onlyRequired; + return this; + } + + + /** + * returns a built RequiredAndNullable instance. + * + * The builder is not reusable. + */ + public RequiredAndNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static RequiredAndNullable.Builder builder() { + return new RequiredAndNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public RequiredAndNullable.Builder toBuilder() { + return new RequiredAndNullable.Builder() + .str(getStr()) + ._file(getFile()) + .color(getColor()) + .onlyRequired(getOnlyRequired()); + } + +} + diff --git a/samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java b/samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java new file mode 100644 index 000000000000..e978305a1590 --- /dev/null +++ b/samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java @@ -0,0 +1,54 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.RequiredAndNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * API tests for RequiredAndNullableApi + */ +@Disabled +public class RequiredAndNullableApiTest { + + private final RequiredAndNullableApi api = new RequiredAndNullableApi(); + + + /** + * + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void requiredAndNullablePostTest() throws ApiException { + RequiredAndNullable requiredAndNullable = null; + RequiredAndNullable response = + api.requiredAndNullablePost(requiredAndNullable); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java b/samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java new file mode 100644 index 000000000000..15c3a3b980b5 --- /dev/null +++ b/samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java @@ -0,0 +1,73 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import java.util.Arrays; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for RequiredAndNullable + */ +class RequiredAndNullableTest { + private final RequiredAndNullable model = new RequiredAndNullable(); + + /** + * Model tests for RequiredAndNullable + */ + @Test + void testRequiredAndNullable() { + // TODO: test RequiredAndNullable + } + + /** + * Test the property 'str' + */ + @Test + void strTest() { + // TODO: test str + } + + /** + * Test the property '_file' + */ + @Test + void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'color' + */ + @Test + void colorTest() { + // TODO: test color + } + + /** + * Test the property 'onlyRequired' + */ + @Test + void onlyRequiredTest() { + // TODO: test onlyRequired + } + +} diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullable.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullable.md new file mode 100644 index 000000000000..520992382bdc --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullable.md @@ -0,0 +1,16 @@ + + +# RequiredAndNullable + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**str** | **String** | | | +|**_file** | **File** | | | +|**color** | **String** | | | +|**onlyRequired** | **String** | | | + + + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullableApi.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullableApi.md new file mode 100644 index 000000000000..ada434bf0b9e --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullableApi.md @@ -0,0 +1,73 @@ +# RequiredAndNullableApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | + + + +## requiredAndNullablePost + +> RequiredAndNullable requiredAndNullablePost(requiredAndNullable) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.RequiredAndNullableApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes + try { + RequiredAndNullable result = apiInstance.requiredAndNullablePost(requiredAndNullable); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullablePost"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredAndNullable** | [**RequiredAndNullable**](RequiredAndNullable.md)| bodyWithRequiredAndNullableAttributes | | + +### Return type + +[**RequiredAndNullable**](RequiredAndNullable.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java new file mode 100644 index 000000000000..cc0e7c9ca9fa --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java @@ -0,0 +1,121 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; + +import org.openapitools.client.model.RequiredAndNullable; + +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Arrays; +import java.util.stream.Collectors; + +import org.springframework.core.io.FileSystemResource; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClient.ResponseSpec; +import org.springframework.web.client.RestClientResponseException; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullableApi { + private ApiClient apiClient; + + public RequiredAndNullableApi() { + this(new ApiClient()); + } + + public RequiredAndNullableApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return RequiredAndNullable + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec requiredAndNullablePostRequestCreation(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + Object postBody = requiredAndNullable; + // verify the required parameter 'requiredAndNullable' is set + if (requiredAndNullable == null) { + throw new RestClientResponseException("Missing the required parameter 'requiredAndNullable' when calling requiredAndNullablePost", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap<>(); + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + final String[] localVarAccepts = { + "application/json" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.POST, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return RequiredAndNullable + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return requiredAndNullablePostRequestCreation(requiredAndNullable).body(localVarReturnType); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return ResponseEntity<RequiredAndNullable> + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity requiredAndNullablePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return requiredAndNullablePostRequestCreation(requiredAndNullable).toEntity(localVarReturnType); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec requiredAndNullablePostWithResponseSpec(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + return requiredAndNullablePostRequestCreation(requiredAndNullable); + } +} diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java new file mode 100644 index 000000000000..2ba77f94e2b7 --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -0,0 +1,279 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * RequiredAndNullable + */ +@JsonPropertyOrder({ + RequiredAndNullable.JSON_PROPERTY_STR, + RequiredAndNullable.JSON_PROPERTY_FILE, + RequiredAndNullable.JSON_PROPERTY_COLOR, + RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullable { + public static final String JSON_PROPERTY_STR = "str"; + + private @Nullable String str; + + public static final String JSON_PROPERTY_FILE = "file"; + + private @Nullable File _file; + + public static final String JSON_PROPERTY_COLOR = "color"; + + private @Nullable String color = "red"; + + public static final String JSON_PROPERTY_ONLY_REQUIRED = "onlyRequired"; + + private String onlyRequired; + + public RequiredAndNullable() { + } + + /** + * Constructor with all args parameters + */ + public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired) { + this.str = str; + this._file = _file; + this.color = color; + this.onlyRequired = onlyRequired; + } + + public RequiredAndNullable str(@Nullable String str) { + + this.str = str; + return this; + } + + /** + * Get str + * @return str + */ + + @JsonProperty(value = JSON_PROPERTY_STR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable String getStr() { + return str; + } + + + @JsonProperty(value = JSON_PROPERTY_STR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStr(@Nullable String str) { + this.str = str; + } + + public RequiredAndNullable _file(@Nullable File _file) { + + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable File getFile() { + return _file; + } + + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setFile(@Nullable File _file) { + this._file = _file; + } + + public RequiredAndNullable color(@Nullable String color) { + + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable String getColor() { + return color; + } + + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setColor(@Nullable String color) { + this.color = color; + } + + public RequiredAndNullable onlyRequired(String onlyRequired) { + + this.onlyRequired = onlyRequired; + return this; + } + + /** + * Get onlyRequired + * @return onlyRequired + */ + + @JsonProperty(value = JSON_PROPERTY_ONLY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getOnlyRequired() { + return onlyRequired; + } + + + @JsonProperty(value = JSON_PROPERTY_ONLY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setOnlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequiredAndNullable requiredAndNullable = (RequiredAndNullable) o; + return Objects.equals(this.str, requiredAndNullable.str) && + Objects.equals(this._file, requiredAndNullable._file) && + Objects.equals(this.color, requiredAndNullable.color) && + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + } + + @Override + public int hashCode() { + return Objects.hash(str, _file, color, onlyRequired); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredAndNullable {\n"); + sb.append(" str: ").append(toIndentedString(str)).append("\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private RequiredAndNullable instance; + + public Builder() { + this(new RequiredAndNullable()); + } + + protected Builder(RequiredAndNullable instance) { + this.instance = instance; + } + + public RequiredAndNullable.Builder str(String str) { + this.instance.str = str; + return this; + } + public RequiredAndNullable.Builder _file(File _file) { + this.instance._file = _file; + return this; + } + public RequiredAndNullable.Builder color(String color) { + this.instance.color = color; + return this; + } + public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { + this.instance.onlyRequired = onlyRequired; + return this; + } + + + /** + * returns a built RequiredAndNullable instance. + * + * The builder is not reusable. + */ + public RequiredAndNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static RequiredAndNullable.Builder builder() { + return new RequiredAndNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public RequiredAndNullable.Builder toBuilder() { + return new RequiredAndNullable.Builder() + .str(getStr()) + ._file(getFile()) + .color(getColor()) + .onlyRequired(getOnlyRequired()); + } + + +} + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java new file mode 100644 index 000000000000..41e971ae1aa5 --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java @@ -0,0 +1,48 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.model.RequiredAndNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * API tests for RequiredAndNullableApi + */ +@Disabled +public class RequiredAndNullableApiTest { + + private final RequiredAndNullableApi api = new RequiredAndNullableApi(); + + + /** + * + * + * + */ + @Test + public void requiredAndNullablePostTest() { + RequiredAndNullable requiredAndNullable = null; + RequiredAndNullable response = api.requiredAndNullablePost(requiredAndNullable); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java new file mode 100644 index 000000000000..3d3388460faf --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java @@ -0,0 +1,72 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for RequiredAndNullable + */ +class RequiredAndNullableTest { + private final RequiredAndNullable model = new RequiredAndNullable(); + + /** + * Model tests for RequiredAndNullable + */ + @Test + void testRequiredAndNullable() { + // TODO: test RequiredAndNullable + } + + /** + * Test the property 'str' + */ + @Test + void strTest() { + // TODO: test str + } + + /** + * Test the property '_file' + */ + @Test + void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'color' + */ + @Test + void colorTest() { + // TODO: test color + } + + /** + * Test the property 'onlyRequired' + */ + @Test + void onlyRequiredTest() { + // TODO: test onlyRequired + } + +} diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md new file mode 100644 index 000000000000..520992382bdc --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md @@ -0,0 +1,16 @@ + + +# RequiredAndNullable + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**str** | **String** | | | +|**_file** | **File** | | | +|**color** | **String** | | | +|**onlyRequired** | **String** | | | + + + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md new file mode 100644 index 000000000000..ada434bf0b9e --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md @@ -0,0 +1,73 @@ +# RequiredAndNullableApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | + + + +## requiredAndNullablePost + +> RequiredAndNullable requiredAndNullablePost(requiredAndNullable) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.RequiredAndNullableApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes + try { + RequiredAndNullable result = apiInstance.requiredAndNullablePost(requiredAndNullable); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullablePost"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredAndNullable** | [**RequiredAndNullable**](RequiredAndNullable.md)| bodyWithRequiredAndNullableAttributes | | + +### Return type + +[**RequiredAndNullable**](RequiredAndNullable.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java new file mode 100644 index 000000000000..cc0e7c9ca9fa --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java @@ -0,0 +1,121 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; + +import org.openapitools.client.model.RequiredAndNullable; + +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Arrays; +import java.util.stream.Collectors; + +import org.springframework.core.io.FileSystemResource; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClient.ResponseSpec; +import org.springframework.web.client.RestClientResponseException; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullableApi { + private ApiClient apiClient; + + public RequiredAndNullableApi() { + this(new ApiClient()); + } + + public RequiredAndNullableApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return RequiredAndNullable + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec requiredAndNullablePostRequestCreation(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + Object postBody = requiredAndNullable; + // verify the required parameter 'requiredAndNullable' is set + if (requiredAndNullable == null) { + throw new RestClientResponseException("Missing the required parameter 'requiredAndNullable' when calling requiredAndNullablePost", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap<>(); + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + final String[] localVarAccepts = { + "application/json" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.POST, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return RequiredAndNullable + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return requiredAndNullablePostRequestCreation(requiredAndNullable).body(localVarReturnType); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return ResponseEntity<RequiredAndNullable> + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity requiredAndNullablePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return requiredAndNullablePostRequestCreation(requiredAndNullable).toEntity(localVarReturnType); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec requiredAndNullablePostWithResponseSpec(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + return requiredAndNullablePostRequestCreation(requiredAndNullable); + } +} diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java new file mode 100644 index 000000000000..2ba77f94e2b7 --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -0,0 +1,279 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * RequiredAndNullable + */ +@JsonPropertyOrder({ + RequiredAndNullable.JSON_PROPERTY_STR, + RequiredAndNullable.JSON_PROPERTY_FILE, + RequiredAndNullable.JSON_PROPERTY_COLOR, + RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullable { + public static final String JSON_PROPERTY_STR = "str"; + + private @Nullable String str; + + public static final String JSON_PROPERTY_FILE = "file"; + + private @Nullable File _file; + + public static final String JSON_PROPERTY_COLOR = "color"; + + private @Nullable String color = "red"; + + public static final String JSON_PROPERTY_ONLY_REQUIRED = "onlyRequired"; + + private String onlyRequired; + + public RequiredAndNullable() { + } + + /** + * Constructor with all args parameters + */ + public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired) { + this.str = str; + this._file = _file; + this.color = color; + this.onlyRequired = onlyRequired; + } + + public RequiredAndNullable str(@Nullable String str) { + + this.str = str; + return this; + } + + /** + * Get str + * @return str + */ + + @JsonProperty(value = JSON_PROPERTY_STR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable String getStr() { + return str; + } + + + @JsonProperty(value = JSON_PROPERTY_STR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStr(@Nullable String str) { + this.str = str; + } + + public RequiredAndNullable _file(@Nullable File _file) { + + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable File getFile() { + return _file; + } + + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setFile(@Nullable File _file) { + this._file = _file; + } + + public RequiredAndNullable color(@Nullable String color) { + + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable String getColor() { + return color; + } + + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setColor(@Nullable String color) { + this.color = color; + } + + public RequiredAndNullable onlyRequired(String onlyRequired) { + + this.onlyRequired = onlyRequired; + return this; + } + + /** + * Get onlyRequired + * @return onlyRequired + */ + + @JsonProperty(value = JSON_PROPERTY_ONLY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getOnlyRequired() { + return onlyRequired; + } + + + @JsonProperty(value = JSON_PROPERTY_ONLY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setOnlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequiredAndNullable requiredAndNullable = (RequiredAndNullable) o; + return Objects.equals(this.str, requiredAndNullable.str) && + Objects.equals(this._file, requiredAndNullable._file) && + Objects.equals(this.color, requiredAndNullable.color) && + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + } + + @Override + public int hashCode() { + return Objects.hash(str, _file, color, onlyRequired); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredAndNullable {\n"); + sb.append(" str: ").append(toIndentedString(str)).append("\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private RequiredAndNullable instance; + + public Builder() { + this(new RequiredAndNullable()); + } + + protected Builder(RequiredAndNullable instance) { + this.instance = instance; + } + + public RequiredAndNullable.Builder str(String str) { + this.instance.str = str; + return this; + } + public RequiredAndNullable.Builder _file(File _file) { + this.instance._file = _file; + return this; + } + public RequiredAndNullable.Builder color(String color) { + this.instance.color = color; + return this; + } + public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { + this.instance.onlyRequired = onlyRequired; + return this; + } + + + /** + * returns a built RequiredAndNullable instance. + * + * The builder is not reusable. + */ + public RequiredAndNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static RequiredAndNullable.Builder builder() { + return new RequiredAndNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public RequiredAndNullable.Builder toBuilder() { + return new RequiredAndNullable.Builder() + .str(getStr()) + ._file(getFile()) + .color(getColor()) + .onlyRequired(getOnlyRequired()); + } + + +} + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java new file mode 100644 index 000000000000..41e971ae1aa5 --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java @@ -0,0 +1,48 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.model.RequiredAndNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * API tests for RequiredAndNullableApi + */ +@Disabled +public class RequiredAndNullableApiTest { + + private final RequiredAndNullableApi api = new RequiredAndNullableApi(); + + + /** + * + * + * + */ + @Test + public void requiredAndNullablePostTest() { + RequiredAndNullable requiredAndNullable = null; + RequiredAndNullable response = api.requiredAndNullablePost(requiredAndNullable); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java new file mode 100644 index 000000000000..3d3388460faf --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java @@ -0,0 +1,72 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for RequiredAndNullable + */ +class RequiredAndNullableTest { + private final RequiredAndNullable model = new RequiredAndNullable(); + + /** + * Model tests for RequiredAndNullable + */ + @Test + void testRequiredAndNullable() { + // TODO: test RequiredAndNullable + } + + /** + * Test the property 'str' + */ + @Test + void strTest() { + // TODO: test str + } + + /** + * Test the property '_file' + */ + @Test + void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'color' + */ + @Test + void colorTest() { + // TODO: test color + } + + /** + * Test the property 'onlyRequired' + */ + @Test + void onlyRequiredTest() { + // TODO: test onlyRequired + } + +} diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md new file mode 100644 index 000000000000..520992382bdc --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md @@ -0,0 +1,16 @@ + + +# RequiredAndNullable + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**str** | **String** | | | +|**_file** | **File** | | | +|**color** | **String** | | | +|**onlyRequired** | **String** | | | + + + diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md new file mode 100644 index 000000000000..ada434bf0b9e --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md @@ -0,0 +1,73 @@ +# RequiredAndNullableApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | + + + +## requiredAndNullablePost + +> RequiredAndNullable requiredAndNullablePost(requiredAndNullable) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.RequiredAndNullableApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes + try { + RequiredAndNullable result = apiInstance.requiredAndNullablePost(requiredAndNullable); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullablePost"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredAndNullable** | [**RequiredAndNullable**](RequiredAndNullable.md)| bodyWithRequiredAndNullableAttributes | | + +### Return type + +[**RequiredAndNullable**](RequiredAndNullable.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java new file mode 100644 index 000000000000..7778cdd5c5aa --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java @@ -0,0 +1,113 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.BaseApi; + +import org.openapitools.client.model.RequiredAndNullable; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.core.io.FileSystemResource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullableApi extends BaseApi { + + public RequiredAndNullableApi() { + super(new ApiClient()); + } + + public RequiredAndNullableApi(ApiClient apiClient) { + super(apiClient); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) + * @return RequiredAndNullable + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredAndNullable) throws RestClientException { + return requiredAndNullablePostWithHttpInfo(requiredAndNullable).getBody(); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) + * @return ResponseEntity<RequiredAndNullable> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity requiredAndNullablePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws RestClientException { + Object localVarPostBody = requiredAndNullable; + + // verify the required parameter 'requiredAndNullable' is set + if (requiredAndNullable == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'requiredAndNullable' when calling requiredAndNullablePost"); + } + + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); + final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.POST, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); + } + + @Override + public ResponseEntity invokeAPI(String url, HttpMethod method, Object request, ParameterizedTypeReference returnType) throws RestClientException { + String localVarPath = url.replace(apiClient.getBasePath(), ""); + Object localVarPostBody = request; + + final Map uriVariables = new HashMap(); + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); + final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI(localVarPath, method, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, returnType); + } +} diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java new file mode 100644 index 000000000000..2ba77f94e2b7 --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -0,0 +1,279 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * RequiredAndNullable + */ +@JsonPropertyOrder({ + RequiredAndNullable.JSON_PROPERTY_STR, + RequiredAndNullable.JSON_PROPERTY_FILE, + RequiredAndNullable.JSON_PROPERTY_COLOR, + RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullable { + public static final String JSON_PROPERTY_STR = "str"; + + private @Nullable String str; + + public static final String JSON_PROPERTY_FILE = "file"; + + private @Nullable File _file; + + public static final String JSON_PROPERTY_COLOR = "color"; + + private @Nullable String color = "red"; + + public static final String JSON_PROPERTY_ONLY_REQUIRED = "onlyRequired"; + + private String onlyRequired; + + public RequiredAndNullable() { + } + + /** + * Constructor with all args parameters + */ + public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired) { + this.str = str; + this._file = _file; + this.color = color; + this.onlyRequired = onlyRequired; + } + + public RequiredAndNullable str(@Nullable String str) { + + this.str = str; + return this; + } + + /** + * Get str + * @return str + */ + + @JsonProperty(value = JSON_PROPERTY_STR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable String getStr() { + return str; + } + + + @JsonProperty(value = JSON_PROPERTY_STR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStr(@Nullable String str) { + this.str = str; + } + + public RequiredAndNullable _file(@Nullable File _file) { + + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable File getFile() { + return _file; + } + + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setFile(@Nullable File _file) { + this._file = _file; + } + + public RequiredAndNullable color(@Nullable String color) { + + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable String getColor() { + return color; + } + + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setColor(@Nullable String color) { + this.color = color; + } + + public RequiredAndNullable onlyRequired(String onlyRequired) { + + this.onlyRequired = onlyRequired; + return this; + } + + /** + * Get onlyRequired + * @return onlyRequired + */ + + @JsonProperty(value = JSON_PROPERTY_ONLY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getOnlyRequired() { + return onlyRequired; + } + + + @JsonProperty(value = JSON_PROPERTY_ONLY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setOnlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequiredAndNullable requiredAndNullable = (RequiredAndNullable) o; + return Objects.equals(this.str, requiredAndNullable.str) && + Objects.equals(this._file, requiredAndNullable._file) && + Objects.equals(this.color, requiredAndNullable.color) && + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + } + + @Override + public int hashCode() { + return Objects.hash(str, _file, color, onlyRequired); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredAndNullable {\n"); + sb.append(" str: ").append(toIndentedString(str)).append("\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private RequiredAndNullable instance; + + public Builder() { + this(new RequiredAndNullable()); + } + + protected Builder(RequiredAndNullable instance) { + this.instance = instance; + } + + public RequiredAndNullable.Builder str(String str) { + this.instance.str = str; + return this; + } + public RequiredAndNullable.Builder _file(File _file) { + this.instance._file = _file; + return this; + } + public RequiredAndNullable.Builder color(String color) { + this.instance.color = color; + return this; + } + public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { + this.instance.onlyRequired = onlyRequired; + return this; + } + + + /** + * returns a built RequiredAndNullable instance. + * + * The builder is not reusable. + */ + public RequiredAndNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static RequiredAndNullable.Builder builder() { + return new RequiredAndNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public RequiredAndNullable.Builder toBuilder() { + return new RequiredAndNullable.Builder() + .str(getStr()) + ._file(getFile()) + .color(getColor()) + .onlyRequired(getOnlyRequired()); + } + + +} + diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java new file mode 100644 index 000000000000..e082ae37e368 --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java @@ -0,0 +1,54 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.model.RequiredAndNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.web.client.RestClientException; + +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for RequiredAndNullableApi + */ +@Disabled +class RequiredAndNullableApiTest { + + private final RequiredAndNullableApi api = new RequiredAndNullableApi(); + + + /** + * + * + * + * + * @throws RestClientException + * if the Api call fails + */ + @Test + void requiredAndNullablePostTest() { + RequiredAndNullable requiredAndNullable = null; + + RequiredAndNullable response = api.requiredAndNullablePost(requiredAndNullable); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java new file mode 100644 index 000000000000..3d3388460faf --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java @@ -0,0 +1,72 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for RequiredAndNullable + */ +class RequiredAndNullableTest { + private final RequiredAndNullable model = new RequiredAndNullable(); + + /** + * Model tests for RequiredAndNullable + */ + @Test + void testRequiredAndNullable() { + // TODO: test RequiredAndNullable + } + + /** + * Test the property 'str' + */ + @Test + void strTest() { + // TODO: test str + } + + /** + * Test the property '_file' + */ + @Test + void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'color' + */ + @Test + void colorTest() { + // TODO: test color + } + + /** + * Test the property 'onlyRequired' + */ + @Test + void onlyRequiredTest() { + // TODO: test onlyRequired + } + +} diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md new file mode 100644 index 000000000000..520992382bdc --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md @@ -0,0 +1,16 @@ + + +# RequiredAndNullable + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**str** | **String** | | | +|**_file** | **File** | | | +|**color** | **String** | | | +|**onlyRequired** | **String** | | | + + + diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md new file mode 100644 index 000000000000..ada434bf0b9e --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md @@ -0,0 +1,73 @@ +# RequiredAndNullableApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | + + + +## requiredAndNullablePost + +> RequiredAndNullable requiredAndNullablePost(requiredAndNullable) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.RequiredAndNullableApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes + try { + RequiredAndNullable result = apiInstance.requiredAndNullablePost(requiredAndNullable); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullablePost"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredAndNullable** | [**RequiredAndNullable**](RequiredAndNullable.md)| bodyWithRequiredAndNullableAttributes | | + +### Return type + +[**RequiredAndNullable**](RequiredAndNullable.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java new file mode 100644 index 000000000000..502a694520af --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java @@ -0,0 +1,123 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; + +import org.openapitools.client.model.RequiredAndNullable; + +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Arrays; +import java.util.stream.Collectors; + +import org.springframework.core.io.FileSystemResource; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.reactive.function.client.WebClient.ResponseSpec; +import org.springframework.web.reactive.function.client.WebClientResponseException; +import reactor.core.publisher.Mono; +import reactor.core.publisher.Flux; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullableApi { + private ApiClient apiClient; + + public RequiredAndNullableApi() { + this(new ApiClient()); + } + + public RequiredAndNullableApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return RequiredAndNullable + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec requiredAndNullablePostRequestCreation(RequiredAndNullable requiredAndNullable) throws WebClientResponseException { + Object postBody = requiredAndNullable; + // verify the required parameter 'requiredAndNullable' is set + if (requiredAndNullable == null) { + throw new WebClientResponseException("Missing the required parameter 'requiredAndNullable' when calling requiredAndNullablePost", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } + // create path and map variables + final Map pathParams = new HashMap(); + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + "application/json" + }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.POST, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return RequiredAndNullable + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono requiredAndNullablePost(RequiredAndNullable requiredAndNullable) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return requiredAndNullablePostRequestCreation(requiredAndNullable).bodyToMono(localVarReturnType); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return ResponseEntity<RequiredAndNullable> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> requiredAndNullablePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return requiredAndNullablePostRequestCreation(requiredAndNullable).toEntity(localVarReturnType); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec requiredAndNullablePostWithResponseSpec(RequiredAndNullable requiredAndNullable) throws WebClientResponseException { + return requiredAndNullablePostRequestCreation(requiredAndNullable); + } +} diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java new file mode 100644 index 000000000000..38d340ac1056 --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -0,0 +1,278 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * RequiredAndNullable + */ +@JsonPropertyOrder({ + RequiredAndNullable.JSON_PROPERTY_STR, + RequiredAndNullable.JSON_PROPERTY_FILE, + RequiredAndNullable.JSON_PROPERTY_COLOR, + RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class RequiredAndNullable { + public static final String JSON_PROPERTY_STR = "str"; + + private @Nullable String str; + + public static final String JSON_PROPERTY_FILE = "file"; + + private @Nullable File _file; + + public static final String JSON_PROPERTY_COLOR = "color"; + + private @Nullable String color = "red"; + + public static final String JSON_PROPERTY_ONLY_REQUIRED = "onlyRequired"; + + private String onlyRequired; + + public RequiredAndNullable() { + } + + /** + * Constructor with all args parameters + */ + public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired) { + this.str = str; + this._file = _file; + this.color = color; + this.onlyRequired = onlyRequired; + } + + public RequiredAndNullable str(@Nullable String str) { + + this.str = str; + return this; + } + + /** + * Get str + * @return str + */ + + @JsonProperty(value = JSON_PROPERTY_STR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable String getStr() { + return str; + } + + + @JsonProperty(value = JSON_PROPERTY_STR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStr(@Nullable String str) { + this.str = str; + } + + public RequiredAndNullable _file(@Nullable File _file) { + + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable File getFile() { + return _file; + } + + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setFile(@Nullable File _file) { + this._file = _file; + } + + public RequiredAndNullable color(@Nullable String color) { + + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable String getColor() { + return color; + } + + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setColor(@Nullable String color) { + this.color = color; + } + + public RequiredAndNullable onlyRequired(String onlyRequired) { + + this.onlyRequired = onlyRequired; + return this; + } + + /** + * Get onlyRequired + * @return onlyRequired + */ + + @JsonProperty(value = JSON_PROPERTY_ONLY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getOnlyRequired() { + return onlyRequired; + } + + + @JsonProperty(value = JSON_PROPERTY_ONLY_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setOnlyRequired(String onlyRequired) { + this.onlyRequired = onlyRequired; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequiredAndNullable requiredAndNullable = (RequiredAndNullable) o; + return Objects.equals(this.str, requiredAndNullable.str) && + Objects.equals(this._file, requiredAndNullable._file) && + Objects.equals(this.color, requiredAndNullable.color) && + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + } + + @Override + public int hashCode() { + return Objects.hash(str, _file, color, onlyRequired); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredAndNullable {\n"); + sb.append(" str: ").append(toIndentedString(str)).append("\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private RequiredAndNullable instance; + + public Builder() { + this(new RequiredAndNullable()); + } + + protected Builder(RequiredAndNullable instance) { + this.instance = instance; + } + + public RequiredAndNullable.Builder str(String str) { + this.instance.str = str; + return this; + } + public RequiredAndNullable.Builder _file(File _file) { + this.instance._file = _file; + return this; + } + public RequiredAndNullable.Builder color(String color) { + this.instance.color = color; + return this; + } + public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { + this.instance.onlyRequired = onlyRequired; + return this; + } + + + /** + * returns a built RequiredAndNullable instance. + * + * The builder is not reusable. + */ + public RequiredAndNullable build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static RequiredAndNullable.Builder builder() { + return new RequiredAndNullable.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public RequiredAndNullable.Builder toBuilder() { + return new RequiredAndNullable.Builder() + .str(getStr()) + ._file(getFile()) + .color(getColor()) + .onlyRequired(getOnlyRequired()); + } + + +} + diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java new file mode 100644 index 000000000000..5adf56d29694 --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java @@ -0,0 +1,50 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.model.RequiredAndNullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * API tests for RequiredAndNullableApi + */ +@Disabled +public class RequiredAndNullableApiTest { + + private final RequiredAndNullableApi api = new RequiredAndNullableApi(); + + + /** + * + * + * + */ + @Test + public void requiredAndNullablePostTest() { + // uncomment below to test the function + //RequiredAndNullable requiredAndNullable = null; + //RequiredAndNullable response = api.requiredAndNullablePost(requiredAndNullable).block(); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java new file mode 100644 index 000000000000..3d3388460faf --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/RequiredAndNullableTest.java @@ -0,0 +1,72 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for RequiredAndNullable + */ +class RequiredAndNullableTest { + private final RequiredAndNullable model = new RequiredAndNullable(); + + /** + * Model tests for RequiredAndNullable + */ + @Test + void testRequiredAndNullable() { + // TODO: test RequiredAndNullable + } + + /** + * Test the property 'str' + */ + @Test + void strTest() { + // TODO: test str + } + + /** + * Test the property '_file' + */ + @Test + void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'color' + */ + @Test + void colorTest() { + // TODO: test color + } + + /** + * Test the property 'onlyRequired' + */ + @Test + void onlyRequiredTest() { + // TODO: test onlyRequired + } + +} From 2900028ac47accc9379ce3769200a645dfca8ca7 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Fri, 14 Aug 2026 17:58:36 +0200 Subject: [PATCH 03/17] Remove @NotNull under jspecify --- .../JavaSpring/beanValidation.mustache | 2 +- .../main/resources/JavaSpring/pojo.mustache | 2 ++ .../java/spring/SpringCodegenTest.java | 24 +++++-------------- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/beanValidation.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/beanValidation.mustache index 0aed4a92d734..4f157d0bf627 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/beanValidation.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/beanValidation.mustache @@ -1 +1 @@ -{{#required}}{{^isReadOnly}}@NotNull {{/isReadOnly}}{{/required}}{{#isContainer}}{{^isPrimitiveType}}{{^isEnum}}@Valid {{/isEnum}}{{/isPrimitiveType}}{{/isContainer}}{{^isContainer}}{{^isPrimitiveType}}@Valid {{/isPrimitiveType}}{{/isContainer}}{{^openApiNullable}}{{>beanValidationCore}}{{/openApiNullable}}{{#openApiNullable}}{{^useOptional}}{{>beanValidationCore}}{{/useOptional}}{{/openApiNullable}}{{#useOptional}}{{#openApiNullable}}{{#isContainer}}{{^required}}{{>beanValidationCore}}{{/required}}{{/isContainer}}{{/openApiNullable}}{{#openApiNullable}}{{#required}}{{>beanValidationCore}}{{/required}}{{/openApiNullable}}{{/useOptional}} \ No newline at end of file +{{#required}}{{^useJspecify}}{{^isReadOnly}}@NotNull {{/isReadOnly}}{{/useJspecify}}{{/required}}{{#isContainer}}{{^isPrimitiveType}}{{^isEnum}}@Valid {{/isEnum}}{{/isPrimitiveType}}{{/isContainer}}{{^isContainer}}{{^isPrimitiveType}}@Valid {{/isPrimitiveType}}{{/isContainer}}{{^openApiNullable}}{{>beanValidationCore}}{{/openApiNullable}}{{#openApiNullable}}{{^useOptional}}{{>beanValidationCore}}{{/useOptional}}{{/openApiNullable}}{{#useOptional}}{{#openApiNullable}}{{#isContainer}}{{^required}}{{>beanValidationCore}}{{/required}}{{/isContainer}}{{/openApiNullable}}{{#openApiNullable}}{{#required}}{{>beanValidationCore}}{{/required}}{{/openApiNullable}}{{/useOptional}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index 7ccb29ff25b9..f17acf08b701 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -227,7 +227,9 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} {{>beanValidation}}{{! prevent indent}} {{/useBeanValidation}} {{^useBeanValidation}} + {{^useJspecify}} {{#required}}@NotNull{{/required}} + {{/useJspecify}} {{/useBeanValidation}} {{#swagger2AnnotationLibrary}} @Schema(name = "{{{baseName}}}"{{#isReadOnly}}, accessMode = Schema.AccessMode.READ_ONLY{{/isReadOnly}}{{#example}}, example = "{{{.}}}"{{/example}}{{#description}}, description = "{{{.}}}"{{/description}}{{#deprecated}}, deprecated = true{{/deprecated}}, requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 66244214cb53..ced26b6123bf 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -6095,7 +6095,7 @@ public void testCollectionTypesWithDefaults_issue_collection() throws IOExceptio } @Test - public void testDefaultForRequiredNonNullableMap() throws IOException { + public void testDefaultForRequiredonlyRequiredMap() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); output.deleteOnExit(); @@ -6115,7 +6115,7 @@ public void testDefaultForRequiredNonNullableMap() throws IOException { .collect(Collectors.toMap(File::getName, Function.identity())); JavaFileAssert.assertThat(files.get("Pet.java")) - .fileContains("private Map requiredNonNullableMap = new HashMap<>();"); + .fileContains("private Map requiredonlyRequiredMap = new HashMap<>();"); } @Test @@ -7099,14 +7099,10 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) .fileContains( "private @Nullable String str", - "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String nonNullable)", + "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired)", "@Nullable String getStr()", "void setStr(@Nullable String str)" ); - JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")) - .fileContains( - "Optional param" - ); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) @@ -7184,10 +7180,6 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) "JsonNullable getStr()", "void setStr(JsonNullable str)" ); - JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")) - .fileContains( - "Optional param" - ); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) @@ -7281,10 +7273,6 @@ public void testJspecify_useOptional(String library, int springBootVersion, bool "JsonNullable getStr()", "void setStr(JsonNullable str)" ); - JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")) - .fileContains( - "Optional param" - ); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) @@ -8517,7 +8505,7 @@ void optionalNullableField_withOpenApiNullable_hasNonAbsentAnnotation() throws I assertFileContains(modelFile, "@JsonInclude(JsonInclude.Include.NON_ABSENT)"); // JsonNullable field must be present assertFileContains(modelFile, "private JsonNullable optionalNullable"); - // NON_NULL must also be present (for optionalNonNullable fields) + // NON_NULL must also be present (for optionalonlyRequired fields) assertFileContains(modelFile, "@JsonInclude(JsonInclude.Include.NON_NULL)"); assertFileContains(modelFile, "import com.fasterxml.jackson.annotation.JsonInclude"); } @@ -8543,7 +8531,7 @@ void optionalNullableField_withoutOpenApiNullable_hasNoNonAbsentAnnotation() thr * of the openApiNullable setting. */ @Test - void optionalNonNullableField_alwaysHasNonNullAnnotation() throws IOException { + void optionalonlyRequiredField_alwaysHasNonNullAnnotation() throws IOException { Map files = generateFromContract( "src/test/resources/3_0/kotlin/required-nullable-4-states.yaml", SPRING_BOOT, @@ -8551,7 +8539,7 @@ void optionalNonNullableField_alwaysHasNonNullAnnotation() throws IOException { Path modelFile = files.get("TestModel.java").toPath(); assertFileContains(modelFile, "@JsonInclude(JsonInclude.Include.NON_NULL)"); - assertFileContains(modelFile, "private String optionalNonNullable"); + assertFileContains(modelFile, "private String optionalonlyRequired"); } @Test From a3f8be3c6a1790b96f6d1b4d7619c7c8ba8aed95 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Fri, 14 Aug 2026 21:58:35 +0200 Subject: [PATCH 04/17] merge master --- .../openapitools/codegen/java/spring/SpringCodegenTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 849b68ff8f9e..539eb0996b73 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -63,7 +63,6 @@ import static org.openapitools.codegen.TestUtils.*; import static org.openapitools.codegen.languages.AbstractJavaCodegen.GENERATE_BUILDERS; import static org.openapitools.codegen.languages.AbstractJavaCodegen.GENERATE_CONSTRUCTOR_WITH_ALL_ARGS; -import static org.openapitools.codegen.languages.JavaClientCodegen.USE_JACKSON_3; import static org.openapitools.codegen.languages.JavaClientCodegen.USE_SPRING_BOOT4; import static org.openapitools.codegen.languages.SpringCodegen.*; import static org.openapitools.codegen.languages.features.DocumentationProviderFeatures.ANNOTATION_LIBRARY; @@ -6212,7 +6211,7 @@ public void testDefaultForRequiredNonNullableMap() throws IOException { .collect(Collectors.toMap(File::getName, Function.identity())); JavaFileAssert.assertThat(files.get("Pet.java")) - .fileContains("private Map requiredonlyRequiredMap = new HashMap<>();"); + .fileContains("private Map requiredNonNullableMap = new HashMap<>();"); } @Test From b0628dc7d4fab791ecf0445f1b66dc65a504c362 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Fri, 14 Aug 2026 22:01:21 +0200 Subject: [PATCH 05/17] merge master --- .../java/org/openapitools/model/RequiredAndNullable.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java index 492d4931a599..b6c860b69945 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -2,6 +2,7 @@ import java.net.URI; import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import org.jspecify.annotations.Nullable; @@ -28,12 +29,16 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredAndNullable { + @JsonInclude(JsonInclude.Include.ALWAYS) private @Nullable String str = null; + @JsonInclude(JsonInclude.Include.ALWAYS) private org.springframework.core.io.@Nullable Resource file = null; + @JsonInclude(JsonInclude.Include.ALWAYS) private @Nullable String color = null; + @JsonInclude(JsonInclude.Include.NON_NULL) private String onlyRequired; public RequiredAndNullable() { From 7687042aa4d62408e95d6f218ba9a3ff0c15cf54 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Sat, 15 Aug 2026 12:45:15 +0200 Subject: [PATCH 06/17] new files generated --- .../java/native-jackson3-jspecify/.openapi-generator/FILES | 2 ++ .../.openapi-generator/FILES | 2 ++ .../.openapi-generator/FILES | 2 ++ .../.openapi-generator/FILES | 2 ++ .../.openapi-generator/FILES | 2 ++ .../.openapi-generator/FILES | 1 + .../springboot-4-jspecify-useOptional/.openapi-generator/FILES | 1 + .../petstore/springboot-4-jspecify/.openapi-generator/FILES | 1 + 8 files changed, 13 insertions(+) diff --git a/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES index 493dab4c9f78..b169aa1ef064 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES @@ -6,6 +6,7 @@ api/openapi.yaml build.gradle build.sbt docs/FileApi.md +docs/FileContent.md docs/Foo.md docs/FooApi.md docs/RequiredAndNullable.md @@ -37,6 +38,7 @@ src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java src/main/java/org/openapitools/client/api/UploadApi.java src/main/java/org/openapitools/client/api/package-info.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/FileContent.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/RequiredAndNullable.java src/main/java/org/openapitools/client/model/package-info.java diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/.openapi-generator/FILES b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/.openapi-generator/FILES index 91aded50dce4..a9762735bc0b 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/.openapi-generator/FILES +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/.openapi-generator/FILES @@ -6,6 +6,7 @@ api/openapi.yaml build.gradle build.sbt docs/FileApi.md +docs/FileContent.md docs/Foo.md docs/FooApi.md docs/RequiredAndNullable.md @@ -36,6 +37,7 @@ src/main/java/org/openapitools/client/auth/ApiKeyAuth.java src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/model/FileContent.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/RequiredAndNullable.java src/main/java/org/openapitools/client/model/package-info.java diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES index 91aded50dce4..a9762735bc0b 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES @@ -6,6 +6,7 @@ api/openapi.yaml build.gradle build.sbt docs/FileApi.md +docs/FileContent.md docs/Foo.md docs/FooApi.md docs/RequiredAndNullable.md @@ -36,6 +37,7 @@ src/main/java/org/openapitools/client/auth/ApiKeyAuth.java src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/model/FileContent.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/RequiredAndNullable.java src/main/java/org/openapitools/client/model/package-info.java diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES index 0779268797b7..61311fa8a555 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES @@ -6,6 +6,7 @@ api/openapi.yaml build.gradle build.sbt docs/FileApi.md +docs/FileContent.md docs/Foo.md docs/FooApi.md docs/RequiredAndNullable.md @@ -37,6 +38,7 @@ src/main/java/org/openapitools/client/auth/ApiKeyAuth.java src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/model/FileContent.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/RequiredAndNullable.java src/main/java/org/openapitools/client/model/package-info.java diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES index 35a3c1387612..821db0873c19 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES @@ -6,6 +6,7 @@ api/openapi.yaml build.gradle build.sbt docs/FileApi.md +docs/FileContent.md docs/Foo.md docs/FooApi.md docs/RequiredAndNullable.md @@ -38,6 +39,7 @@ src/main/java/org/openapitools/client/auth/ApiKeyAuth.java src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/model/FileContent.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/RequiredAndNullable.java src/main/java/org/openapitools/client/model/package-info.java diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/.openapi-generator/FILES b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/.openapi-generator/FILES index 617533e42f99..559ef9c95db3 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/.openapi-generator/FILES @@ -7,6 +7,7 @@ src/main/java/org/openapitools/api/RequiredAndNullableApi.java src/main/java/org/openapitools/api/UploadApi.java src/main/java/org/openapitools/api/UploadFilesApi.java src/main/java/org/openapitools/api/package-info.java +src/main/java/org/openapitools/model/FileContent.java src/main/java/org/openapitools/model/Foo.java src/main/java/org/openapitools/model/RequiredAndNullable.java src/main/java/org/openapitools/model/package-info.java diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/.openapi-generator/FILES b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/.openapi-generator/FILES index 617533e42f99..559ef9c95db3 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/.openapi-generator/FILES @@ -7,6 +7,7 @@ src/main/java/org/openapitools/api/RequiredAndNullableApi.java src/main/java/org/openapitools/api/UploadApi.java src/main/java/org/openapitools/api/UploadFilesApi.java src/main/java/org/openapitools/api/package-info.java +src/main/java/org/openapitools/model/FileContent.java src/main/java/org/openapitools/model/Foo.java src/main/java/org/openapitools/model/RequiredAndNullable.java src/main/java/org/openapitools/model/package-info.java diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES b/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES index 617533e42f99..559ef9c95db3 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES @@ -7,6 +7,7 @@ src/main/java/org/openapitools/api/RequiredAndNullableApi.java src/main/java/org/openapitools/api/UploadApi.java src/main/java/org/openapitools/api/UploadFilesApi.java src/main/java/org/openapitools/api/package-info.java +src/main/java/org/openapitools/model/FileContent.java src/main/java/org/openapitools/model/Foo.java src/main/java/org/openapitools/model/RequiredAndNullable.java src/main/java/org/openapitools/model/package-info.java From a79eac600d21433ff632080d046457acddbc20cc Mon Sep 17 00:00:00 2001 From: jpfinne Date: Sat, 15 Aug 2026 13:09:11 +0200 Subject: [PATCH 07/17] keep formatting, regenerate samples --- .../languages/AbstractJavaCodegen.java | 63 +++- .../codegen/languages/JavaClientCodegen.java | 4 +- .../Java/nullableArgument_builder.mustache | 2 +- .../JavaSpring/beanValidation.mustache | 2 +- .../resources/JavaSpring/notNull.mustache | 1 + .../nullableArgument_builder.mustache | 2 +- .../nullableArgument_chainSetter.mustache | 2 +- .../main/resources/JavaSpring/pojo.mustache | 4 +- .../codegen/java/JavaClientCodegenTest.java | 5 + .../java/spring/SpringCodegenTest.java | 24 +- .../src/test/resources/3_0/java/jspecify.yaml | 23 +- .../java/native-jackson3-jspecify/README.md | 4 +- .../native-jackson3-jspecify/api/openapi.yaml | 26 ++ .../native-jackson3-jspecify/docs/FileApi.md | 18 +- .../docs/FileContent.md | 24 ++ .../org/openapitools/client/api/FileApi.java | 41 ++- .../client/model/FileContent.java | 294 ++++++++++++++++++ .../client/model/RequiredAndNullable.java | 6 +- .../client/model/FileContentTest.java | 56 ++++ .../README.md | 4 +- .../api/openapi.yaml | 26 ++ .../docs/FileApi.md | 9 +- .../docs/FileContent.md | 24 ++ .../org/openapitools/client/api/FileApi.java | 20 +- .../client/model/FileContent.java | 247 +++++++++++++++ .../client/model/RequiredAndNullable.java | 6 +- .../client/model/FileContentTest.java | 55 ++++ .../README.md | 4 +- .../api/openapi.yaml | 26 ++ .../docs/FileApi.md | 9 +- .../docs/FileContent.md | 24 ++ .../org/openapitools/client/api/FileApi.java | 20 +- .../client/model/FileContent.java | 247 +++++++++++++++ .../client/model/RequiredAndNullable.java | 6 +- .../client/model/FileContentTest.java | 55 ++++ .../README.md | 4 +- .../api/openapi.yaml | 26 ++ .../docs/FileApi.md | 9 +- .../docs/FileContent.md | 24 ++ .../org/openapitools/client/api/FileApi.java | 20 +- .../client/model/FileContent.java | 247 +++++++++++++++ .../client/model/RequiredAndNullable.java | 6 +- .../client/model/FileContentTest.java | 55 ++++ .../README.md | 4 +- .../api/openapi.yaml | 26 ++ .../docs/FileApi.md | 9 +- .../docs/FileContent.md | 24 ++ .../org/openapitools/client/api/FileApi.java | 18 +- .../client/model/FileContent.java | 246 +++++++++++++++ .../client/model/RequiredAndNullable.java | 6 +- .../client/model/FileContentTest.java | 55 ++++ .../main/java/org/openapitools/model/Pet.java | 2 +- .../model/ContainerDefaultValueDto.java | 2 +- .../model/ContainerDefaultValueDto.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValueDto.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValueDto.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/api/FileApi.java | 19 +- .../org/openapitools/model/FileContent.java | 203 ++++++++++++ .../main/java/org/openapitools/model/Foo.java | 4 +- .../model/RequiredAndNullable.java | 14 +- .../java/org/openapitools/api/FileApi.java | 19 +- .../org/openapitools/model/FileContent.java | 203 ++++++++++++ .../main/java/org/openapitools/model/Foo.java | 4 +- .../model/RequiredAndNullable.java | 14 +- .../java/org/openapitools/api/FileApi.java | 19 +- .../org/openapitools/model/FileContent.java | 208 +++++++++++++ .../main/java/org/openapitools/model/Foo.java | 4 +- .../model/RequiredAndNullable.java | 14 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValueDto.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/NullableModel.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValueDto.java | 2 +- 89 files changed, 2770 insertions(+), 169 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache create mode 100644 samples/client/petstore/java/native-jackson3-jspecify/docs/FileContent.md create mode 100644 samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java create mode 100644 samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/FileContent.md create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/FileContent.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/model/FileContentTest.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/FileContent.md create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java create mode 100644 samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java create mode 100644 samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/FileContent.md create mode 100644 samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java create mode 100644 samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java create mode 100644 samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/FileContent.md create mode 100644 samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java create mode 100644 samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java create mode 100644 samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/FileContent.java create mode 100644 samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/FileContent.java create mode 100644 samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/FileContent.java diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 826ae72230cf..ba8e9cb82114 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -225,6 +225,8 @@ protected enum ENUM_PROPERTY_NAMING_TYPE {MACRO_CASE, legacy, original} @Setter protected boolean useJspecify; protected JSpecifyNullableLambda jSpecifyNullableLambda; + protected RemoveAnnotationLambda removeAnnotationLambda; + @Getter @Setter protected boolean useDeductionForOneOfInterfaces = false; @@ -706,9 +708,8 @@ public void processOpts() { } writer.write(content); }); - additionalProperties.put("removeAnnotations", (Mustache.Lambda) (fragment, writer) -> { - writer.write(removeAnnotations(fragment.execute())); - }); + this.removeAnnotationLambda = new RemoveAnnotationLambda(); + additionalProperties.put("removeAnnotations", removeAnnotationLambda); additionalProperties.put("sanitizeDataType", (Mustache.Lambda) (fragment, writer) -> { writer.write(sanitizeDataType(fragment.execute())); }); @@ -881,6 +882,8 @@ protected void applyJspecify() { (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "package-info.java")); } + // simplify mustache template for jspecify. @Nullable is kept + this.removeAnnotationLambda.keepAnnotation("@Nullable"); } @Override @@ -2076,6 +2079,7 @@ public void postProcessResponseWithProperty(CodegenResponse response, CodegenPro *

* For example: *

    + *
  • {@code @jakarta.annotation.Nullable String} -> {@code String}
  • *
  • {@code @Min(0) @Max(10)Integer} -> {@code Integer}
  • *
  • {@code @Pattern(regexp = "^[a-z]$")String>} -> {@code String}
  • *
  • {@code List<@Pattern(regexp = "^[a-z]$")String>}" -> "{@code List}"
  • @@ -2087,7 +2091,39 @@ public void postProcessResponseWithProperty(CodegenResponse response, CodegenPro */ public String removeAnnotations(String dataType) { if (dataType != null && dataType.contains("@")) { - return dataType.replaceAll("(?:(?i)@[a-z0-9]*+([(].*[)]|\\s*))*+", ""); + return dataType.replaceAll("(?:(?i)@[a-z0-9\\.]*+([(].*[)]|\\s*))*+", ""); + } + return dataType; + } + + /** + * Remove annotations from the given data type string except annotationToKeep. + *

    + * For example: + *

      + *
    • {@code @Nullable @Min(0) @Max(10)Integer} -> {@code @Nullable Integer}
    • + *
    • {@code @Nullable List<@Valid Pet>}" -> "{@code @Nullable List}"
    • + *
    + * + * @param dataType the data type string + * @param annotationToKeep annotation to keep. For example @Nullable + * @return the data type string without annotations. + */ + public String removeAnnotationsWithExlusion(String dataType, String annotationToKeep) { + if (dataType != null && dataType.contains("@")) { + if (annotationToKeep != null) { + annotationToKeep += " "; + boolean annotationPresent = annotationToKeep != null && dataType.indexOf(annotationToKeep) >=0; + if (annotationPresent) { + dataType = dataType.replace( annotationToKeep, "%%"); + } + dataType = dataType.replaceAll("(?:(?i)@[a-z0-9\\.]*+([(].*[)]|\\s*))*+", ""); + if (annotationPresent) { + dataType = dataType.replace("%%", annotationToKeep); + } + } else { + dataType = dataType.replaceAll("(?:(?i)@[a-z0-9\\.]*+([(].*[)]|\\s*))*+", ""); + } } return dataType; } @@ -2876,7 +2912,7 @@ private int getLastIndex(String dataType) { /** * for Jspecify, remove @Nullable before the datatype and set keptNullable to true if done. */ - class JSpecifyNullableLambda implements Mustache.Lambda { + protected class JSpecifyNullableLambda implements Mustache.Lambda { private String nullableAnnotation = "@Nullable"; // remember @Nullable annotation value when jspecify is used. private String keptNullable = null; @@ -2926,4 +2962,21 @@ protected void addNullableImportForOperation(CodegenOperation codegenOperation) .findAny() .ifPresent(param -> codegenOperation.imports.add("Nullable")); } + + /** + * Simplify the removeAnnotations lambda for custom removal. + */ + protected class RemoveAnnotationLambda implements Mustache.Lambda { + + private String keep; + + @Override + public void execute(Template.Fragment fragment, Writer writer) throws IOException { + writer.write(removeAnnotationsWithExlusion(fragment.execute(), keep)); + } + + public void keepAnnotation(String keep) { + this.keep = keep; + } + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 4a252d8f796a..6f6cb0af8471 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -17,6 +17,7 @@ package org.openapitools.codegen.languages; +import com.samskivert.mustache.Mustache; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.servers.Server; @@ -1411,8 +1412,9 @@ protected void applyJspecify() { (sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "package-info.java")); } + String nullableAnnotation = "@" + additionalProperties.get(JAVAX_PACKAGE) + ".annotation.Nullable"; // nullable_var_annotations.mustache generates nullable annotations as @{{javaxPackage}}.annotation.Nullable // override the default pattern for the "find and replace" - jSpecifyNullableLambda.setNullableAnnotation("@" + additionalProperties.get(JAVAX_PACKAGE) + ".annotation.Nullable"); + jSpecifyNullableLambda.setNullableAnnotation(nullableAnnotation); } } diff --git a/modules/openapi-generator/src/main/resources/Java/nullableArgument_builder.mustache b/modules/openapi-generator/src/main/resources/Java/nullableArgument_builder.mustache index de9d3628ca94..f42c447f5c80 100644 --- a/modules/openapi-generator/src/main/resources/Java/nullableArgument_builder.mustache +++ b/modules/openapi-generator/src/main/resources/Java/nullableArgument_builder.mustache @@ -1 +1 @@ -{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{^required}}@{{javaxPackage}}.annotation.Nullable {{/required}}{{/lambda.jSpecifyNullable}}{{#lambda.jSpecifyDatatype}}{{#removeAnnotations}}{{{datatypeWithEnum}}}{{/removeAnnotations}}{{/lambda.jSpecifyDatatype}}{{/useJspecify}}{{^useJspecify}}{{#removeAnnotations}}{{{datatypeWithEnum}}}{{/removeAnnotations}}{{/useJspecify}} \ No newline at end of file +{{#removeAnnotations}}{{>nullableArgumentWithEnum}}{{/removeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/beanValidation.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/beanValidation.mustache index 4f157d0bf627..325a13688611 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/beanValidation.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/beanValidation.mustache @@ -1 +1 @@ -{{#required}}{{^useJspecify}}{{^isReadOnly}}@NotNull {{/isReadOnly}}{{/useJspecify}}{{/required}}{{#isContainer}}{{^isPrimitiveType}}{{^isEnum}}@Valid {{/isEnum}}{{/isPrimitiveType}}{{/isContainer}}{{^isContainer}}{{^isPrimitiveType}}@Valid {{/isPrimitiveType}}{{/isContainer}}{{^openApiNullable}}{{>beanValidationCore}}{{/openApiNullable}}{{#openApiNullable}}{{^useOptional}}{{>beanValidationCore}}{{/useOptional}}{{/openApiNullable}}{{#useOptional}}{{#openApiNullable}}{{#isContainer}}{{^required}}{{>beanValidationCore}}{{/required}}{{/isContainer}}{{/openApiNullable}}{{#openApiNullable}}{{#required}}{{>beanValidationCore}}{{/required}}{{/openApiNullable}}{{/useOptional}} \ No newline at end of file +{{>notNull}}{{#isContainer}}{{^isPrimitiveType}}{{^isEnum}}@Valid {{/isEnum}}{{/isPrimitiveType}}{{/isContainer}}{{^isContainer}}{{^isPrimitiveType}}@Valid {{/isPrimitiveType}}{{/isContainer}}{{^openApiNullable}}{{>beanValidationCore}}{{/openApiNullable}}{{#openApiNullable}}{{^useOptional}}{{>beanValidationCore}}{{/useOptional}}{{/openApiNullable}}{{#useOptional}}{{#openApiNullable}}{{#isContainer}}{{^required}}{{>beanValidationCore}}{{/required}}{{/isContainer}}{{/openApiNullable}}{{#openApiNullable}}{{#required}}{{>beanValidationCore}}{{/required}}{{/openApiNullable}}{{/useOptional}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache new file mode 100644 index 000000000000..c74f667e8a87 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache @@ -0,0 +1 @@ +{{#required}}{{^isReadOnly}}{{^isNullable}}@NotNull {{/isNullable}}{{/isReadOnly}}{{/required}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_builder.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_builder.mustache index e42e412e8730..4327e45d9e2a 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_builder.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_builder.mustache @@ -1 +1 @@ -{{#useJspecify}}{{^required}}{{#lambda.jSpecifyNullable}}{{^useOptional}}@Nullable {{/useOptional}}{{#useOptional}}{{#optionalAcceptNullable}}@Nullable {{/optionalAcceptNullable}}{{/useOptional}}{{/lambda.jSpecifyNullable}}{{/required}}{{#lambda.jSpecifyDatatype}}{{#removeAnnotations}}{{{datatypeWithEnum}}}{{/removeAnnotations}}{{/lambda.jSpecifyDatatype}}{{/useJspecify}}{{^useJspecify}}{{#removeAnnotations}}{{{datatypeWithEnum}}}{{/removeAnnotations}}{{/useJspecify}} \ No newline at end of file +{{#removeAnnotations}}{{>nullableArgument_chainSetter}}{{/removeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_chainSetter.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_chainSetter.mustache index e2c7181c3585..a199e52ba86c 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_chainSetter.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/nullableArgument_chainSetter.mustache @@ -1 +1 @@ -{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{^required}}{{^useOptional}}@Nullable {{/useOptional}}{{#useOptional}}{{#optionalAcceptNullable}}@Nullable {{/optionalAcceptNullable}}{{/useOptional}}{{/required}}{{/lambda.jSpecifyNullable}}{{#lambda.jSpecifyDatatype}}{{{datatypeWithEnum}}}{{/lambda.jSpecifyDatatype}}{{/useJspecify}}{{^useJspecify}}{{>nullableAnnotation_default}}{{{datatypeWithEnum}}}{{/useJspecify}} \ No newline at end of file +{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{#required}}{{#isNullable}}@Nullable {{/isNullable}}{{/required}}{{^required}}{{^useOptional}}@Nullable {{/useOptional}}{{#useOptional}}{{#optionalAcceptNullable}}@Nullable {{/optionalAcceptNullable}}{{/useOptional}}{{/required}}{{/lambda.jSpecifyNullable}}{{#lambda.jSpecifyDatatype}}{{{datatypeWithEnum}}}{{/lambda.jSpecifyDatatype}}{{/useJspecify}}{{^useJspecify}}{{>nullableAnnotation_default}}{{{datatypeWithEnum}}}{{/useJspecify}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index 3f03f0688187..1fb2c900b48e 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -228,9 +228,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} {{>beanValidation}}{{! prevent indent}} {{/useBeanValidation}} {{^useBeanValidation}} - {{^useJspecify}} - {{#required}}@NotNull{{/required}} - {{/useJspecify}} + {{#lambda.trim}}{{>notNull}}{{/lambda.trim}} {{/useBeanValidation}} {{#swagger2AnnotationLibrary}} @Schema(name = "{{{baseName}}}"{{#isReadOnly}}, accessMode = Schema.AccessMode.READ_ONLY{{/isReadOnly}}{{#example}}, example = "{{{.}}}"{{/example}}{{#description}}, description = "{{{.}}}"{{/description}}{{#deprecated}}, deprecated = true{{/deprecated}}, requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index 678898a30df5..32cd545cb9b6 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -4764,6 +4764,11 @@ public void testJspecify(String library, boolean useSpringBoot4, boolean hasJspe .fileContains( "void setStr(@Nullable String str)", "RequiredAndNullable str(@Nullable String str)"); + JavaFileAssert.assertThat(files.get("FileContent.java")) + .fileContains( + "private @Nullable VirusScanEnum virusScan", + "FileContent.Builder virusScan(@Nullable VirusScanEnum virusScan)" + ); if (!RESTTEMPLATE.equals(library)) { JavaFileAssert.assertThat(files.get("FooApi.java")) .fileContains("fooDtParamGet(java.time.@Nullable Instant dtParam, java.time.@Nullable Instant dtQuery, java.time.@Nullable Instant dtCookie, @Nullable String color)"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 539eb0996b73..37a8a5b969fd 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -7181,9 +7181,9 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti "Foo.Builder requiredDt(java.time.Instant requiredDt)", "Foo.Builder nullableNumber(@Nullable BigDecimal nullableNumber)" ).fileDoesNotContain( - "NotNull", "javax.annotation.Nullable", - "jakarta.annotation.Nullable"); + "jakarta.annotation.Nullable") + .assertMethod("getRequiredDt").assertMethodAnnotations().containsWithName("NotNull").containsWithName("Valid"); JavaFileAssert.assertThat(files.get("FooApi.java")) .assertTypeAnnotations().doesImportAnnotation("org.jspecify.annotations.Nullable").toType() .fileContains( @@ -7197,7 +7197,9 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti "private @Nullable String str", "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired)", "@Nullable String getStr()", - "void setStr(@Nullable String str)" + "void setStr(@Nullable String str)", + "RequiredAndNullable str(@Nullable String str)", + "RequiredAndNullable.Builder str(@Nullable String str)" ); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); @@ -7259,9 +7261,9 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) "Foo.Builder nullableNumber(@Nullable BigDecimal nullableNumber)", "Foo.Builder nullableNumber(JsonNullable nullableNumber)" ).fileDoesNotContain( - "@NotNull", "javax.annotation.Nullable", - "jakarta.annotation.Nullable"); + "jakarta.annotation.Nullable") + .assertMethod("getRequiredDt").assertMethodAnnotations().containsWithName("NotNull").containsWithName("Valid"); JavaFileAssert.assertThat(files.get("FooApi.java")) .assertTypeAnnotations().doesImportAnnotation("org.jspecify.annotations.Nullable").toType() .fileContains( @@ -7274,7 +7276,9 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) "private JsonNullable str = JsonNullable.undefined()", "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired)", "JsonNullable getStr()", - "void setStr(JsonNullable str)" + "void setStr(JsonNullable str)", + "RequiredAndNullable str(@Nullable String str)", + "RequiredAndNullable.Builder str(@Nullable String str)" ); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); @@ -7343,9 +7347,9 @@ public void testJspecify_useOptional(String library, int springBootVersion, bool "Foo.Builder requiredDt(java.time.Instant requiredDt)", "Foo.Builder nullableNumber(JsonNullable nullableNumber)" ).fileDoesNotContain( - "@NotNull", "javax.annotation.Nullable", - "jakarta.annotation.Nullable"); + "jakarta.annotation.Nullable") + .assertMethod("getRequiredDt").assertMethodAnnotations().containsWithName("NotNull").containsWithName("Valid"); if (optionalAcceptNullable) { fooAssert.fileContains( "Foo dt(java.time.@Nullable Instant dt) {\n this.dt = Optional.ofNullable(dt);", @@ -7367,7 +7371,9 @@ public void testJspecify_useOptional(String library, int springBootVersion, bool "private JsonNullable str = JsonNullable.undefined()", "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired)", "JsonNullable getStr()", - "void setStr(JsonNullable str)" + "void setStr(JsonNullable str)", + "RequiredAndNullable str(@Nullable String str)", + "RequiredAndNullable.Builder str(@Nullable String str)" ); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); diff --git a/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml b/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml index 9bff0792e938..7423132b26a1 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml @@ -114,7 +114,10 @@ paths: responses: '200': description: ok - + content: + application/json: + schema: + $ref: '#/components/schemas/FileContent' components: schemas: Foo: @@ -194,3 +197,21 @@ components: onlyRequired: # NON nullable type: string + FileContent: + type: object + required: + - name + - description + properties: + name: + type: string + readOnly: true + size: + type: integer + readOnly: true + virusScan: + type: string + readOnly: true + enum: + - clean + - detected diff --git a/samples/client/petstore/java/native-jackson3-jspecify/README.md b/samples/client/petstore/java/native-jackson3-jspecify/README.md index 8fbbd3016ef1..ae7c8bb3bead 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/native-jackson3-jspecify/README.md @@ -87,7 +87,8 @@ public class FileApiExample { FileApi apiInstance = new FileApi(defaultClient); String id = "id_example"; // String | try { - apiInstance.fileIdGet(id); + FileContent result = apiInstance.fileIdGet(id); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FileApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); @@ -120,6 +121,7 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [FileContent](docs/FileContent.md) - [Foo](docs/Foo.md) - [RequiredAndNullable](docs/RequiredAndNullable.md) diff --git a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml index 96a44984fe5b..e846fb07d38b 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml @@ -126,6 +126,10 @@ paths: style: simple responses: "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FileContent" description: ok tags: - file @@ -234,6 +238,28 @@ components: - onlyRequired - str type: object + FileContent: + example: + name: name + size: 0 + virusScan: clean + properties: + name: + readOnly: true + type: string + size: + readOnly: true + type: integer + virusScan: + enum: + - clean + - detected + readOnly: true + type: string + required: + - description + - name + type: object _upload_post_request: properties: file: diff --git a/samples/client/petstore/java/native-jackson3-jspecify/docs/FileApi.md b/samples/client/petstore/java/native-jackson3-jspecify/docs/FileApi.md index 74ab70ddac94..b9f81d353ef9 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/docs/FileApi.md +++ b/samples/client/petstore/java/native-jackson3-jspecify/docs/FileApi.md @@ -11,7 +11,7 @@ All URIs are relative to *http://localhost* ## fileIdGet -> void fileIdGet(id) +> FileContent fileIdGet(id) @@ -33,7 +33,8 @@ public class Example { FileApi apiInstance = new FileApi(defaultClient); String id = "id_example"; // String | try { - apiInstance.fileIdGet(id); + FileContent result = apiInstance.fileIdGet(id); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FileApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); @@ -54,8 +55,8 @@ public class Example { ### Return type +[**FileContent**](FileContent.md) -null (empty response body) ### Authorization @@ -64,7 +65,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: Not defined +- **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | @@ -73,7 +74,7 @@ No authorization required ## fileIdGetWithHttpInfo -> ApiResponse fileIdGetWithHttpInfo(id) +> ApiResponse fileIdGetWithHttpInfo(id) @@ -96,9 +97,10 @@ public class Example { FileApi apiInstance = new FileApi(defaultClient); String id = "id_example"; // String | try { - ApiResponse response = apiInstance.fileIdGetWithHttpInfo(id); + ApiResponse response = apiInstance.fileIdGetWithHttpInfo(id); System.out.println("Status code: " + response.getStatusCode()); System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); } catch (ApiException e) { System.err.println("Exception when calling FileApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); @@ -119,8 +121,8 @@ public class Example { ### Return type +ApiResponse<[**FileContent**](FileContent.md)> -ApiResponse ### Authorization @@ -129,7 +131,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: Not defined +- **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | diff --git a/samples/client/petstore/java/native-jackson3-jspecify/docs/FileContent.md b/samples/client/petstore/java/native-jackson3-jspecify/docs/FileContent.md new file mode 100644 index 000000000000..5b6654a0bf18 --- /dev/null +++ b/samples/client/petstore/java/native-jackson3-jspecify/docs/FileContent.md @@ -0,0 +1,24 @@ + + +# FileContent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [readonly] | +|**size** | **Integer** | | [optional] [readonly] | +|**virusScan** | [**VirusScanEnum**](#VirusScanEnum) | | [optional] [readonly] | + + + +## Enum: VirusScanEnum + +| Name | Value | +|---- | -----| +| CLEAN | "clean" | +| DETECTED | "detected" | + + + diff --git a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java index 668625401764..e1fd88a5dbfe 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java +++ b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java @@ -18,6 +18,7 @@ import org.openapitools.client.Configuration; import org.openapitools.client.Pair; +import org.openapitools.client.model.FileContent; import tools.jackson.core.JacksonException; import tools.jackson.core.type.TypeReference; @@ -166,10 +167,11 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx * * * @param id (required) + * @return FileContent * @throws ApiException if fails to make API call */ - public void fileIdGet(String id) throws ApiException { - fileIdGet(id, null); + public FileContent fileIdGet(String id) throws ApiException { + return fileIdGet(id, null); } /** @@ -177,20 +179,22 @@ public void fileIdGet(String id) throws ApiException { * * @param id (required) * @param headers Optional headers to include in the request + * @return FileContent * @throws ApiException if fails to make API call */ - public void fileIdGet(String id, Map headers) throws ApiException { - fileIdGetWithHttpInfo(id, headers); + public FileContent fileIdGet(String id, Map headers) throws ApiException { + ApiResponse localVarResponse = fileIdGetWithHttpInfo(id, headers); + return localVarResponse.getData(); } /** * * * @param id (required) - * @return ApiResponse<Void> + * @return ApiResponse<FileContent> * @throws ApiException if fails to make API call */ - public ApiResponse fileIdGetWithHttpInfo(String id) throws ApiException { + public ApiResponse fileIdGetWithHttpInfo(String id) throws ApiException { return fileIdGetWithHttpInfo(id, null); } @@ -199,10 +203,10 @@ public ApiResponse fileIdGetWithHttpInfo(String id) throws ApiException { * * @param id (required) * @param headers Optional headers to include in the request - * @return ApiResponse<Void> + * @return ApiResponse<FileContent> * @throws ApiException if fails to make API call */ - public ApiResponse fileIdGetWithHttpInfo(String id, Map headers) throws ApiException { + public ApiResponse fileIdGetWithHttpInfo(String id, Map headers) throws ApiException { HttpRequest.Builder localVarRequestBuilder = fileIdGetRequestBuilder(id, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( @@ -217,20 +221,31 @@ public ApiResponse fileIdGetWithHttpInfo(String id, Map he throw getApiException("fileIdGet", localVarResponse); } localVarResponseBody = ApiClient.getResponseBody(localVarResponse); - if (localVarResponseBody != null) { - localVarResponseBody.readAllBytes(); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); } - return new ApiResponse<>( + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + FileContent responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( localVarResponse.statusCode(), localVarResponse.headers().map(), - null + responseValue ); } finally { if (localVarResponseBody != null) { localVarResponseBody.close(); } } - } catch (IOException e) { + } catch (IOException | JacksonException e) { throw new ApiException(e); } catch (InterruptedException e) { diff --git a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java new file mode 100644 index 000000000000..adbcdd81a78a --- /dev/null +++ b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java @@ -0,0 +1,294 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import org.openapitools.client.ApiClient; +/** + * FileContent + */ +@JsonPropertyOrder({ + FileContent.JSON_PROPERTY_NAME, + FileContent.JSON_PROPERTY_SIZE, + FileContent.JSON_PROPERTY_VIRUS_SCAN +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class FileContent { + public static final String JSON_PROPERTY_NAME = "name"; + + private String name; + + public static final String JSON_PROPERTY_SIZE = "size"; + + private @Nullable Integer size; + + /** + * Gets or Sets virusScan + */ + public enum VirusScanEnum { + CLEAN(String.valueOf("clean")), + + DETECTED(String.valueOf("detected")); + + private String value; + + VirusScanEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static VirusScanEnum fromValue(String value) { + for (VirusScanEnum b : VirusScanEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_VIRUS_SCAN = "virusScan"; + + private @Nullable VirusScanEnum virusScan; + + public FileContent() { + } + + @JsonCreator + public FileContent( + @JsonProperty(JSON_PROPERTY_NAME) String name, + @JsonProperty(JSON_PROPERTY_SIZE) Integer size, + @JsonProperty(JSON_PROPERTY_VIRUS_SCAN) VirusScanEnum virusScan + ) { + this(); + this.name = name; + this.size = size; + this.virusScan = virusScan; + } + + /** + * Get name + * @return name + */ + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + + + + /** + * Get size + * @return size + */ + + @JsonProperty(value = JSON_PROPERTY_SIZE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public @Nullable Integer getSize() { + return size; + } + + + + + /** + * Get virusScan + * @return virusScan + */ + + @JsonProperty(value = JSON_PROPERTY_VIRUS_SCAN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public @Nullable VirusScanEnum getVirusScan() { + return virusScan; + } + + + + + /** + * Return true if this FileContent object is equal to o. + */ + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileContent {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" virusScan: ").append(toIndentedString(virusScan)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `name` to the URL query string + if (getName() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); + } + + // add `size` to the URL query string + if (getSize() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssize%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSize())))); + } + + // add `virusScan` to the URL query string + if (getVirusScan() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%svirusScan%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getVirusScan())))); + } + + return joiner.toString(); + } + + public static class Builder { + + private FileContent instance; + + public Builder() { + this(new FileContent()); + } + + protected Builder(FileContent instance) { + this.instance = instance; + } + + public FileContent.Builder name(String name) { + this.instance.name = name; + return this; + } + public FileContent.Builder size(@Nullable Integer size) { + this.instance.size = size; + return this; + } + public FileContent.Builder virusScan(@Nullable VirusScanEnum virusScan) { + this.instance.virusScan = virusScan; + return this; + } + + + /** + * returns a built FileContent instance. + * + * The builder is not reusable. + */ + public FileContent build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FileContent.Builder builder() { + return new FileContent.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileContent.Builder toBuilder() { + return new FileContent.Builder() + .name(getName()) + .size(getSize()) + .virusScan(getVirusScan()); + } + +} + diff --git a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java index 0337517f8490..be6826d40995 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java +++ b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -258,15 +258,15 @@ protected Builder(RequiredAndNullable instance) { this.instance = instance; } - public RequiredAndNullable.Builder str(String str) { + public RequiredAndNullable.Builder str(@Nullable String str) { this.instance.str = str; return this; } - public RequiredAndNullable.Builder _file(File _file) { + public RequiredAndNullable.Builder _file(@Nullable File _file) { this.instance._file = _file; return this; } - public RequiredAndNullable.Builder color(String color) { + public RequiredAndNullable.Builder color(@Nullable String color) { this.instance.color = color; return this; } diff --git a/samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java b/samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java new file mode 100644 index 000000000000..eafa2e0aaa1d --- /dev/null +++ b/samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java @@ -0,0 +1,56 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Arrays; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileContent + */ +class FileContentTest { + private final FileContent model = new FileContent(); + + /** + * Model tests for FileContent + */ + @Test + void testFileContent() { + // TODO: test FileContent + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'size' + */ + @Test + void sizeTest() { + // TODO: test size + } + +} diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/README.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/README.md index f518fee202e8..c8dcc331bcce 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/README.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/README.md @@ -95,7 +95,8 @@ public class FileApiExample { FileApi apiInstance = new FileApi(defaultClient); String id = "id_example"; // String | try { - apiInstance.fileIdGet(id); + FileContent result = apiInstance.fileIdGet(id); + System.out.println(result); } catch (HttpStatusCodeException e) { System.err.println("Exception when calling FileApi#fileIdGet"); System.err.println("Status code: " + e.getStatusCode().value()); @@ -123,6 +124,7 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [FileContent](docs/FileContent.md) - [Foo](docs/Foo.md) - [RequiredAndNullable](docs/RequiredAndNullable.md) diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml index 96a44984fe5b..e846fb07d38b 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml @@ -126,6 +126,10 @@ paths: style: simple responses: "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FileContent" description: ok tags: - file @@ -234,6 +238,28 @@ components: - onlyRequired - str type: object + FileContent: + example: + name: name + size: 0 + virusScan: clean + properties: + name: + readOnly: true + type: string + size: + readOnly: true + type: integer + virusScan: + enum: + - clean + - detected + readOnly: true + type: string + required: + - description + - name + type: object _upload_post_request: properties: file: diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/FileApi.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/FileApi.md index 4e6607ae5a71..59683371bc55 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/FileApi.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/FileApi.md @@ -10,7 +10,7 @@ All URIs are relative to *http://localhost* ## fileIdGet -> fileIdGet(id) +> FileContent fileIdGet(id) @@ -32,7 +32,8 @@ public class Example { FileApi apiInstance = new FileApi(defaultClient); String id = "id_example"; // String | try { - apiInstance.fileIdGet(id); + FileContent result = apiInstance.fileIdGet(id); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FileApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); @@ -53,7 +54,7 @@ public class Example { ### Return type -null (empty response body) +[**FileContent**](FileContent.md) ### Authorization @@ -62,7 +63,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: Not defined +- **Accept**: application/json ### HTTP response details diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/FileContent.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/FileContent.md new file mode 100644 index 000000000000..5b6654a0bf18 --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/FileContent.md @@ -0,0 +1,24 @@ + + +# FileContent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [readonly] | +|**size** | **Integer** | | [optional] [readonly] | +|**virusScan** | [**VirusScanEnum**](#VirusScanEnum) | | [optional] [readonly] | + + + +## Enum: VirusScanEnum + +| Name | Value | +|---- | -----| +| CLEAN | "clean" | +| DETECTED | "detected" | + + + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/FileApi.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/FileApi.java index 4f1bf741d207..a391a80e7577 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/FileApi.java +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/FileApi.java @@ -2,6 +2,7 @@ import org.openapitools.client.ApiClient; +import org.openapitools.client.model.FileContent; import java.util.HashMap; import java.util.List; @@ -48,6 +49,7 @@ public void setApiClient(ApiClient apiClient) { * *

    200 - ok * @param id The id parameter + * @return FileContent * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ private ResponseSpec fileIdGetRequestCreation(String id) throws RestClientResponseException { @@ -66,14 +68,16 @@ private ResponseSpec fileIdGetRequestCreation(String id) throws RestClientRespon final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); final MultiValueMap formParams = new LinkedMultiValueMap<>(); - final String[] localVarAccepts = { }; + final String[] localVarAccepts = { + "application/json" + }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { }; - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; return apiClient.invokeAPI("/file/{id}", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } @@ -82,11 +86,12 @@ private ResponseSpec fileIdGetRequestCreation(String id) throws RestClientRespon * *

    200 - ok * @param id The id parameter + * @return FileContent * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public void fileIdGet(String id) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - fileIdGetRequestCreation(id).body(localVarReturnType); + public FileContent fileIdGet(String id) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return fileIdGetRequestCreation(id).body(localVarReturnType); } /** @@ -94,10 +99,11 @@ public void fileIdGet(String id) throws RestClientResponseException { * *

    200 - ok * @param id The id parameter + * @return ResponseEntity<FileContent> * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseEntity fileIdGetWithHttpInfo(String id) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + public ResponseEntity fileIdGetWithHttpInfo(String id) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; return fileIdGetRequestCreation(id).toEntity(localVarReturnType); } diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/FileContent.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/FileContent.java new file mode 100644 index 000000000000..b0f00682525b --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/FileContent.java @@ -0,0 +1,247 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * FileContent + */ +@JsonPropertyOrder({ + FileContent.JSON_PROPERTY_NAME, + FileContent.JSON_PROPERTY_SIZE, + FileContent.JSON_PROPERTY_VIRUS_SCAN +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class FileContent { + public static final String JSON_PROPERTY_NAME = "name"; + + private String name; + + public static final String JSON_PROPERTY_SIZE = "size"; + + private @Nullable Integer size; + + /** + * Gets or Sets virusScan + */ + public enum VirusScanEnum { + CLEAN(String.valueOf("clean")), + + DETECTED(String.valueOf("detected")); + + private String value; + + VirusScanEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static VirusScanEnum fromValue(String value) { + for (VirusScanEnum b : VirusScanEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_VIRUS_SCAN = "virusScan"; + + private @Nullable VirusScanEnum virusScan; + + public FileContent() { + } + /** + * Constructor with only readonly parameters and all parameters + */ + @JsonCreator + public FileContent( + @JsonProperty(JSON_PROPERTY_NAME) String name, + @JsonProperty(JSON_PROPERTY_SIZE) Integer size, + @JsonProperty(JSON_PROPERTY_VIRUS_SCAN) VirusScanEnum virusScan + ) { + this(); + this.name = name; + this.size = size; + this.virusScan = virusScan; + } + + /** + * Get name + * @return name + */ + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + + /** + * Get size + * @return size + */ + + @JsonProperty(value = JSON_PROPERTY_SIZE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public @Nullable Integer getSize() { + return size; + } + + + + /** + * Get virusScan + * @return virusScan + */ + + @JsonProperty(value = JSON_PROPERTY_VIRUS_SCAN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public @Nullable VirusScanEnum getVirusScan() { + return virusScan; + } + + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileContent fileContent = (FileContent) o; + return Objects.equals(this.name, fileContent.name) && + Objects.equals(this.size, fileContent.size) && + Objects.equals(this.virusScan, fileContent.virusScan); + } + + @Override + public int hashCode() { + return Objects.hash(name, size, virusScan); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileContent {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" virusScan: ").append(toIndentedString(virusScan)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private FileContent instance; + + public Builder() { + this(new FileContent()); + } + + protected Builder(FileContent instance) { + this.instance = instance; + } + + public FileContent.Builder name(String name) { + this.instance.name = name; + return this; + } + public FileContent.Builder size(@Nullable Integer size) { + this.instance.size = size; + return this; + } + public FileContent.Builder virusScan(@Nullable VirusScanEnum virusScan) { + this.instance.virusScan = virusScan; + return this; + } + + + /** + * returns a built FileContent instance. + * + * The builder is not reusable. + */ + public FileContent build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FileContent.Builder builder() { + return new FileContent.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileContent.Builder toBuilder() { + return new FileContent.Builder() + .name(getName()) + .size(getSize()) + .virusScan(getVirusScan()); + } + + +} + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java index 2ba77f94e2b7..0e5b2ad7c5c9 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -218,15 +218,15 @@ protected Builder(RequiredAndNullable instance) { this.instance = instance; } - public RequiredAndNullable.Builder str(String str) { + public RequiredAndNullable.Builder str(@Nullable String str) { this.instance.str = str; return this; } - public RequiredAndNullable.Builder _file(File _file) { + public RequiredAndNullable.Builder _file(@Nullable File _file) { this.instance._file = _file; return this; } - public RequiredAndNullable.Builder color(String color) { + public RequiredAndNullable.Builder color(@Nullable String color) { this.instance.color = color; return this; } diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/model/FileContentTest.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/model/FileContentTest.java new file mode 100644 index 000000000000..bc686732b1ca --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/model/FileContentTest.java @@ -0,0 +1,55 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileContent + */ +class FileContentTest { + private final FileContent model = new FileContent(); + + /** + * Model tests for FileContent + */ + @Test + void testFileContent() { + // TODO: test FileContent + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'size' + */ + @Test + void sizeTest() { + // TODO: test size + } + +} diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md index f518fee202e8..c8dcc331bcce 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md @@ -95,7 +95,8 @@ public class FileApiExample { FileApi apiInstance = new FileApi(defaultClient); String id = "id_example"; // String | try { - apiInstance.fileIdGet(id); + FileContent result = apiInstance.fileIdGet(id); + System.out.println(result); } catch (HttpStatusCodeException e) { System.err.println("Exception when calling FileApi#fileIdGet"); System.err.println("Status code: " + e.getStatusCode().value()); @@ -123,6 +124,7 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [FileContent](docs/FileContent.md) - [Foo](docs/Foo.md) - [RequiredAndNullable](docs/RequiredAndNullable.md) diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml index 96a44984fe5b..e846fb07d38b 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -126,6 +126,10 @@ paths: style: simple responses: "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FileContent" description: ok tags: - file @@ -234,6 +238,28 @@ components: - onlyRequired - str type: object + FileContent: + example: + name: name + size: 0 + virusScan: clean + properties: + name: + readOnly: true + type: string + size: + readOnly: true + type: integer + virusScan: + enum: + - clean + - detected + readOnly: true + type: string + required: + - description + - name + type: object _upload_post_request: properties: file: diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/FileApi.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/FileApi.md index 4e6607ae5a71..59683371bc55 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/FileApi.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/FileApi.md @@ -10,7 +10,7 @@ All URIs are relative to *http://localhost* ## fileIdGet -> fileIdGet(id) +> FileContent fileIdGet(id) @@ -32,7 +32,8 @@ public class Example { FileApi apiInstance = new FileApi(defaultClient); String id = "id_example"; // String | try { - apiInstance.fileIdGet(id); + FileContent result = apiInstance.fileIdGet(id); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FileApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); @@ -53,7 +54,7 @@ public class Example { ### Return type -null (empty response body) +[**FileContent**](FileContent.md) ### Authorization @@ -62,7 +63,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: Not defined +- **Accept**: application/json ### HTTP response details diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/FileContent.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/FileContent.md new file mode 100644 index 000000000000..5b6654a0bf18 --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/FileContent.md @@ -0,0 +1,24 @@ + + +# FileContent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [readonly] | +|**size** | **Integer** | | [optional] [readonly] | +|**virusScan** | [**VirusScanEnum**](#VirusScanEnum) | | [optional] [readonly] | + + + +## Enum: VirusScanEnum + +| Name | Value | +|---- | -----| +| CLEAN | "clean" | +| DETECTED | "detected" | + + + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java index 4f1bf741d207..a391a80e7577 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java @@ -2,6 +2,7 @@ import org.openapitools.client.ApiClient; +import org.openapitools.client.model.FileContent; import java.util.HashMap; import java.util.List; @@ -48,6 +49,7 @@ public void setApiClient(ApiClient apiClient) { * *

    200 - ok * @param id The id parameter + * @return FileContent * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ private ResponseSpec fileIdGetRequestCreation(String id) throws RestClientResponseException { @@ -66,14 +68,16 @@ private ResponseSpec fileIdGetRequestCreation(String id) throws RestClientRespon final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); final MultiValueMap formParams = new LinkedMultiValueMap<>(); - final String[] localVarAccepts = { }; + final String[] localVarAccepts = { + "application/json" + }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { }; - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; return apiClient.invokeAPI("/file/{id}", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } @@ -82,11 +86,12 @@ private ResponseSpec fileIdGetRequestCreation(String id) throws RestClientRespon * *

    200 - ok * @param id The id parameter + * @return FileContent * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public void fileIdGet(String id) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - fileIdGetRequestCreation(id).body(localVarReturnType); + public FileContent fileIdGet(String id) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return fileIdGetRequestCreation(id).body(localVarReturnType); } /** @@ -94,10 +99,11 @@ public void fileIdGet(String id) throws RestClientResponseException { * *

    200 - ok * @param id The id parameter + * @return ResponseEntity<FileContent> * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseEntity fileIdGetWithHttpInfo(String id) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + public ResponseEntity fileIdGetWithHttpInfo(String id) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; return fileIdGetRequestCreation(id).toEntity(localVarReturnType); } diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java new file mode 100644 index 000000000000..b0f00682525b --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java @@ -0,0 +1,247 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * FileContent + */ +@JsonPropertyOrder({ + FileContent.JSON_PROPERTY_NAME, + FileContent.JSON_PROPERTY_SIZE, + FileContent.JSON_PROPERTY_VIRUS_SCAN +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class FileContent { + public static final String JSON_PROPERTY_NAME = "name"; + + private String name; + + public static final String JSON_PROPERTY_SIZE = "size"; + + private @Nullable Integer size; + + /** + * Gets or Sets virusScan + */ + public enum VirusScanEnum { + CLEAN(String.valueOf("clean")), + + DETECTED(String.valueOf("detected")); + + private String value; + + VirusScanEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static VirusScanEnum fromValue(String value) { + for (VirusScanEnum b : VirusScanEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_VIRUS_SCAN = "virusScan"; + + private @Nullable VirusScanEnum virusScan; + + public FileContent() { + } + /** + * Constructor with only readonly parameters and all parameters + */ + @JsonCreator + public FileContent( + @JsonProperty(JSON_PROPERTY_NAME) String name, + @JsonProperty(JSON_PROPERTY_SIZE) Integer size, + @JsonProperty(JSON_PROPERTY_VIRUS_SCAN) VirusScanEnum virusScan + ) { + this(); + this.name = name; + this.size = size; + this.virusScan = virusScan; + } + + /** + * Get name + * @return name + */ + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + + /** + * Get size + * @return size + */ + + @JsonProperty(value = JSON_PROPERTY_SIZE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public @Nullable Integer getSize() { + return size; + } + + + + /** + * Get virusScan + * @return virusScan + */ + + @JsonProperty(value = JSON_PROPERTY_VIRUS_SCAN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public @Nullable VirusScanEnum getVirusScan() { + return virusScan; + } + + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileContent fileContent = (FileContent) o; + return Objects.equals(this.name, fileContent.name) && + Objects.equals(this.size, fileContent.size) && + Objects.equals(this.virusScan, fileContent.virusScan); + } + + @Override + public int hashCode() { + return Objects.hash(name, size, virusScan); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileContent {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" virusScan: ").append(toIndentedString(virusScan)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private FileContent instance; + + public Builder() { + this(new FileContent()); + } + + protected Builder(FileContent instance) { + this.instance = instance; + } + + public FileContent.Builder name(String name) { + this.instance.name = name; + return this; + } + public FileContent.Builder size(@Nullable Integer size) { + this.instance.size = size; + return this; + } + public FileContent.Builder virusScan(@Nullable VirusScanEnum virusScan) { + this.instance.virusScan = virusScan; + return this; + } + + + /** + * returns a built FileContent instance. + * + * The builder is not reusable. + */ + public FileContent build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FileContent.Builder builder() { + return new FileContent.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileContent.Builder toBuilder() { + return new FileContent.Builder() + .name(getName()) + .size(getSize()) + .virusScan(getVirusScan()); + } + + +} + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java index 2ba77f94e2b7..0e5b2ad7c5c9 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -218,15 +218,15 @@ protected Builder(RequiredAndNullable instance) { this.instance = instance; } - public RequiredAndNullable.Builder str(String str) { + public RequiredAndNullable.Builder str(@Nullable String str) { this.instance.str = str; return this; } - public RequiredAndNullable.Builder _file(File _file) { + public RequiredAndNullable.Builder _file(@Nullable File _file) { this.instance._file = _file; return this; } - public RequiredAndNullable.Builder color(String color) { + public RequiredAndNullable.Builder color(@Nullable String color) { this.instance.color = color; return this; } diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java new file mode 100644 index 000000000000..bc686732b1ca --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java @@ -0,0 +1,55 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileContent + */ +class FileContentTest { + private final FileContent model = new FileContent(); + + /** + * Model tests for FileContent + */ + @Test + void testFileContent() { + // TODO: test FileContent + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'size' + */ + @Test + void sizeTest() { + // TODO: test size + } + +} diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md index b8158468a7d9..cc1feadaafbf 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md @@ -95,7 +95,8 @@ public class FileApiExample { FileApi apiInstance = new FileApi(defaultClient); String id = "id_example"; // String | try { - apiInstance.fileIdGet(id); + FileContent result = apiInstance.fileIdGet(id); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FileApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); @@ -123,6 +124,7 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [FileContent](docs/FileContent.md) - [Foo](docs/Foo.md) - [RequiredAndNullable](docs/RequiredAndNullable.md) diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml index 96a44984fe5b..e846fb07d38b 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -126,6 +126,10 @@ paths: style: simple responses: "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FileContent" description: ok tags: - file @@ -234,6 +238,28 @@ components: - onlyRequired - str type: object + FileContent: + example: + name: name + size: 0 + virusScan: clean + properties: + name: + readOnly: true + type: string + size: + readOnly: true + type: integer + virusScan: + enum: + - clean + - detected + readOnly: true + type: string + required: + - description + - name + type: object _upload_post_request: properties: file: diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/FileApi.md b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/FileApi.md index 4e6607ae5a71..59683371bc55 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/FileApi.md +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/FileApi.md @@ -10,7 +10,7 @@ All URIs are relative to *http://localhost* ## fileIdGet -> fileIdGet(id) +> FileContent fileIdGet(id) @@ -32,7 +32,8 @@ public class Example { FileApi apiInstance = new FileApi(defaultClient); String id = "id_example"; // String | try { - apiInstance.fileIdGet(id); + FileContent result = apiInstance.fileIdGet(id); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FileApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); @@ -53,7 +54,7 @@ public class Example { ### Return type -null (empty response body) +[**FileContent**](FileContent.md) ### Authorization @@ -62,7 +63,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: Not defined +- **Accept**: application/json ### HTTP response details diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/FileContent.md b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/FileContent.md new file mode 100644 index 000000000000..5b6654a0bf18 --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/FileContent.md @@ -0,0 +1,24 @@ + + +# FileContent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [readonly] | +|**size** | **Integer** | | [optional] [readonly] | +|**virusScan** | [**VirusScanEnum**](#VirusScanEnum) | | [optional] [readonly] | + + + +## Enum: VirusScanEnum + +| Name | Value | +|---- | -----| +| CLEAN | "clean" | +| DETECTED | "detected" | + + + diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java index e9d287276f56..56c01021fec5 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java @@ -3,6 +3,7 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.BaseApi; +import org.openapitools.client.model.FileContent; import java.util.Collections; import java.util.HashMap; @@ -41,10 +42,11 @@ public FileApi(ApiClient apiClient) { * *

    200 - ok * @param id (required) + * @return FileContent * @throws RestClientException if an error occurs while attempting to invoke the API */ - public void fileIdGet(String id) throws RestClientException { - fileIdGetWithHttpInfo(id); + public FileContent fileIdGet(String id) throws RestClientException { + return fileIdGetWithHttpInfo(id).getBody(); } /** @@ -52,10 +54,10 @@ public void fileIdGet(String id) throws RestClientException { * *

    200 - ok * @param id (required) - * @return ResponseEntity<Void> + * @return ResponseEntity<FileContent> * @throws RestClientException if an error occurs while attempting to invoke the API */ - public ResponseEntity fileIdGetWithHttpInfo(String id) throws RestClientException { + public ResponseEntity fileIdGetWithHttpInfo(String id) throws RestClientException { Object localVarPostBody = null; // verify the required parameter 'id' is set @@ -72,14 +74,16 @@ public ResponseEntity fileIdGetWithHttpInfo(String id) throws RestClientEx final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); - final String[] localVarAccepts = { }; + final String[] localVarAccepts = { + "application/json" + }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { }; - ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; + ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/file/{id}", HttpMethod.GET, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); } @@ -94,7 +98,9 @@ public ResponseEntity invokeAPI(String url, HttpMethod method, Object req final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); - final String[] localVarAccepts = { }; + final String[] localVarAccepts = { + "application/json" + }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java new file mode 100644 index 000000000000..b0f00682525b --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java @@ -0,0 +1,247 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * FileContent + */ +@JsonPropertyOrder({ + FileContent.JSON_PROPERTY_NAME, + FileContent.JSON_PROPERTY_SIZE, + FileContent.JSON_PROPERTY_VIRUS_SCAN +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class FileContent { + public static final String JSON_PROPERTY_NAME = "name"; + + private String name; + + public static final String JSON_PROPERTY_SIZE = "size"; + + private @Nullable Integer size; + + /** + * Gets or Sets virusScan + */ + public enum VirusScanEnum { + CLEAN(String.valueOf("clean")), + + DETECTED(String.valueOf("detected")); + + private String value; + + VirusScanEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static VirusScanEnum fromValue(String value) { + for (VirusScanEnum b : VirusScanEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_VIRUS_SCAN = "virusScan"; + + private @Nullable VirusScanEnum virusScan; + + public FileContent() { + } + /** + * Constructor with only readonly parameters and all parameters + */ + @JsonCreator + public FileContent( + @JsonProperty(JSON_PROPERTY_NAME) String name, + @JsonProperty(JSON_PROPERTY_SIZE) Integer size, + @JsonProperty(JSON_PROPERTY_VIRUS_SCAN) VirusScanEnum virusScan + ) { + this(); + this.name = name; + this.size = size; + this.virusScan = virusScan; + } + + /** + * Get name + * @return name + */ + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + + /** + * Get size + * @return size + */ + + @JsonProperty(value = JSON_PROPERTY_SIZE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public @Nullable Integer getSize() { + return size; + } + + + + /** + * Get virusScan + * @return virusScan + */ + + @JsonProperty(value = JSON_PROPERTY_VIRUS_SCAN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public @Nullable VirusScanEnum getVirusScan() { + return virusScan; + } + + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileContent fileContent = (FileContent) o; + return Objects.equals(this.name, fileContent.name) && + Objects.equals(this.size, fileContent.size) && + Objects.equals(this.virusScan, fileContent.virusScan); + } + + @Override + public int hashCode() { + return Objects.hash(name, size, virusScan); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileContent {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" virusScan: ").append(toIndentedString(virusScan)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private FileContent instance; + + public Builder() { + this(new FileContent()); + } + + protected Builder(FileContent instance) { + this.instance = instance; + } + + public FileContent.Builder name(String name) { + this.instance.name = name; + return this; + } + public FileContent.Builder size(@Nullable Integer size) { + this.instance.size = size; + return this; + } + public FileContent.Builder virusScan(@Nullable VirusScanEnum virusScan) { + this.instance.virusScan = virusScan; + return this; + } + + + /** + * returns a built FileContent instance. + * + * The builder is not reusable. + */ + public FileContent build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FileContent.Builder builder() { + return new FileContent.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileContent.Builder toBuilder() { + return new FileContent.Builder() + .name(getName()) + .size(getSize()) + .virusScan(getVirusScan()); + } + + +} + diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java index 2ba77f94e2b7..0e5b2ad7c5c9 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -218,15 +218,15 @@ protected Builder(RequiredAndNullable instance) { this.instance = instance; } - public RequiredAndNullable.Builder str(String str) { + public RequiredAndNullable.Builder str(@Nullable String str) { this.instance.str = str; return this; } - public RequiredAndNullable.Builder _file(File _file) { + public RequiredAndNullable.Builder _file(@Nullable File _file) { this.instance._file = _file; return this; } - public RequiredAndNullable.Builder color(String color) { + public RequiredAndNullable.Builder color(@Nullable String color) { this.instance.color = color; return this; } diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java new file mode 100644 index 000000000000..bc686732b1ca --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java @@ -0,0 +1,55 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileContent + */ +class FileContentTest { + private final FileContent model = new FileContent(); + + /** + * Model tests for FileContent + */ + @Test + void testFileContent() { + // TODO: test FileContent + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'size' + */ + @Test + void sizeTest() { + // TODO: test size + } + +} diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md index 9bcbbb8d7f8f..6e3266ebce3f 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md @@ -95,7 +95,8 @@ public class FileApiExample { FileApi apiInstance = new FileApi(defaultClient); String id = "id_example"; // String | try { - apiInstance.fileIdGet(id); + FileContent result = apiInstance.fileIdGet(id); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FileApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); @@ -123,6 +124,7 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [FileContent](docs/FileContent.md) - [Foo](docs/Foo.md) - [RequiredAndNullable](docs/RequiredAndNullable.md) diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml index 96a44984fe5b..e846fb07d38b 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -126,6 +126,10 @@ paths: style: simple responses: "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FileContent" description: ok tags: - file @@ -234,6 +238,28 @@ components: - onlyRequired - str type: object + FileContent: + example: + name: name + size: 0 + virusScan: clean + properties: + name: + readOnly: true + type: string + size: + readOnly: true + type: integer + virusScan: + enum: + - clean + - detected + readOnly: true + type: string + required: + - description + - name + type: object _upload_post_request: properties: file: diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/FileApi.md b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/FileApi.md index 4e6607ae5a71..59683371bc55 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/FileApi.md +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/FileApi.md @@ -10,7 +10,7 @@ All URIs are relative to *http://localhost* ## fileIdGet -> fileIdGet(id) +> FileContent fileIdGet(id) @@ -32,7 +32,8 @@ public class Example { FileApi apiInstance = new FileApi(defaultClient); String id = "id_example"; // String | try { - apiInstance.fileIdGet(id); + FileContent result = apiInstance.fileIdGet(id); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FileApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); @@ -53,7 +54,7 @@ public class Example { ### Return type -null (empty response body) +[**FileContent**](FileContent.md) ### Authorization @@ -62,7 +63,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: Not defined +- **Accept**: application/json ### HTTP response details diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/FileContent.md b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/FileContent.md new file mode 100644 index 000000000000..5b6654a0bf18 --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/FileContent.md @@ -0,0 +1,24 @@ + + +# FileContent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [readonly] | +|**size** | **Integer** | | [optional] [readonly] | +|**virusScan** | [**VirusScanEnum**](#VirusScanEnum) | | [optional] [readonly] | + + + +## Enum: VirusScanEnum + +| Name | Value | +|---- | -----| +| CLEAN | "clean" | +| DETECTED | "detected" | + + + diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java index 5832d514cbad..5f15e56030a1 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/FileApi.java @@ -2,6 +2,7 @@ import org.openapitools.client.ApiClient; +import org.openapitools.client.model.FileContent; import java.util.HashMap; import java.util.List; @@ -50,6 +51,7 @@ public void setApiClient(ApiClient apiClient) { * *

    200 - ok * @param id The id parameter + * @return FileContent * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ private ResponseSpec fileIdGetRequestCreation(String id) throws WebClientResponseException { @@ -68,14 +70,16 @@ private ResponseSpec fileIdGetRequestCreation(String id) throws WebClientRespons final MultiValueMap cookieParams = new LinkedMultiValueMap(); final MultiValueMap formParams = new LinkedMultiValueMap(); - final String[] localVarAccepts = { }; + final String[] localVarAccepts = { + "application/json" + }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { }; - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/file/{id}", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } @@ -84,10 +88,11 @@ private ResponseSpec fileIdGetRequestCreation(String id) throws WebClientRespons * *

    200 - ok * @param id The id parameter + * @return FileContent * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono fileIdGet(String id) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + public Mono fileIdGet(String id) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return fileIdGetRequestCreation(id).bodyToMono(localVarReturnType); } @@ -96,10 +101,11 @@ public Mono fileIdGet(String id) throws WebClientResponseException { * *

    200 - ok * @param id The id parameter + * @return ResponseEntity<FileContent> * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono> fileIdGetWithHttpInfo(String id) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + public Mono> fileIdGetWithHttpInfo(String id) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return fileIdGetRequestCreation(id).toEntity(localVarReturnType); } diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java new file mode 100644 index 000000000000..f93380d95eac --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/FileContent.java @@ -0,0 +1,246 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * FileContent + */ +@JsonPropertyOrder({ + FileContent.JSON_PROPERTY_NAME, + FileContent.JSON_PROPERTY_SIZE, + FileContent.JSON_PROPERTY_VIRUS_SCAN +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class FileContent { + public static final String JSON_PROPERTY_NAME = "name"; + + private String name; + + public static final String JSON_PROPERTY_SIZE = "size"; + + private @Nullable Integer size; + + /** + * Gets or Sets virusScan + */ + public enum VirusScanEnum { + CLEAN(String.valueOf("clean")), + + DETECTED(String.valueOf("detected")); + + private String value; + + VirusScanEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static VirusScanEnum fromValue(String value) { + for (VirusScanEnum b : VirusScanEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_VIRUS_SCAN = "virusScan"; + + private @Nullable VirusScanEnum virusScan; + + public FileContent() { + } + /** + * Constructor with only readonly parameters and all parameters + */ + @JsonCreator + public FileContent( + @JsonProperty(JSON_PROPERTY_NAME) String name, + @JsonProperty(JSON_PROPERTY_SIZE) Integer size, + @JsonProperty(JSON_PROPERTY_VIRUS_SCAN) VirusScanEnum virusScan + ) { + this(); + this.name = name; + this.size = size; + this.virusScan = virusScan; + } + + /** + * Get name + * @return name + */ + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + + /** + * Get size + * @return size + */ + + @JsonProperty(value = JSON_PROPERTY_SIZE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public @Nullable Integer getSize() { + return size; + } + + + + /** + * Get virusScan + * @return virusScan + */ + + @JsonProperty(value = JSON_PROPERTY_VIRUS_SCAN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public @Nullable VirusScanEnum getVirusScan() { + return virusScan; + } + + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileContent fileContent = (FileContent) o; + return Objects.equals(this.name, fileContent.name) && + Objects.equals(this.size, fileContent.size) && + Objects.equals(this.virusScan, fileContent.virusScan); + } + + @Override + public int hashCode() { + return Objects.hash(name, size, virusScan); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileContent {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" virusScan: ").append(toIndentedString(virusScan)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private FileContent instance; + + public Builder() { + this(new FileContent()); + } + + protected Builder(FileContent instance) { + this.instance = instance; + } + + public FileContent.Builder name(String name) { + this.instance.name = name; + return this; + } + public FileContent.Builder size(@Nullable Integer size) { + this.instance.size = size; + return this; + } + public FileContent.Builder virusScan(@Nullable VirusScanEnum virusScan) { + this.instance.virusScan = virusScan; + return this; + } + + + /** + * returns a built FileContent instance. + * + * The builder is not reusable. + */ + public FileContent build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static FileContent.Builder builder() { + return new FileContent.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileContent.Builder toBuilder() { + return new FileContent.Builder() + .name(getName()) + .size(getSize()) + .virusScan(getVirusScan()); + } + + +} + diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java index 38d340ac1056..01f44d88a37c 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -217,15 +217,15 @@ protected Builder(RequiredAndNullable instance) { this.instance = instance; } - public RequiredAndNullable.Builder str(String str) { + public RequiredAndNullable.Builder str(@Nullable String str) { this.instance.str = str; return this; } - public RequiredAndNullable.Builder _file(File _file) { + public RequiredAndNullable.Builder _file(@Nullable File _file) { this.instance._file = _file; return this; } - public RequiredAndNullable.Builder color(String color) { + public RequiredAndNullable.Builder color(@Nullable String color) { this.instance.color = color; return this; } diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java new file mode 100644 index 000000000000..bc686732b1ca --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/FileContentTest.java @@ -0,0 +1,55 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileContent + */ +class FileContentTest { + private final FileContent model = new FileContent(); + + /** + * Model tests for FileContent + */ + @Test + void testFileContent() { + // TODO: test FileContent + } + + /** + * Test the property 'name' + */ + @Test + void nameTest() { + // TODO: test name + } + + /** + * Test the property 'size' + */ + @Test + void sizeTest() { + // TODO: test size + } + +} diff --git a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java index 53b64044c6e3..21150813c40a 100644 --- a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java +++ b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java @@ -149,7 +149,7 @@ public Pet name(String name) { * Get name * @return name */ - @NotNull + @Schema(name = "name", example = "doggie", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("name") public JsonNullable getName() { diff --git a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index d88271c2bf46..e4a2fca878d3 100644 --- a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -87,7 +87,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index fe0be24e229d..239c584e3950 100644 --- a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -86,7 +86,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index ca932fee5f0f..5b41cd4b3bc8 100644 --- a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -93,7 +93,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 31a8133cb94f..6e358ec3540d 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -92,7 +92,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 31a8133cb94f..6e358ec3540d 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -92,7 +92,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-springboot-4/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-springboot-4/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index b5627e929b6b..fd7d122ed37b 100644 --- a/samples/client/petstore/spring-http-interface-springboot-4/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-springboot-4/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -86,7 +86,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public List getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 219aeb0cd0ed..553e2044e909 100644 --- a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -94,7 +94,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index fe0be24e229d..239c584e3950 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -86,7 +86,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 5e934e643224..7acbd1bd0576 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -87,7 +87,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/FileApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/FileApi.java index 0ee298fc93e5..04c0f17b0dd6 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/FileApi.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/FileApi.java @@ -5,6 +5,7 @@ */ package org.openapitools.api; +import org.openapitools.model.FileContent; import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -52,16 +53,28 @@ default Optional getRequest() { operationId = "fileIdGet", tags = { "file" }, responses = { - @ApiResponse(responseCode = "200", description = "ok") + @ApiResponse(responseCode = "200", description = "ok", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = FileContent.class)) + }) } ) @RequestMapping( method = RequestMethod.GET, - value = FileApi.PATH_FILE_ID_GET + value = FileApi.PATH_FILE_ID_GET, + produces = { "application/json" } ) - default ResponseEntity fileIdGet( + default ResponseEntity fileIdGet( @Parameter(name = "id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("id") String id ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"name\" : \"name\", \"size\" : 0 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/FileContent.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/FileContent.java new file mode 100644 index 000000000000..4a55f6220498 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/FileContent.java @@ -0,0 +1,203 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.jspecify.annotations.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import tools.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import tools.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import tools.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import io.swagger.v3.oas.annotations.media.Schema; + +import jakarta.xml.bind.annotation.*; + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * FileContent + */ + +@JacksonXmlRootElement(localName = "FileContent") +@XmlRootElement(name = "FileContent") +@XmlAccessorType(XmlAccessType.FIELD) +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class FileContent { + + private String name; + + private @Nullable Integer size; + + public FileContent() { + super(); + } + + /** + * Constructor with only required parameters + */ + public FileContent(String name) { + this.name = name; + } + + /** + * Constructor with all args parameters + */ + public FileContent(String name, @Nullable Integer size) { + this.name = name; + this.size = size; + } + + public FileContent name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + + @Schema(name = "name", accessMode = Schema.AccessMode.READ_ONLY, requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + @JacksonXmlProperty(localName = "name") + @XmlElement(name = "name") + public String getName() { + return name; + } + + @JsonProperty("name") + @JacksonXmlProperty(localName = "name") + public void setName(String name) { + this.name = name; + } + + public FileContent size(@Nullable Integer size) { + this.size = size; + return this; + } + + /** + * Get size + * @return size + */ + + @Schema(name = "size", accessMode = Schema.AccessMode.READ_ONLY, requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("size") + @JacksonXmlProperty(localName = "size") + @XmlElement(name = "size") + public @Nullable Integer getSize() { + return size; + } + + @JsonProperty("size") + @JacksonXmlProperty(localName = "size") + public void setSize(@Nullable Integer size) { + this.size = size; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileContent fileContent = (FileContent) o; + return Objects.equals(this.name, fileContent.name) && + Objects.equals(this.size, fileContent.size); + } + + @Override + public int hashCode() { + return Objects.hash(name, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileContent {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private FileContent instance; + + public Builder() { + this(new FileContent()); + } + + protected Builder(FileContent instance) { + this.instance = instance; + } + + protected Builder copyOf(FileContent value) { + this.instance.setName(value.name); + this.instance.setSize(value.size); + return this; + } + + public FileContent.Builder name(String name) { + this.instance.name(name); + return this; + } + + public FileContent.Builder size(@Nullable Integer size) { + this.instance.size(size); + return this; + } + + /** + * returns a built FileContent instance. + * + * The builder is not reusable (NullPointerException) + */ + public FileContent build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static FileContent.Builder builder() { + return new FileContent.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileContent.Builder toBuilder() { + FileContent.Builder builder = new FileContent.Builder(); + return builder.copyOf(this); + } + +} + diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java index 2122bc07b943..59f585f6eb8d 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java @@ -297,7 +297,7 @@ public Foo requiredDt(java.time.Instant requiredDt) { * Get requiredDt * @return requiredDt */ - @Valid + @NotNull @Valid @Schema(name = "requiredDt", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredDt") @JacksonXmlProperty(localName = "requiredDt") @@ -391,7 +391,7 @@ public Foo requiredColor(String requiredColor) { * Get requiredColor * @return requiredColor */ - + @NotNull @Schema(name = "requiredColor", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredColor") @JacksonXmlProperty(localName = "requiredColor") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java index 592f3d66e376..09db6d7b15b8 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -51,7 +51,7 @@ public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nu this.onlyRequired = onlyRequired; } - public RequiredAndNullable str(String str) { + public RequiredAndNullable str(@Nullable String str) { this.str = JsonNullable.of(str); return this; } @@ -75,7 +75,7 @@ public void setStr(JsonNullable str) { this.str = str; } - public RequiredAndNullable file(org.springframework.core.io.Resource file) { + public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource file) { this.file = JsonNullable.of(file); return this; } @@ -99,7 +99,7 @@ public void setFile(JsonNullable file) { this.file = file; } - public RequiredAndNullable color(String color) { + public RequiredAndNullable color(@Nullable String color) { this.color = JsonNullable.of(color); return this; } @@ -132,7 +132,7 @@ public RequiredAndNullable onlyRequired(String onlyRequired) { * Get onlyRequired * @return onlyRequired */ - + @NotNull @Schema(name = "onlyRequired", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("onlyRequired") @JacksonXmlProperty(localName = "onlyRequired") @@ -207,7 +207,7 @@ protected Builder copyOf(RequiredAndNullable value) { return this; } - public RequiredAndNullable.Builder str(String str) { + public RequiredAndNullable.Builder str(@Nullable String str) { this.instance.str(str); return this; } @@ -217,7 +217,7 @@ public RequiredAndNullable.Builder str(JsonNullable str) { return this; } - public RequiredAndNullable.Builder file(org.springframework.core.io.Resource file) { + public RequiredAndNullable.Builder file(org.springframework.core.io.@Nullable Resource file) { this.instance.file(file); return this; } @@ -227,7 +227,7 @@ public RequiredAndNullable.Builder file(JsonNullable getRequest() { operationId = "fileIdGet", tags = { "file" }, responses = { - @ApiResponse(responseCode = "200", description = "ok") + @ApiResponse(responseCode = "200", description = "ok", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = FileContent.class)) + }) } ) @RequestMapping( method = RequestMethod.GET, - value = FileApi.PATH_FILE_ID_GET + value = FileApi.PATH_FILE_ID_GET, + produces = { "application/json" } ) - default ResponseEntity fileIdGet( + default ResponseEntity fileIdGet( @Parameter(name = "id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("id") String id ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"name\" : \"name\", \"size\" : 0 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/FileContent.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/FileContent.java new file mode 100644 index 000000000000..8053141e35fe --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/FileContent.java @@ -0,0 +1,203 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.jspecify.annotations.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import tools.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import tools.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import tools.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import io.swagger.v3.oas.annotations.media.Schema; + +import jakarta.xml.bind.annotation.*; + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * FileContent + */ + +@JacksonXmlRootElement(localName = "FileContent") +@XmlRootElement(name = "FileContent") +@XmlAccessorType(XmlAccessType.FIELD) +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class FileContent { + + private String name; + + private Optional size = Optional.empty(); + + public FileContent() { + super(); + } + + /** + * Constructor with only required parameters + */ + public FileContent(String name) { + this.name = name; + } + + /** + * Constructor with all args parameters + */ + public FileContent(String name, @Nullable Integer size) { + this.name = name; + this.size = Optional.ofNullable(size); + } + + public FileContent name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + + @Schema(name = "name", accessMode = Schema.AccessMode.READ_ONLY, requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + @JacksonXmlProperty(localName = "name") + @XmlElement(name = "name") + public String getName() { + return name; + } + + @JsonProperty("name") + @JacksonXmlProperty(localName = "name") + public void setName(String name) { + this.name = name; + } + + public FileContent size(@Nullable Integer size) { + this.size = Optional.ofNullable(size); + return this; + } + + /** + * Get size + * @return size + */ + + @Schema(name = "size", accessMode = Schema.AccessMode.READ_ONLY, requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("size") + @JacksonXmlProperty(localName = "size") + @XmlElement(name = "size") + public Optional getSize() { + return size; + } + + @JsonProperty("size") + @JacksonXmlProperty(localName = "size") + public void setSize(Optional size) { + this.size = size; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileContent fileContent = (FileContent) o; + return Objects.equals(this.name, fileContent.name) && + Objects.equals(this.size, fileContent.size); + } + + @Override + public int hashCode() { + return Objects.hash(name, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileContent {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private FileContent instance; + + public Builder() { + this(new FileContent()); + } + + protected Builder(FileContent instance) { + this.instance = instance; + } + + protected Builder copyOf(FileContent value) { + this.instance.setName(value.name); + this.instance.setSize(value.size); + return this; + } + + public FileContent.Builder name(String name) { + this.instance.name(name); + return this; + } + + public FileContent.Builder size(@Nullable Integer size) { + this.instance.size(size); + return this; + } + + /** + * returns a built FileContent instance. + * + * The builder is not reusable (NullPointerException) + */ + public FileContent build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static FileContent.Builder builder() { + return new FileContent.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileContent.Builder toBuilder() { + FileContent.Builder builder = new FileContent.Builder(); + return builder.copyOf(this); + } + +} + diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java index 4731f4a00ddf..53fae78adf9f 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java @@ -297,7 +297,7 @@ public Foo requiredDt(java.time.Instant requiredDt) { * Get requiredDt * @return requiredDt */ - @Valid + @NotNull @Valid @Schema(name = "requiredDt", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredDt") @JacksonXmlProperty(localName = "requiredDt") @@ -391,7 +391,7 @@ public Foo requiredColor(String requiredColor) { * Get requiredColor * @return requiredColor */ - + @NotNull @Schema(name = "requiredColor", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredColor") @JacksonXmlProperty(localName = "requiredColor") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java index 592f3d66e376..09db6d7b15b8 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -51,7 +51,7 @@ public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nu this.onlyRequired = onlyRequired; } - public RequiredAndNullable str(String str) { + public RequiredAndNullable str(@Nullable String str) { this.str = JsonNullable.of(str); return this; } @@ -75,7 +75,7 @@ public void setStr(JsonNullable str) { this.str = str; } - public RequiredAndNullable file(org.springframework.core.io.Resource file) { + public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource file) { this.file = JsonNullable.of(file); return this; } @@ -99,7 +99,7 @@ public void setFile(JsonNullable file) { this.file = file; } - public RequiredAndNullable color(String color) { + public RequiredAndNullable color(@Nullable String color) { this.color = JsonNullable.of(color); return this; } @@ -132,7 +132,7 @@ public RequiredAndNullable onlyRequired(String onlyRequired) { * Get onlyRequired * @return onlyRequired */ - + @NotNull @Schema(name = "onlyRequired", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("onlyRequired") @JacksonXmlProperty(localName = "onlyRequired") @@ -207,7 +207,7 @@ protected Builder copyOf(RequiredAndNullable value) { return this; } - public RequiredAndNullable.Builder str(String str) { + public RequiredAndNullable.Builder str(@Nullable String str) { this.instance.str(str); return this; } @@ -217,7 +217,7 @@ public RequiredAndNullable.Builder str(JsonNullable str) { return this; } - public RequiredAndNullable.Builder file(org.springframework.core.io.Resource file) { + public RequiredAndNullable.Builder file(org.springframework.core.io.@Nullable Resource file) { this.instance.file(file); return this; } @@ -227,7 +227,7 @@ public RequiredAndNullable.Builder file(JsonNullable getRequest() { operationId = "fileIdGet", tags = { "file" }, responses = { - @ApiResponse(responseCode = "200", description = "ok") + @ApiResponse(responseCode = "200", description = "ok", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = FileContent.class)) + }) } ) @RequestMapping( method = RequestMethod.GET, - value = FileApi.PATH_FILE_ID_GET + value = FileApi.PATH_FILE_ID_GET, + produces = { "application/json" } ) - default ResponseEntity fileIdGet( + default ResponseEntity fileIdGet( @Parameter(name = "id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("id") String id ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"name\" : \"name\", \"size\" : 0 }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/FileContent.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/FileContent.java new file mode 100644 index 000000000000..0c452e15a5b6 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/FileContent.java @@ -0,0 +1,208 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import org.jspecify.annotations.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import tools.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import tools.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import tools.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import io.swagger.v3.oas.annotations.media.Schema; + +import jakarta.xml.bind.annotation.*; + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * FileContent + */ + +@JacksonXmlRootElement(localName = "FileContent") +@XmlRootElement(name = "FileContent") +@XmlAccessorType(XmlAccessType.FIELD) +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") +public class FileContent { + + @JsonInclude(JsonInclude.Include.NON_NULL) + private String name; + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonSetter(nulls = Nulls.SKIP) + private @Nullable Integer size; + + public FileContent() { + super(); + } + + /** + * Constructor with only required parameters + */ + public FileContent(String name) { + this.name = name; + } + + /** + * Constructor with all args parameters + */ + public FileContent(String name, @Nullable Integer size) { + this.name = name; + this.size = size; + } + + public FileContent name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + + @Schema(name = "name", accessMode = Schema.AccessMode.READ_ONLY, requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + @JacksonXmlProperty(localName = "name") + @XmlElement(name = "name") + public String getName() { + return name; + } + + @JsonProperty("name") + @JacksonXmlProperty(localName = "name") + public void setName(String name) { + this.name = name; + } + + public FileContent size(@Nullable Integer size) { + this.size = size; + return this; + } + + /** + * Get size + * @return size + */ + + @Schema(name = "size", accessMode = Schema.AccessMode.READ_ONLY, requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("size") + @JacksonXmlProperty(localName = "size") + @XmlElement(name = "size") + public @Nullable Integer getSize() { + return size; + } + + @JsonProperty("size") + @JacksonXmlProperty(localName = "size") + public void setSize(@Nullable Integer size) { + this.size = size; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileContent fileContent = (FileContent) o; + return Objects.equals(this.name, fileContent.name) && + Objects.equals(this.size, fileContent.size); + } + + @Override + public int hashCode() { + return Objects.hash(name, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileContent {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private FileContent instance; + + public Builder() { + this(new FileContent()); + } + + protected Builder(FileContent instance) { + this.instance = instance; + } + + protected Builder copyOf(FileContent value) { + this.instance.setName(value.name); + this.instance.setSize(value.size); + return this; + } + + public FileContent.Builder name(String name) { + this.instance.name(name); + return this; + } + + public FileContent.Builder size(@Nullable Integer size) { + this.instance.size(size); + return this; + } + + /** + * returns a built FileContent instance. + * + * The builder is not reusable (NullPointerException) + */ + public FileContent build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static FileContent.Builder builder() { + return new FileContent.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public FileContent.Builder toBuilder() { + FileContent.Builder builder = new FileContent.Builder(); + return builder.copyOf(this); + } + +} + diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java index 458968eed917..41b025136ba6 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java @@ -318,7 +318,7 @@ public Foo requiredDt(java.time.Instant requiredDt) { * Get requiredDt * @return requiredDt */ - @Valid + @NotNull @Valid @Schema(name = "requiredDt", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredDt") @JacksonXmlProperty(localName = "requiredDt") @@ -414,7 +414,7 @@ public Foo requiredColor(String requiredColor) { * Get requiredColor * @return requiredColor */ - + @NotNull @Schema(name = "requiredColor", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("requiredColor") @JacksonXmlProperty(localName = "requiredColor") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java index b6c860b69945..5d40a6b2b546 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -55,7 +55,7 @@ public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nu this.onlyRequired = onlyRequired; } - public RequiredAndNullable str(String str) { + public RequiredAndNullable str(@Nullable String str) { this.str = str; return this; } @@ -79,7 +79,7 @@ public void setStr(@Nullable String str) { this.str = str; } - public RequiredAndNullable file(org.springframework.core.io.Resource file) { + public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource file) { this.file = file; return this; } @@ -103,7 +103,7 @@ public void setFile(org.springframework.core.io.@Nullable Resource file) { this.file = file; } - public RequiredAndNullable color(String color) { + public RequiredAndNullable color(@Nullable String color) { this.color = color; return this; } @@ -136,7 +136,7 @@ public RequiredAndNullable onlyRequired(String onlyRequired) { * Get onlyRequired * @return onlyRequired */ - + @NotNull @Schema(name = "onlyRequired", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("onlyRequired") @JacksonXmlProperty(localName = "onlyRequired") @@ -211,17 +211,17 @@ protected Builder copyOf(RequiredAndNullable value) { return this; } - public RequiredAndNullable.Builder str(String str) { + public RequiredAndNullable.Builder str(@Nullable String str) { this.instance.str(str); return this; } - public RequiredAndNullable.Builder file(org.springframework.core.io.Resource file) { + public RequiredAndNullable.Builder file(org.springframework.core.io.@Nullable Resource file) { this.instance.file(file); return this; } - public RequiredAndNullable.Builder color(String color) { + public RequiredAndNullable.Builder color(@Nullable String color) { this.instance.color(color); return this; } diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..49788f227030 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..49788f227030 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..49788f227030 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 6674c88a2e4f..ea864f192024 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -93,7 +93,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public List getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..49788f227030 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..49788f227030 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..49788f227030 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index b6557ceff4e9..1cd8f09cf773 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -105,7 +105,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 1e996c854efe..c6c772396669 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 2bc02f7a7cc3..d9dc490d6d7b 100644 --- a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -97,7 +97,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..49788f227030 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..49788f227030 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java b/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java index e6fa1ccea8b4..f027e0295735 100644 --- a/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java +++ b/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java @@ -80,7 +80,7 @@ public NullableModel requiredNullable(String requiredNullable) { * Get requiredNullable * @return requiredNullable */ - @NotNull + @JsonProperty("requiredNullable") public JsonNullable getRequiredNullable() { return requiredNullable; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 89a4873f502e..66d5c01d3eab 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java index 2bd4f51c4140..ee8cdf4244aa 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 39f4e40b9ba0..759e505ba56c 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -97,7 +97,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { From 9f9dd24485145bf00103dce392bbf516378782ad Mon Sep 17 00:00:00 2001 From: jpfinne Date: Sat, 15 Aug 2026 13:26:22 +0200 Subject: [PATCH 08/17] regenerate samples --- .../java/org/openapitools/api/FileApi.java | 2 +- .../org/openapitools/model/FileContent.java | 77 +++++++++++++++++- .../java/org/openapitools/api/FileApi.java | 2 +- .../org/openapitools/model/FileContent.java | 77 +++++++++++++++++- .../java/org/openapitools/api/FileApi.java | 2 +- .../org/openapitools/model/FileContent.java | 79 ++++++++++++++++++- 6 files changed, 227 insertions(+), 12 deletions(-) diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/FileApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/FileApi.java index 04c0f17b0dd6..ee8c018556a2 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/FileApi.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/FileApi.java @@ -69,7 +69,7 @@ default ResponseEntity fileIdGet( getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "{ \"name\" : \"name\", \"size\" : 0 }"; + String exampleString = "{ \"name\" : \"name\", \"size\" : 0, \"virusScan\" : \"clean\" }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/FileContent.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/FileContent.java index 4a55f6220498..02f2fd5666ed 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/FileContent.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/FileContent.java @@ -4,6 +4,7 @@ import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; import org.jspecify.annotations.Nullable; import org.openapitools.jackson.nullable.JsonNullable; import java.time.OffsetDateTime; @@ -33,6 +34,43 @@ public class FileContent { private @Nullable Integer size; + /** + * Gets or Sets virusScan + */ + public enum VirusScanEnum { + CLEAN("clean"), + + DETECTED("detected"); + + private final String value; + + VirusScanEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static VirusScanEnum fromValue(String value) { + for (VirusScanEnum b : VirusScanEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + private @Nullable VirusScanEnum virusScan; + public FileContent() { super(); } @@ -47,9 +85,10 @@ public FileContent(String name) { /** * Constructor with all args parameters */ - public FileContent(String name, @Nullable Integer size) { + public FileContent(String name, @Nullable Integer size, @Nullable VirusScanEnum virusScan) { this.name = name; this.size = size; + this.virusScan = virusScan; } public FileContent name(String name) { @@ -100,6 +139,30 @@ public void setSize(@Nullable Integer size) { this.size = size; } + public FileContent virusScan(@Nullable VirusScanEnum virusScan) { + this.virusScan = virusScan; + return this; + } + + /** + * Get virusScan + * @return virusScan + */ + + @Schema(name = "virusScan", accessMode = Schema.AccessMode.READ_ONLY, requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("virusScan") + @JacksonXmlProperty(localName = "virusScan") + @XmlElement(name = "virusScan") + public @Nullable VirusScanEnum getVirusScan() { + return virusScan; + } + + @JsonProperty("virusScan") + @JacksonXmlProperty(localName = "virusScan") + public void setVirusScan(@Nullable VirusScanEnum virusScan) { + this.virusScan = virusScan; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -110,12 +173,13 @@ public boolean equals(Object o) { } FileContent fileContent = (FileContent) o; return Objects.equals(this.name, fileContent.name) && - Objects.equals(this.size, fileContent.size); + Objects.equals(this.size, fileContent.size) && + Objects.equals(this.virusScan, fileContent.virusScan); } @Override public int hashCode() { - return Objects.hash(name, size); + return Objects.hash(name, size, virusScan); } @Override @@ -124,6 +188,7 @@ public String toString() { sb.append("class FileContent {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" virusScan: ").append(toIndentedString(virusScan)).append("\n"); sb.append("}"); return sb.toString(); } @@ -151,6 +216,7 @@ protected Builder(FileContent instance) { protected Builder copyOf(FileContent value) { this.instance.setName(value.name); this.instance.setSize(value.size); + this.instance.setVirusScan(value.virusScan); return this; } @@ -164,6 +230,11 @@ public FileContent.Builder size(@Nullable Integer size) { return this; } + public FileContent.Builder virusScan(@Nullable VirusScanEnum virusScan) { + this.instance.virusScan(virusScan); + return this; + } + /** * returns a built FileContent instance. * diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/FileApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/FileApi.java index 04c0f17b0dd6..ee8c018556a2 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/FileApi.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/FileApi.java @@ -69,7 +69,7 @@ default ResponseEntity fileIdGet( getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "{ \"name\" : \"name\", \"size\" : 0 }"; + String exampleString = "{ \"name\" : \"name\", \"size\" : 0, \"virusScan\" : \"clean\" }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/FileContent.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/FileContent.java index 8053141e35fe..666e6ffdafb7 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/FileContent.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/FileContent.java @@ -4,6 +4,7 @@ import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; import org.jspecify.annotations.Nullable; import org.openapitools.jackson.nullable.JsonNullable; import java.time.OffsetDateTime; @@ -33,6 +34,43 @@ public class FileContent { private Optional size = Optional.empty(); + /** + * Gets or Sets virusScan + */ + public enum VirusScanEnum { + CLEAN("clean"), + + DETECTED("detected"); + + private final String value; + + VirusScanEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static VirusScanEnum fromValue(String value) { + for (VirusScanEnum b : VirusScanEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + private Optional virusScan = Optional.empty(); + public FileContent() { super(); } @@ -47,9 +85,10 @@ public FileContent(String name) { /** * Constructor with all args parameters */ - public FileContent(String name, @Nullable Integer size) { + public FileContent(String name, @Nullable Integer size, @Nullable VirusScanEnum virusScan) { this.name = name; this.size = Optional.ofNullable(size); + this.virusScan = Optional.ofNullable(virusScan); } public FileContent name(String name) { @@ -100,6 +139,30 @@ public void setSize(Optional size) { this.size = size; } + public FileContent virusScan(@Nullable VirusScanEnum virusScan) { + this.virusScan = Optional.ofNullable(virusScan); + return this; + } + + /** + * Get virusScan + * @return virusScan + */ + + @Schema(name = "virusScan", accessMode = Schema.AccessMode.READ_ONLY, requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("virusScan") + @JacksonXmlProperty(localName = "virusScan") + @XmlElement(name = "virusScan") + public Optional getVirusScan() { + return virusScan; + } + + @JsonProperty("virusScan") + @JacksonXmlProperty(localName = "virusScan") + public void setVirusScan(Optional virusScan) { + this.virusScan = virusScan; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -110,12 +173,13 @@ public boolean equals(Object o) { } FileContent fileContent = (FileContent) o; return Objects.equals(this.name, fileContent.name) && - Objects.equals(this.size, fileContent.size); + Objects.equals(this.size, fileContent.size) && + Objects.equals(this.virusScan, fileContent.virusScan); } @Override public int hashCode() { - return Objects.hash(name, size); + return Objects.hash(name, size, virusScan); } @Override @@ -124,6 +188,7 @@ public String toString() { sb.append("class FileContent {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" virusScan: ").append(toIndentedString(virusScan)).append("\n"); sb.append("}"); return sb.toString(); } @@ -151,6 +216,7 @@ protected Builder(FileContent instance) { protected Builder copyOf(FileContent value) { this.instance.setName(value.name); this.instance.setSize(value.size); + this.instance.setVirusScan(value.virusScan); return this; } @@ -164,6 +230,11 @@ public FileContent.Builder size(@Nullable Integer size) { return this; } + public FileContent.Builder virusScan(@Nullable VirusScanEnum virusScan) { + this.instance.virusScan(virusScan); + return this; + } + /** * returns a built FileContent instance. * diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/FileApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/FileApi.java index 04c0f17b0dd6..ee8c018556a2 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/FileApi.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/FileApi.java @@ -69,7 +69,7 @@ default ResponseEntity fileIdGet( getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "{ \"name\" : \"name\", \"size\" : 0 }"; + String exampleString = "{ \"name\" : \"name\", \"size\" : 0, \"virusScan\" : \"clean\" }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/FileContent.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/FileContent.java index 0c452e15a5b6..7b0f652e20c6 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/FileContent.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/FileContent.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.Nulls; import org.jspecify.annotations.Nullable; import java.time.OffsetDateTime; @@ -38,6 +39,45 @@ public class FileContent { @JsonSetter(nulls = Nulls.SKIP) private @Nullable Integer size; + /** + * Gets or Sets virusScan + */ + public enum VirusScanEnum { + CLEAN("clean"), + + DETECTED("detected"); + + private final String value; + + VirusScanEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static VirusScanEnum fromValue(String value) { + for (VirusScanEnum b : VirusScanEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonSetter(nulls = Nulls.SKIP) + private @Nullable VirusScanEnum virusScan; + public FileContent() { super(); } @@ -52,9 +92,10 @@ public FileContent(String name) { /** * Constructor with all args parameters */ - public FileContent(String name, @Nullable Integer size) { + public FileContent(String name, @Nullable Integer size, @Nullable VirusScanEnum virusScan) { this.name = name; this.size = size; + this.virusScan = virusScan; } public FileContent name(String name) { @@ -105,6 +146,30 @@ public void setSize(@Nullable Integer size) { this.size = size; } + public FileContent virusScan(@Nullable VirusScanEnum virusScan) { + this.virusScan = virusScan; + return this; + } + + /** + * Get virusScan + * @return virusScan + */ + + @Schema(name = "virusScan", accessMode = Schema.AccessMode.READ_ONLY, requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("virusScan") + @JacksonXmlProperty(localName = "virusScan") + @XmlElement(name = "virusScan") + public @Nullable VirusScanEnum getVirusScan() { + return virusScan; + } + + @JsonProperty("virusScan") + @JacksonXmlProperty(localName = "virusScan") + public void setVirusScan(@Nullable VirusScanEnum virusScan) { + this.virusScan = virusScan; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -115,12 +180,13 @@ public boolean equals(Object o) { } FileContent fileContent = (FileContent) o; return Objects.equals(this.name, fileContent.name) && - Objects.equals(this.size, fileContent.size); + Objects.equals(this.size, fileContent.size) && + Objects.equals(this.virusScan, fileContent.virusScan); } @Override public int hashCode() { - return Objects.hash(name, size); + return Objects.hash(name, size, virusScan); } @Override @@ -129,6 +195,7 @@ public String toString() { sb.append("class FileContent {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" virusScan: ").append(toIndentedString(virusScan)).append("\n"); sb.append("}"); return sb.toString(); } @@ -156,6 +223,7 @@ protected Builder(FileContent instance) { protected Builder copyOf(FileContent value) { this.instance.setName(value.name); this.instance.setSize(value.size); + this.instance.setVirusScan(value.virusScan); return this; } @@ -169,6 +237,11 @@ public FileContent.Builder size(@Nullable Integer size) { return this; } + public FileContent.Builder virusScan(@Nullable VirusScanEnum virusScan) { + this.instance.virusScan(virusScan); + return this; + } + /** * returns a built FileContent instance. * From 3204eb85633725a6a955b4c7fe25185ad5c673dd Mon Sep 17 00:00:00 2001 From: jpfinne Date: Sat, 15 Aug 2026 15:27:30 +0200 Subject: [PATCH 09/17] Keep @NotNull for JsonInclude field --- .../src/main/resources/JavaSpring/notNull.mustache | 2 +- .../src/main/java/org/openapitools/model/Pet.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/RequiredAndNullable.java | 6 +++--- .../java/org/openapitools/model/RequiredAndNullable.java | 6 +++--- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../src/main/java/org/openapitools/model/NullableModel.java | 2 +- .../java/org/openapitools/model/ContainerDefaultValue.java | 2 +- .../openapitools/virtualan/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 2 +- 27 files changed, 31 insertions(+), 31 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache index c74f667e8a87..bcfeee53e15f 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache @@ -1 +1 @@ -{{#required}}{{^isReadOnly}}{{^isNullable}}@NotNull {{/isNullable}}{{/isReadOnly}}{{/required}} \ No newline at end of file +{{#required}}{{^isReadOnly}}{{#isNullable}}{{#openApiNullable}}@NotNull {{/openApiNullable}}{{/isNullable}}{{^isNullable}}@NotNull {{/isNullable}}{{/isReadOnly}}{{/required}} \ No newline at end of file diff --git a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java index 21150813c40a..53b64044c6e3 100644 --- a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java +++ b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java @@ -149,7 +149,7 @@ public Pet name(String name) { * Get name * @return name */ - + @NotNull @Schema(name = "name", example = "doggie", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("name") public JsonNullable getName() { diff --git a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index e4a2fca878d3..d88271c2bf46 100644 --- a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -87,7 +87,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 239c584e3950..fe0be24e229d 100644 --- a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -86,7 +86,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 5b41cd4b3bc8..ca932fee5f0f 100644 --- a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -93,7 +93,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 6e358ec3540d..31a8133cb94f 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -92,7 +92,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 6e358ec3540d..31a8133cb94f 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -92,7 +92,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 553e2044e909..219aeb0cd0ed 100644 --- a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -94,7 +94,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 239c584e3950..fe0be24e229d 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -86,7 +86,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 7acbd1bd0576..5e934e643224 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -87,7 +87,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java index 09db6d7b15b8..7ef8508f4c61 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -60,7 +60,7 @@ public RequiredAndNullable str(@Nullable String str) { * Get str * @return str */ - + @NotNull @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("str") @JacksonXmlProperty(localName = "str") @@ -84,7 +84,7 @@ public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource f * Get file * @return file */ - @Valid + @NotNull @Valid @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("file") @JacksonXmlProperty(localName = "file") @@ -108,7 +108,7 @@ public RequiredAndNullable color(@Nullable String color) { * Get color * @return color */ - + @NotNull @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("color") @JacksonXmlProperty(localName = "color") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java index 09db6d7b15b8..7ef8508f4c61 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -60,7 +60,7 @@ public RequiredAndNullable str(@Nullable String str) { * Get str * @return str */ - + @NotNull @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("str") @JacksonXmlProperty(localName = "str") @@ -84,7 +84,7 @@ public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource f * Get file * @return file */ - @Valid + @NotNull @Valid @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("file") @JacksonXmlProperty(localName = "file") @@ -108,7 +108,7 @@ public RequiredAndNullable color(@Nullable String color) { * Get color * @return color */ - + @NotNull @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("color") @JacksonXmlProperty(localName = "color") diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 49788f227030..a51bd99c90fc 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 49788f227030..a51bd99c90fc 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 49788f227030..a51bd99c90fc 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 49788f227030..a51bd99c90fc 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 49788f227030..a51bd99c90fc 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 49788f227030..a51bd99c90fc 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 1cd8f09cf773..b6557ceff4e9 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -105,7 +105,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index c6c772396669..1e996c854efe 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index d9dc490d6d7b..2bc02f7a7cc3 100644 --- a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -97,7 +97,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 49788f227030..a51bd99c90fc 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 49788f227030..a51bd99c90fc 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java b/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java index f027e0295735..e6fa1ccea8b4 100644 --- a/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java +++ b/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java @@ -80,7 +80,7 @@ public NullableModel requiredNullable(String requiredNullable) { * Get requiredNullable * @return requiredNullable */ - + @NotNull @JsonProperty("requiredNullable") public JsonNullable getRequiredNullable() { return requiredNullable; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 66d5c01d3eab..89a4873f502e 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java index ee8cdf4244aa..2bd4f51c4140 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 759e505ba56c..39f4e40b9ba0 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -97,7 +97,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - + @NotNull @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { From 04ac7e6ea5a092fdd2af25c4a1b0541e27a4ad8b Mon Sep 17 00:00:00 2001 From: jpfinne Date: Sat, 15 Aug 2026 15:49:49 +0200 Subject: [PATCH 10/17] Fix cubic findings --- .../languages/AbstractJavaCodegen.java | 24 ++++++++----------- .../java/spring/SpringCodegenTest.java | 7 +++--- .../src/test/resources/3_0/java/jspecify.yaml | 1 - 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index ba8e9cb82114..599d99c4e26c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -2109,20 +2109,16 @@ public String removeAnnotations(String dataType) { * @param annotationToKeep annotation to keep. For example @Nullable * @return the data type string without annotations. */ - public String removeAnnotationsWithExlusion(String dataType, String annotationToKeep) { + public String removeAnnotationsWithExclusion(String dataType, String annotationToKeep) { if (dataType != null && dataType.contains("@")) { - if (annotationToKeep != null) { - annotationToKeep += " "; - boolean annotationPresent = annotationToKeep != null && dataType.indexOf(annotationToKeep) >=0; - if (annotationPresent) { - dataType = dataType.replace( annotationToKeep, "%%"); - } - dataType = dataType.replaceAll("(?:(?i)@[a-z0-9\\.]*+([(].*[)]|\\s*))*+", ""); - if (annotationPresent) { - dataType = dataType.replace("%%", annotationToKeep); - } - } else { - dataType = dataType.replaceAll("(?:(?i)@[a-z0-9\\.]*+([(].*[)]|\\s*))*+", ""); + annotationToKeep += " "; + boolean annotationPresent = annotationToKeep != null && dataType.indexOf(annotationToKeep) >=0; + if (annotationPresent) { + dataType = dataType.replace( annotationToKeep, "%%"); + } + dataType = dataType.replaceAll("(?:(?i)@[a-z0-9\\.]*+([(].*[)]|\\s*))*+", ""); + if (annotationPresent) { + dataType = dataType.replace("%%", annotationToKeep); } } return dataType; @@ -2972,7 +2968,7 @@ protected class RemoveAnnotationLambda implements Mustache.Lambda { @Override public void execute(Template.Fragment fragment, Writer writer) throws IOException { - writer.write(removeAnnotationsWithExlusion(fragment.execute(), keep)); + writer.write(removeAnnotationsWithExclusion(fragment.execute(), keep)); } public void keepAnnotation(String keep) { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 37a8a5b969fd..4ad69a8aae66 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -7200,7 +7200,8 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti "void setStr(@Nullable String str)", "RequiredAndNullable str(@Nullable String str)", "RequiredAndNullable.Builder str(@Nullable String str)" - ); + ) + .assertMethod("getStr").assertMethodAnnotations().doesNotContainWithName("NotNull"); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) @@ -7279,7 +7280,7 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) "void setStr(JsonNullable str)", "RequiredAndNullable str(@Nullable String str)", "RequiredAndNullable.Builder str(@Nullable String str)" - ); + ).assertMethod("getStr").assertMethodAnnotations().containsWithName("NotNull"); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) @@ -7374,7 +7375,7 @@ public void testJspecify_useOptional(String library, int springBootVersion, bool "void setStr(JsonNullable str)", "RequiredAndNullable str(@Nullable String str)", "RequiredAndNullable.Builder str(@Nullable String str)" - ); + ).assertMethod("getStr").assertMethodAnnotations().containsWithName("NotNull"); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) diff --git a/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml b/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml index 7423132b26a1..3d5cb7604f08 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml @@ -201,7 +201,6 @@ components: type: object required: - name - - description properties: name: type: string From 66574d0573f6e3d749466e52c4a95fdaff270796 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Sat, 15 Aug 2026 16:02:12 +0200 Subject: [PATCH 11/17] fix missing description --- .../petstore/java/native-jackson3-jspecify/api/openapi.yaml | 1 - .../api/openapi.yaml | 1 - .../restclient-springBoot4-jackson3-jspecify/api/openapi.yaml | 1 - .../resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml | 1 - .../webclient-springBoot4-jackson3-jspecify/api/openapi.yaml | 1 - 5 files changed, 5 deletions(-) diff --git a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml index e846fb07d38b..73e28c50efc9 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml @@ -257,7 +257,6 @@ components: readOnly: true type: string required: - - description - name type: object _upload_post_request: diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml index e846fb07d38b..73e28c50efc9 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml @@ -257,7 +257,6 @@ components: readOnly: true type: string required: - - description - name type: object _upload_post_request: diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml index e846fb07d38b..73e28c50efc9 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -257,7 +257,6 @@ components: readOnly: true type: string required: - - description - name type: object _upload_post_request: diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml index e846fb07d38b..73e28c50efc9 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -257,7 +257,6 @@ components: readOnly: true type: string required: - - description - name type: object _upload_post_request: diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml index e846fb07d38b..73e28c50efc9 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -257,7 +257,6 @@ components: readOnly: true type: string required: - - description - name type: object _upload_post_request: From 04315dc8eb6aee5c162f512c088d45789292dfce Mon Sep 17 00:00:00 2001 From: jpfinne Date: Sat, 15 Aug 2026 16:24:35 +0200 Subject: [PATCH 12/17] Fix failing removeAnnotationsWithExclusion --- .../openapitools/codegen/languages/AbstractJavaCodegen.java | 3 +++ .../src/main/resources/Java/nullable_var_annotations.mustache | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 599d99c4e26c..4bd546806a11 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -2111,6 +2111,9 @@ public String removeAnnotations(String dataType) { */ public String removeAnnotationsWithExclusion(String dataType, String annotationToKeep) { if (dataType != null && dataType.contains("@")) { + if (annotationToKeep == null) { + return dataType.replaceAll("(?:(?i)@[a-z0-9\\.]*+([(].*[)]|\\s*))*+", ""); + } annotationToKeep += " "; boolean annotationPresent = annotationToKeep != null && dataType.indexOf(annotationToKeep) >=0; if (annotationPresent) { diff --git a/modules/openapi-generator/src/main/resources/Java/nullable_var_annotations.mustache b/modules/openapi-generator/src/main/resources/Java/nullable_var_annotations.mustache index 26a6cc4146f5..7b13c89bca91 100644 --- a/modules/openapi-generator/src/main/resources/Java/nullable_var_annotations.mustache +++ b/modules/openapi-generator/src/main/resources/Java/nullable_var_annotations.mustache @@ -1 +1 @@ -{{^useJspecify}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable{{/isNullable}}{{^isNullable}}@{{javaxPackage}}.annotation.Nonnull{{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable{{/required}}{{/useJspecify}}{{#useJspecify}}{{#lambda.jSpecifyNullable}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable {{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable {{/required}}{{/lambda.jSpecifyNullable}}{{/useJspecify}} \ No newline at end of file +{{#lambda.jSpecifyNullable}}{{^useJspecify}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable{{/isNullable}}{{^isNullable}}@{{javaxPackage}}.annotation.Nonnull{{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable{{/required}}{{/useJspecify}}{{#useJspecify}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable {{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable {{/required}}{{/useJspecify}}{{/lambda.jSpecifyNullable}} \ No newline at end of file From 8f9ec729c41654f6a71da37d6003a72fa880101a Mon Sep 17 00:00:00 2001 From: jpfinne Date: Sat, 15 Aug 2026 16:27:01 +0200 Subject: [PATCH 13/17] Fix cubic finding --- .../org/openapitools/codegen/languages/AbstractJavaCodegen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 4bd546806a11..554f98183fc7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -2115,7 +2115,7 @@ public String removeAnnotationsWithExclusion(String dataType, String annotationT return dataType.replaceAll("(?:(?i)@[a-z0-9\\.]*+([(].*[)]|\\s*))*+", ""); } annotationToKeep += " "; - boolean annotationPresent = annotationToKeep != null && dataType.indexOf(annotationToKeep) >=0; + boolean annotationPresent = dataType.indexOf(annotationToKeep) >=0; if (annotationPresent) { dataType = dataType.replace( annotationToKeep, "%%"); } From f11445b4966b187de3adb3635dce80819214c59e Mon Sep 17 00:00:00 2001 From: jpfinne Date: Sun, 16 Aug 2026 09:38:35 +0200 Subject: [PATCH 14/17] Schema nullable=true generation Make JSonNullable<> field = null for nullable+required --- .../Java/libraries/jersey2/pojo.mustache | 2 +- .../Java/libraries/jersey3/pojo.mustache | 2 +- .../Java/libraries/native/pojo.mustache | 2 +- .../Java/libraries/okhttp-gson/pojo.mustache | 2 +- .../Java/libraries/restclient/pojo.mustache | 2 +- .../Java/libraries/resttemplate/pojo.mustache | 2 +- .../Java/libraries/webclient/pojo.mustache | 2 +- .../src/main/resources/Java/pojo.mustache | 2 +- .../main/resources/JavaSpring/pojo.mustache | 6 +- .../codegen/java/JavaClientCodegenTest.java | 33 +++++---- .../java/spring/SpringCodegenTest.java | 22 ++++-- .../src/test/resources/3_0/java/jspecify.yaml | 6 ++ .../native-jackson3-jspecify/api/openapi.yaml | 9 +++ .../docs/RequiredAndNullable.md | 1 + .../client/model/RequiredAndNullable.java | 58 ++++++++++++++- .../api/openapi.yaml | 9 +++ .../docs/RequiredAndNullable.md | 1 + .../client/model/RequiredAndNullable.java | 59 +++++++++++++-- .../api/openapi.yaml | 9 +++ .../docs/RequiredAndNullable.md | 1 + .../client/model/RequiredAndNullable.java | 59 +++++++++++++-- .../openapitools/client/model/EnumTest.java | 2 +- .../client/model/HealthCheckResult.java | 2 +- .../client/model/NullableClass.java | 20 +++--- .../client/model/ParentWithNullable.java | 2 +- .../api/openapi.yaml | 9 +++ .../docs/RequiredAndNullable.md | 1 + .../client/model/RequiredAndNullable.java | 59 +++++++++++++-- .../api/openapi.yaml | 9 +++ .../docs/RequiredAndNullable.md | 1 + .../client/model/RequiredAndNullable.java | 59 +++++++++++++-- .../openapitools/client/model/EnumTest.java | 2 +- .../client/model/HealthCheckResult.java | 2 +- .../client/model/NullableClass.java | 20 +++--- .../client/model/ParentWithNullable.java | 2 +- .../main/java/org/openapitools/model/Pet.java | 4 +- .../model/ContainerDefaultValueDto.java | 2 +- .../model/ContainerDefaultValueDto.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValue.java | 2 +- .../model/ContainerDefaultValueDto.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../api/RequiredAndNullableApi.java | 2 +- .../main/java/org/openapitools/model/Foo.java | 10 +-- .../model/RequiredAndNullable.java | 71 ++++++++++++++++--- .../api/RequiredAndNullableApi.java | 2 +- .../main/java/org/openapitools/model/Foo.java | 10 +-- .../model/RequiredAndNullable.java | 71 ++++++++++++++++--- .../api/RequiredAndNullableApi.java | 2 +- .../main/java/org/openapitools/model/Foo.java | 10 +-- .../model/RequiredAndNullable.java | 61 ++++++++++++++-- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../model/ObjectWithUniqueItems.java | 4 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 6 +- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../model/AdditionalPropertiesClassDto.java | 2 +- .../model/ContainerDefaultValueDto.java | 8 +-- .../model/NullableMapPropertyDto.java | 2 +- .../model/ParentWithNullableDto.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../org/openapitools/model/NullableModel.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../model/NullableMapProperty.java | 2 +- .../model/ParentWithNullable.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/ContainerDefaultValue.java | 8 +-- .../virtualan/model/NullableMapProperty.java | 2 +- .../virtualan/model/ParentWithNullable.java | 2 +- .../org/openapitools/model/EnumTestDto.java | 2 +- .../model/HealthCheckResultDto.java | 2 +- .../openapitools/model/NullableClassDto.java | 20 +++--- .../model/ParentWithNullableDto.java | 2 +- .../model/AdditionalPropertiesClassDto.java | 2 +- .../model/ContainerDefaultValueDto.java | 8 +-- .../model/NullableMapPropertyDto.java | 2 +- .../model/ParentWithNullableDto.java | 2 +- 122 files changed, 732 insertions(+), 258 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache index b14cc844cb56..cb7a77609cdd 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache @@ -209,7 +209,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") {{/swagger1AnnotationLibrary}} {{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}"{{#isNullable}}, nullable = true{{/isNullable}}) {{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache index b14cc844cb56..cb7a77609cdd 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache @@ -209,7 +209,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") {{/swagger1AnnotationLibrary}} {{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}"{{#isNullable}}, nullable = true{{/isNullable}}) {{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache index 36d2f52f0ede..bd0a77b3bfe4 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache @@ -200,7 +200,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") {{/swagger1AnnotationLibrary}} {{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}"{{#isNullable}}, nullable = true{{/isNullable}}) {{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache index 05b7d68369f6..0224febae000 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache @@ -171,7 +171,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") {{/swagger1AnnotationLibrary}} {{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}"{{#isNullable}}, nullable = true{{/isNullable}}) {{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/pojo.mustache index d507b60ec467..a4a4c7db1e91 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/pojo.mustache @@ -230,7 +230,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") {{/swagger1AnnotationLibrary}} {{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}"{{#isNullable}}, nullable = true{{/isNullable}}) {{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pojo.mustache index 7ec14493ef56..4ff69044f32e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pojo.mustache @@ -230,7 +230,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") {{/swagger1AnnotationLibrary}} {{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}"{{#isNullable}}, nullable = true{{/isNullable}}) {{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pojo.mustache index 4ffe46114fa6..97855c736cff 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pojo.mustache @@ -230,7 +230,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") {{/swagger1AnnotationLibrary}} {{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}"{{#isNullable}}, nullable = true{{/isNullable}}) {{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} diff --git a/modules/openapi-generator/src/main/resources/Java/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/pojo.mustache index 2c1ff7e32cf3..9b51a4681a57 100644 --- a/modules/openapi-generator/src/main/resources/Java/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pojo.mustache @@ -233,7 +233,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") {{/swagger1AnnotationLibrary}} {{#swagger2AnnotationLibrary}} - @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}"{{#isNullable}}, nullable = true{{/isNullable}}) {{/swagger2AnnotationLibrary}} {{#vendorExtensions.x-extra-annotation}} {{{vendorExtensions.x-extra-annotation}}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index 1fb2c900b48e..81ebc104782c 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -77,7 +77,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} {{/deprecated}} {{#isContainer}} {{#openApiNullable}} - private {{>nullableAnnotation}}{{#isNullable}}{{>nullableDataTypeBeanValidation}} {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();{{/isNullable}}{{^required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/isNullable}}{{/required}}{{#required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/isNullable}}{{/required}} + private {{>nullableAnnotation}}{{#isNullable}}{{>nullableDataTypeBeanValidation}} {{name}} = {{#required}}null{{/required}}{{^required}}JsonNullable.<{{{datatypeWithEnum}}}>undefined(){{/required}};{{/isNullable}}{{^required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/isNullable}}{{/required}}{{#required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/isNullable}}{{/required}} {{/openApiNullable}} {{^openApiNullable}} private {{>nullableAnnotation}}{{>nullableDataType}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; @@ -91,7 +91,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) {{/isDateTime}} {{#openApiNullable}} - private {{>nullableAnnotation}}{{#isNullable}}{{>nullableDataTypeBeanValidation}} {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();{{/isNullable}}{{^required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#useOptional}} = Optional.{{^defaultValue}}empty(){{/defaultValue}}{{#defaultValue}}of({{{.}}}){{/defaultValue}};{{/useOptional}}{{^useOptional}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/useOptional}}{{/isNullable}}{{/required}}{{^isNullable}}{{#required}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/required}}{{/isNullable}} + private {{>nullableAnnotation}}{{#isNullable}}{{>nullableDataTypeBeanValidation}} {{name}} = {{#required}}null{{/required}}{{^required}}JsonNullable.<{{{datatypeWithEnum}}}>undefined(){{/required}};{{/isNullable}}{{^required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#useOptional}} = Optional.{{^defaultValue}}empty(){{/defaultValue}}{{#defaultValue}}of({{{.}}}){{/defaultValue}};{{/useOptional}}{{^useOptional}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/useOptional}}{{/isNullable}}{{/required}}{{^isNullable}}{{#required}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/required}}{{/isNullable}} {{/openApiNullable}} {{^openApiNullable}} private {{>nullableAnnotation}}{{>nullableDataType}} {{name}}{{#isNullable}} = null{{/isNullable}}{{^isNullable}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isNullable}}; @@ -231,7 +231,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} {{#lambda.trim}}{{>notNull}}{{/lambda.trim}} {{/useBeanValidation}} {{#swagger2AnnotationLibrary}} - @Schema(name = "{{{baseName}}}"{{#isReadOnly}}, accessMode = Schema.AccessMode.READ_ONLY{{/isReadOnly}}{{#example}}, example = "{{{.}}}"{{/example}}{{#description}}, description = "{{{.}}}"{{/description}}{{#deprecated}}, deprecated = true{{/deprecated}}, requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}) + @Schema(name = "{{{baseName}}}"{{#isReadOnly}}, accessMode = Schema.AccessMode.READ_ONLY{{/isReadOnly}}{{#example}}, example = "{{{.}}}"{{/example}}{{#description}}, description = "{{{.}}}"{{/description}}{{#deprecated}}, deprecated = true{{/deprecated}}, requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}{{#isNullable}}, nullable = true{{/isNullable}}) {{/swagger2AnnotationLibrary}} {{#swagger1AnnotationLibrary}} @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}") diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index 32cd545cb9b6..ce989a5fa47f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -4697,27 +4697,28 @@ public void testRestClientMultipartFormParamsGuardAgainstEmptyLists() { @DataProvider(name = "jspecifyLibraries") public Object[][] jspecifyLibraries() { return new Object[][]{ - {"restclient", false, true}, - {"restclient", true, false}, - {"webclient", false, true}, - {"webclient", true, false}, - {"resttemplate", false, true}, - {"resttemplate", true, true}, - {"native", false, true} + {"restclient", 3, true}, + {"restclient", 4, false}, + {"webclient", 3, true}, + {"webclient", 4, false}, + {"resttemplate", 3, true}, + {"resttemplate", 4, true}, + {"native", 3, true} }; } @Test(dataProvider = "jspecifyLibraries") - public void testJspecify(String library, boolean useSpringBoot4, boolean hasJspecifyDependency) throws IOException { + public void testJspecify(String library, int springBootVersion, boolean hasJspecifyDependency) throws IOException { final Map files = generateFromContract("src/test/resources/3_0/java/jspecify.yaml", library, Map.of(USE_JSPECIFY, true, "containerDefaultToNull", true, - USE_SPRING_BOOT4, useSpringBoot4, + USE_SPRING_BOOT4, springBootVersion == 4, JavaClientCodegen.OPENAPI_NULLABLE, false, GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, true, GENERATE_BUILDERS, true, - USE_ABSTRACTION_FOR_FILES, true - ), + USE_ABSTRACTION_FOR_FILES, true, + "annotationLibrary", "swagger2" + ), codegenConfigurator -> codegenConfigurator .setValidateSpec(false) @@ -4763,7 +4764,8 @@ public void testJspecify(String library, boolean useSpringBoot4, boolean hasJspe JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) .fileContains( "void setStr(@Nullable String str)", - "RequiredAndNullable str(@Nullable String str)"); + "RequiredAndNullable str(@Nullable String str)", + "@Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = \"\", nullable = true)"); JavaFileAssert.assertThat(files.get("FileContent.java")) .fileContains( "private @Nullable VirusScanEnum virusScan", @@ -4787,14 +4789,15 @@ public void testJspecify(String library, boolean useSpringBoot4, boolean hasJspe } @Test(dataProvider = "jspecifyLibraries") - public void testJspecify_openapiNullable(String library, boolean useSpringBoot4, boolean hasJspecifyDependency) throws IOException { + public void testJspecify_openapiNullable(String library, int springBootVersion, boolean hasJspecifyDependency) throws IOException { final Map files = generateFromContract("src/test/resources/3_0/java/jspecify.yaml", library, Map.of(USE_JSPECIFY, true, "containerDefaultToNull", true, - USE_SPRING_BOOT4, useSpringBoot4, + USE_SPRING_BOOT4, springBootVersion == 4, JavaClientCodegen.OPENAPI_NULLABLE, true, GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, true, - GENERATE_BUILDERS, true + GENERATE_BUILDERS, true, + ANNOTATION_LIBRARY, "swagger2" ), codegenConfigurator -> codegenConfigurator diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 4ad69a8aae66..52fa93744e51 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -7194,14 +7194,23 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti ); JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) .fileContains( - "private @Nullable String str", - "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired)", + "private @Nullable String str = null;", + "private @Nullable List _list;", + "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired, @Nullable List _list)", "@Nullable String getStr()", "void setStr(@Nullable String str)", "RequiredAndNullable str(@Nullable String str)", "RequiredAndNullable.Builder str(@Nullable String str)" ) .assertMethod("getStr").assertMethodAnnotations().doesNotContainWithName("NotNull"); + if (!library.equals(SPRING_HTTP_INTERFACE)) { + // SPRING_HTTP_INTERFACE does not support @Schema generation (yet) + JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) + .fileContains( + "@Schema(name = \"str\", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true)"); + } + JavaFileAssert.assertThat(files.get("FileContent.java")) + .fileContains("VirusScanEnum getVirusScan()"); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) @@ -7274,8 +7283,9 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) ); JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) .fileContains( - "private JsonNullable str = JsonNullable.undefined()", - "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired)", + "private JsonNullable str = null;", + "private JsonNullable> _list = null;", + "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired, @Nullable List _list)", "JsonNullable getStr()", "void setStr(JsonNullable str)", "RequiredAndNullable str(@Nullable String str)", @@ -7369,8 +7379,8 @@ public void testJspecify_useOptional(String library, int springBootVersion, bool ); JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) .fileContains( - "private JsonNullable str = JsonNullable.undefined()", - "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired)", + "private JsonNullable str = null;", + "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired, @Nullable List _list)", "JsonNullable getStr()", "void setStr(JsonNullable str)", "RequiredAndNullable str(@Nullable String str)", diff --git a/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml b/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml index 3d5cb7604f08..4d166384f1ad 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml @@ -182,6 +182,7 @@ components: - file - color - onlyRequired + - list properties: str: nullable: true @@ -197,6 +198,11 @@ components: onlyRequired: # NON nullable type: string + list: + type: array + nullable: true + items: + type: string FileContent: type: object required: diff --git a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml index 73e28c50efc9..15c1f4176a50 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml @@ -218,6 +218,9 @@ components: file: "" color: red onlyRequired: onlyRequired + list: + - list + - list properties: str: nullable: true @@ -232,9 +235,15 @@ components: type: string onlyRequired: type: string + list: + items: + type: string + nullable: true + type: array required: - color - file + - list - onlyRequired - str type: object diff --git a/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullable.md b/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullable.md index 520992382bdc..ff4ade0f226d 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullable.md +++ b/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullable.md @@ -11,6 +11,7 @@ |**_file** | **File** | | | |**color** | **String** | | | |**onlyRequired** | **String** | | | +|**_list** | **List<String>** | | | diff --git a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java index be6826d40995..53202eaf7653 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java +++ b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -26,7 +26,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.io.File; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import org.jspecify.annotations.Nullable; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -39,7 +41,8 @@ RequiredAndNullable.JSON_PROPERTY_STR, RequiredAndNullable.JSON_PROPERTY_FILE, RequiredAndNullable.JSON_PROPERTY_COLOR, - RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED + RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED, + RequiredAndNullable.JSON_PROPERTY_LIST }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredAndNullable { @@ -59,6 +62,10 @@ public class RequiredAndNullable { private String onlyRequired; + public static final String JSON_PROPERTY_LIST = "list"; + + private @Nullable List _list; + public RequiredAndNullable() { } @@ -158,6 +165,38 @@ public void setOnlyRequired(String onlyRequired) { } + public RequiredAndNullable _list(@Nullable List _list) { + this._list = _list; + return this; + } + + public RequiredAndNullable addListItem(String _listItem) { + if (this._list == null) { + this._list = new ArrayList<>(); + } + this._list.add(_listItem); + return this; + } + + /** + * Get _list + * @return _list + */ + + @JsonProperty(value = JSON_PROPERTY_LIST, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public @Nullable List getList() { + return _list; + } + + + @JsonProperty(value = JSON_PROPERTY_LIST, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setList(@Nullable List _list) { + this._list = _list; + } + + /** * Return true if this RequiredAndNullable object is equal to o. */ @@ -179,6 +218,7 @@ public String toString() { sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); sb.append("}"); return sb.toString(); } @@ -243,6 +283,15 @@ public String toUrlQueryString(String prefix) { joiner.add(String.format(java.util.Locale.ROOT, "%sonlyRequired%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getOnlyRequired())))); } + // add `list` to the URL query string + if (getList() != null) { + for (int i = 0; i < getList().size(); i++) { + joiner.add(String.format(java.util.Locale.ROOT, "%slist%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getList().get(i))))); + } + } + return joiner.toString(); } @@ -274,6 +323,10 @@ public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { this.instance.onlyRequired = onlyRequired; return this; } + public RequiredAndNullable.Builder _list(@Nullable List _list) { + this.instance._list = _list; + return this; + } /** @@ -311,7 +364,8 @@ public RequiredAndNullable.Builder toBuilder() { .str(getStr()) ._file(getFile()) .color(getColor()) - .onlyRequired(getOnlyRequired()); + .onlyRequired(getOnlyRequired()) + ._list(getList()); } } diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml index 73e28c50efc9..15c1f4176a50 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/api/openapi.yaml @@ -218,6 +218,9 @@ components: file: "" color: red onlyRequired: onlyRequired + list: + - list + - list properties: str: nullable: true @@ -232,9 +235,15 @@ components: type: string onlyRequired: type: string + list: + items: + type: string + nullable: true + type: array required: - color - file + - list - onlyRequired - str type: object diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullable.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullable.md index 520992382bdc..ff4ade0f226d 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullable.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullable.md @@ -11,6 +11,7 @@ |**_file** | **File** | | | |**color** | **String** | | | |**onlyRequired** | **String** | | | +|**_list** | **List<String>** | | | diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java index 0e5b2ad7c5c9..55653e9e6161 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -20,6 +20,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.jspecify.annotations.Nullable; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -32,7 +35,8 @@ RequiredAndNullable.JSON_PROPERTY_STR, RequiredAndNullable.JSON_PROPERTY_FILE, RequiredAndNullable.JSON_PROPERTY_COLOR, - RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED + RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED, + RequiredAndNullable.JSON_PROPERTY_LIST }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredAndNullable { @@ -52,17 +56,22 @@ public class RequiredAndNullable { private String onlyRequired; + public static final String JSON_PROPERTY_LIST = "list"; + + private @Nullable List _list; + public RequiredAndNullable() { } /** * Constructor with all args parameters */ - public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired) { + public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired, @JsonProperty(JSON_PROPERTY_LIST) @Nullable List _list) { this.str = str; this._file = _file; this.color = color; this.onlyRequired = onlyRequired; + this._list = _list; } public RequiredAndNullable str(@Nullable String str) { @@ -165,6 +174,39 @@ public void setOnlyRequired(String onlyRequired) { this.onlyRequired = onlyRequired; } + public RequiredAndNullable _list(@Nullable List _list) { + + this._list = _list; + return this; + } + + public RequiredAndNullable addListItem(String _listItem) { + if (this._list == null) { + this._list = new ArrayList<>(); + } + this._list.add(_listItem); + return this; + } + + /** + * Get _list + * @return _list + */ + + @JsonProperty(value = JSON_PROPERTY_LIST, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable List getList() { + return _list; + } + + + @JsonProperty(value = JSON_PROPERTY_LIST, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setList(@Nullable List _list) { + this._list = _list; + } + @Override public boolean equals(Object o) { @@ -178,12 +220,13 @@ public boolean equals(Object o) { return Objects.equals(this.str, requiredAndNullable.str) && Objects.equals(this._file, requiredAndNullable._file) && Objects.equals(this.color, requiredAndNullable.color) && - Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired) && + Objects.equals(this._list, requiredAndNullable._list); } @Override public int hashCode() { - return Objects.hash(str, _file, color, onlyRequired); + return Objects.hash(str, _file, color, onlyRequired, _list); } @Override @@ -194,6 +237,7 @@ public String toString() { sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); sb.append("}"); return sb.toString(); } @@ -234,6 +278,10 @@ public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { this.instance.onlyRequired = onlyRequired; return this; } + public RequiredAndNullable.Builder _list(@Nullable List _list) { + this.instance._list = _list; + return this; + } /** @@ -271,7 +319,8 @@ public RequiredAndNullable.Builder toBuilder() { .str(getStr()) ._file(getFile()) .color(getColor()) - .onlyRequired(getOnlyRequired()); + .onlyRequired(getOnlyRequired()) + ._list(getList()); } diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml index 73e28c50efc9..15c1f4176a50 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -218,6 +218,9 @@ components: file: "" color: red onlyRequired: onlyRequired + list: + - list + - list properties: str: nullable: true @@ -232,9 +235,15 @@ components: type: string onlyRequired: type: string + list: + items: + type: string + nullable: true + type: array required: - color - file + - list - onlyRequired - str type: object diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md index 520992382bdc..ff4ade0f226d 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md @@ -11,6 +11,7 @@ |**_file** | **File** | | | |**color** | **String** | | | |**onlyRequired** | **String** | | | +|**_list** | **List<String>** | | | diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java index 0e5b2ad7c5c9..55653e9e6161 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -20,6 +20,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.jspecify.annotations.Nullable; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -32,7 +35,8 @@ RequiredAndNullable.JSON_PROPERTY_STR, RequiredAndNullable.JSON_PROPERTY_FILE, RequiredAndNullable.JSON_PROPERTY_COLOR, - RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED + RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED, + RequiredAndNullable.JSON_PROPERTY_LIST }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredAndNullable { @@ -52,17 +56,22 @@ public class RequiredAndNullable { private String onlyRequired; + public static final String JSON_PROPERTY_LIST = "list"; + + private @Nullable List _list; + public RequiredAndNullable() { } /** * Constructor with all args parameters */ - public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired) { + public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired, @JsonProperty(JSON_PROPERTY_LIST) @Nullable List _list) { this.str = str; this._file = _file; this.color = color; this.onlyRequired = onlyRequired; + this._list = _list; } public RequiredAndNullable str(@Nullable String str) { @@ -165,6 +174,39 @@ public void setOnlyRequired(String onlyRequired) { this.onlyRequired = onlyRequired; } + public RequiredAndNullable _list(@Nullable List _list) { + + this._list = _list; + return this; + } + + public RequiredAndNullable addListItem(String _listItem) { + if (this._list == null) { + this._list = new ArrayList<>(); + } + this._list.add(_listItem); + return this; + } + + /** + * Get _list + * @return _list + */ + + @JsonProperty(value = JSON_PROPERTY_LIST, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable List getList() { + return _list; + } + + + @JsonProperty(value = JSON_PROPERTY_LIST, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setList(@Nullable List _list) { + this._list = _list; + } + @Override public boolean equals(Object o) { @@ -178,12 +220,13 @@ public boolean equals(Object o) { return Objects.equals(this.str, requiredAndNullable.str) && Objects.equals(this._file, requiredAndNullable._file) && Objects.equals(this.color, requiredAndNullable.color) && - Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired) && + Objects.equals(this._list, requiredAndNullable._list); } @Override public int hashCode() { - return Objects.hash(str, _file, color, onlyRequired); + return Objects.hash(str, _file, color, onlyRequired, _list); } @Override @@ -194,6 +237,7 @@ public String toString() { sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); sb.append("}"); return sb.toString(); } @@ -234,6 +278,10 @@ public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { this.instance.onlyRequired = onlyRequired; return this; } + public RequiredAndNullable.Builder _list(@Nullable List _list) { + this.instance._list = _list; + return this; + } /** @@ -271,7 +319,8 @@ public RequiredAndNullable.Builder toBuilder() { .str(getStr()) ._file(getFile()) .color(getColor()) - .onlyRequired(getOnlyRequired()); + .onlyRequired(getOnlyRequired()) + ._list(getList()); } diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java index d6cab3c6d44e..8dbec199a934 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java @@ -343,7 +343,7 @@ public EnumTest outerEnum(@jakarta.annotation.Nullable OuterEnum outerEnum) { * @return outerEnum */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public OuterEnum getOuterEnum() { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java index acaacf9f1ed4..8aee3efd00bc 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -56,7 +56,7 @@ public HealthCheckResult nullableMessage(@jakarta.annotation.Nullable String nul * @return nullableMessage */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public String getNullableMessage() { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java index fc29bdb28d6c..742c20a37b1e 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java @@ -122,7 +122,7 @@ public NullableClass integerProp(@jakarta.annotation.Nullable Integer integerPro * @return integerProp */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public Integer getIntegerProp() { @@ -156,7 +156,7 @@ public NullableClass numberProp(@jakarta.annotation.Nullable BigDecimal numberPr * @return numberProp */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public BigDecimal getNumberProp() { @@ -190,7 +190,7 @@ public NullableClass booleanProp(@jakarta.annotation.Nullable Boolean booleanPro * @return booleanProp */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public Boolean getBooleanProp() { @@ -224,7 +224,7 @@ public NullableClass stringProp(@jakarta.annotation.Nullable String stringProp) * @return stringProp */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public String getStringProp() { @@ -258,7 +258,7 @@ public NullableClass dateProp(@jakarta.annotation.Nullable LocalDate dateProp) { * @return dateProp */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public LocalDate getDateProp() { @@ -292,7 +292,7 @@ public NullableClass datetimeProp(@jakarta.annotation.Nullable OffsetDateTime da * @return datetimeProp */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public OffsetDateTime getDatetimeProp() { @@ -338,7 +338,7 @@ public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { * @return arrayNullableProp */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public List getArrayNullableProp() { @@ -384,7 +384,7 @@ public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullab * @return arrayAndItemsNullableProp */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public List getArrayAndItemsNullableProp() { @@ -464,7 +464,7 @@ public NullableClass putObjectNullablePropItem(String key, Object objectNullable * @return objectNullableProp */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public Map getObjectNullableProp() { @@ -510,7 +510,7 @@ public NullableClass putObjectAndItemsNullablePropItem(String key, Object object * @return objectAndItemsNullableProp */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public Map getObjectAndItemsNullableProp() { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java index 504c9fe527a1..cca6f0b72f88 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java @@ -131,7 +131,7 @@ public ParentWithNullable nullableProperty(@jakarta.annotation.Nullable String n * @return nullableProperty */ @jakarta.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public String getNullableProperty() { diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml index 73e28c50efc9..15c1f4176a50 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -218,6 +218,9 @@ components: file: "" color: red onlyRequired: onlyRequired + list: + - list + - list properties: str: nullable: true @@ -232,9 +235,15 @@ components: type: string onlyRequired: type: string + list: + items: + type: string + nullable: true + type: array required: - color - file + - list - onlyRequired - str type: object diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md index 520992382bdc..ff4ade0f226d 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md @@ -11,6 +11,7 @@ |**_file** | **File** | | | |**color** | **String** | | | |**onlyRequired** | **String** | | | +|**_list** | **List<String>** | | | diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java index 0e5b2ad7c5c9..55653e9e6161 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -20,6 +20,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.jspecify.annotations.Nullable; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -32,7 +35,8 @@ RequiredAndNullable.JSON_PROPERTY_STR, RequiredAndNullable.JSON_PROPERTY_FILE, RequiredAndNullable.JSON_PROPERTY_COLOR, - RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED + RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED, + RequiredAndNullable.JSON_PROPERTY_LIST }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredAndNullable { @@ -52,17 +56,22 @@ public class RequiredAndNullable { private String onlyRequired; + public static final String JSON_PROPERTY_LIST = "list"; + + private @Nullable List _list; + public RequiredAndNullable() { } /** * Constructor with all args parameters */ - public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired) { + public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired, @JsonProperty(JSON_PROPERTY_LIST) @Nullable List _list) { this.str = str; this._file = _file; this.color = color; this.onlyRequired = onlyRequired; + this._list = _list; } public RequiredAndNullable str(@Nullable String str) { @@ -165,6 +174,39 @@ public void setOnlyRequired(String onlyRequired) { this.onlyRequired = onlyRequired; } + public RequiredAndNullable _list(@Nullable List _list) { + + this._list = _list; + return this; + } + + public RequiredAndNullable addListItem(String _listItem) { + if (this._list == null) { + this._list = new ArrayList<>(); + } + this._list.add(_listItem); + return this; + } + + /** + * Get _list + * @return _list + */ + + @JsonProperty(value = JSON_PROPERTY_LIST, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable List getList() { + return _list; + } + + + @JsonProperty(value = JSON_PROPERTY_LIST, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setList(@Nullable List _list) { + this._list = _list; + } + @Override public boolean equals(Object o) { @@ -178,12 +220,13 @@ public boolean equals(Object o) { return Objects.equals(this.str, requiredAndNullable.str) && Objects.equals(this._file, requiredAndNullable._file) && Objects.equals(this.color, requiredAndNullable.color) && - Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired) && + Objects.equals(this._list, requiredAndNullable._list); } @Override public int hashCode() { - return Objects.hash(str, _file, color, onlyRequired); + return Objects.hash(str, _file, color, onlyRequired, _list); } @Override @@ -194,6 +237,7 @@ public String toString() { sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); sb.append("}"); return sb.toString(); } @@ -234,6 +278,10 @@ public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { this.instance.onlyRequired = onlyRequired; return this; } + public RequiredAndNullable.Builder _list(@Nullable List _list) { + this.instance._list = _list; + return this; + } /** @@ -271,7 +319,8 @@ public RequiredAndNullable.Builder toBuilder() { .str(getStr()) ._file(getFile()) .color(getColor()) - .onlyRequired(getOnlyRequired()); + .onlyRequired(getOnlyRequired()) + ._list(getList()); } diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml index 73e28c50efc9..15c1f4176a50 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -218,6 +218,9 @@ components: file: "" color: red onlyRequired: onlyRequired + list: + - list + - list properties: str: nullable: true @@ -232,9 +235,15 @@ components: type: string onlyRequired: type: string + list: + items: + type: string + nullable: true + type: array required: - color - file + - list - onlyRequired - str type: object diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md index 520992382bdc..ff4ade0f226d 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullable.md @@ -11,6 +11,7 @@ |**_file** | **File** | | | |**color** | **String** | | | |**onlyRequired** | **String** | | | +|**_list** | **List<String>** | | | diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java index 01f44d88a37c..9c18ec5777e1 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/RequiredAndNullable.java @@ -20,6 +20,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.jspecify.annotations.Nullable; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -31,7 +34,8 @@ RequiredAndNullable.JSON_PROPERTY_STR, RequiredAndNullable.JSON_PROPERTY_FILE, RequiredAndNullable.JSON_PROPERTY_COLOR, - RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED + RequiredAndNullable.JSON_PROPERTY_ONLY_REQUIRED, + RequiredAndNullable.JSON_PROPERTY_LIST }) @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredAndNullable { @@ -51,17 +55,22 @@ public class RequiredAndNullable { private String onlyRequired; + public static final String JSON_PROPERTY_LIST = "list"; + + private @Nullable List _list; + public RequiredAndNullable() { } /** * Constructor with all args parameters */ - public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired) { + public RequiredAndNullable(@JsonProperty(JSON_PROPERTY_STR) @Nullable String str, @JsonProperty(JSON_PROPERTY_FILE) @Nullable File _file, @JsonProperty(JSON_PROPERTY_COLOR) @Nullable String color, @JsonProperty(JSON_PROPERTY_ONLY_REQUIRED) String onlyRequired, @JsonProperty(JSON_PROPERTY_LIST) @Nullable List _list) { this.str = str; this._file = _file; this.color = color; this.onlyRequired = onlyRequired; + this._list = _list; } public RequiredAndNullable str(@Nullable String str) { @@ -164,6 +173,39 @@ public void setOnlyRequired(String onlyRequired) { this.onlyRequired = onlyRequired; } + public RequiredAndNullable _list(@Nullable List _list) { + + this._list = _list; + return this; + } + + public RequiredAndNullable addListItem(String _listItem) { + if (this._list == null) { + this._list = new ArrayList<>(); + } + this._list.add(_listItem); + return this; + } + + /** + * Get _list + * @return _list + */ + + @JsonProperty(value = JSON_PROPERTY_LIST, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public @Nullable List getList() { + return _list; + } + + + @JsonProperty(value = JSON_PROPERTY_LIST, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setList(@Nullable List _list) { + this._list = _list; + } + @Override public boolean equals(Object o) { @@ -177,12 +219,13 @@ public boolean equals(Object o) { return Objects.equals(this.str, requiredAndNullable.str) && Objects.equals(this._file, requiredAndNullable._file) && Objects.equals(this.color, requiredAndNullable.color) && - Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired) && + Objects.equals(this._list, requiredAndNullable._list); } @Override public int hashCode() { - return Objects.hash(str, _file, color, onlyRequired); + return Objects.hash(str, _file, color, onlyRequired, _list); } @Override @@ -193,6 +236,7 @@ public String toString() { sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); sb.append("}"); return sb.toString(); } @@ -233,6 +277,10 @@ public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { this.instance.onlyRequired = onlyRequired; return this; } + public RequiredAndNullable.Builder _list(@Nullable List _list) { + this.instance._list = _list; + return this; + } /** @@ -270,7 +318,8 @@ public RequiredAndNullable.Builder toBuilder() { .str(getStr()) ._file(getFile()) .color(getColor()) - .onlyRequired(getOnlyRequired()); + .onlyRequired(getOnlyRequired()) + ._list(getList()); } diff --git a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java index 4cb6c72d1c7a..a2abc60038f5 100644 --- a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/EnumTest.java @@ -342,7 +342,7 @@ public EnumTest outerEnum(@javax.annotation.Nullable OuterEnum outerEnum) { * @return outerEnum */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public OuterEnum getOuterEnum() { diff --git a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java index fd3b4c322384..3acd36551d5c 100644 --- a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -55,7 +55,7 @@ public HealthCheckResult nullableMessage(@javax.annotation.Nullable String nulla * @return nullableMessage */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public String getNullableMessage() { diff --git a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java index de20b627ec8a..8ebf1367d7c1 100644 --- a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java @@ -121,7 +121,7 @@ public NullableClass integerProp(@javax.annotation.Nullable Integer integerProp) * @return integerProp */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public Integer getIntegerProp() { @@ -155,7 +155,7 @@ public NullableClass numberProp(@javax.annotation.Nullable BigDecimal numberProp * @return numberProp */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public BigDecimal getNumberProp() { @@ -189,7 +189,7 @@ public NullableClass booleanProp(@javax.annotation.Nullable Boolean booleanProp) * @return booleanProp */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public Boolean getBooleanProp() { @@ -223,7 +223,7 @@ public NullableClass stringProp(@javax.annotation.Nullable String stringProp) { * @return stringProp */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public String getStringProp() { @@ -257,7 +257,7 @@ public NullableClass dateProp(@javax.annotation.Nullable LocalDate dateProp) { * @return dateProp */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public LocalDate getDateProp() { @@ -291,7 +291,7 @@ public NullableClass datetimeProp(@javax.annotation.Nullable OffsetDateTime date * @return datetimeProp */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public OffsetDateTime getDatetimeProp() { @@ -337,7 +337,7 @@ public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { * @return arrayNullableProp */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public List getArrayNullableProp() { @@ -383,7 +383,7 @@ public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullab * @return arrayAndItemsNullableProp */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public List getArrayAndItemsNullableProp() { @@ -463,7 +463,7 @@ public NullableClass putObjectNullablePropItem(String key, Object objectNullable * @return objectNullableProp */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public Map getObjectNullableProp() { @@ -509,7 +509,7 @@ public NullableClass putObjectAndItemsNullablePropItem(String key, Object object * @return objectAndItemsNullableProp */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public Map getObjectAndItemsNullableProp() { diff --git a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java index 25f57e937f87..988db24f6d00 100644 --- a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java +++ b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/ParentWithNullable.java @@ -130,7 +130,7 @@ public ParentWithNullable nullableProperty(@javax.annotation.Nullable String nul * @return nullableProperty */ @javax.annotation.Nullable - @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "", nullable = true) @JsonIgnore public String getNullableProperty() { diff --git a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java index 53b64044c6e3..dab688a1d1c4 100644 --- a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java +++ b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java @@ -37,7 +37,7 @@ public class Pet { private @Nullable Category category; @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable name = JsonNullable.undefined(); + private JsonNullable name = null; @JsonInclude(JsonInclude.Include.NON_NULL) @Deprecated @@ -150,7 +150,7 @@ public Pet name(String name) { * @return name */ @NotNull - @Schema(name = "name", example = "doggie", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "name", example = "doggie", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("name") public JsonNullable getName() { return name; diff --git a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index d88271c2bf46..c52b38ad6425 100644 --- a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -32,7 +32,7 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); diff --git a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index fe0be24e229d..3b39c9708145 100644 --- a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -31,7 +31,7 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); diff --git a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index ca932fee5f0f..84e1fea8b5d8 100644 --- a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -30,7 +30,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 31a8133cb94f..cb9a2939949c 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -29,7 +29,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 31a8133cb94f..cb9a2939949c 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -29,7 +29,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); diff --git a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 219aeb0cd0ed..877b8520937c 100644 --- a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index fe0be24e229d..3b39c9708145 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -31,7 +31,7 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index fc4f770ac1d9..4105491f50a1 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 5e934e643224..8523b866ee91 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -60,7 +60,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -88,7 +88,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -146,7 +146,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/NullableMapProperty.java index 31127013b739..a2dd314abf7e 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ParentWithNullable.java index d394b3e38431..dd5243a5203a 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/RequiredAndNullableApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/RequiredAndNullableApi.java index 617b12cd447c..a7057ce15f82 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/RequiredAndNullableApi.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/RequiredAndNullableApi.java @@ -70,7 +70,7 @@ default ResponseEntity requiredAndNullablePost( getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "{ \"str\" : \"str\", \"file\" : \"\", \"color\" : \"red\", \"onlyRequired\" : \"onlyRequired\" }"; + String exampleString = "{ \"str\" : \"str\", \"file\" : \"\", \"color\" : \"red\", \"onlyRequired\" : \"onlyRequired\", \"list\" : [ \"list\", \"list\" ] }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java index 59f585f6eb8d..3e698bc233d9 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java @@ -131,7 +131,7 @@ public Foo nullableDt(java.time.@Nullable Instant nullableDt) { * @return nullableDt */ @Valid - @Schema(name = "nullableDt", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableDt", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableDt") @JacksonXmlProperty(localName = "nullableDt") @XmlElement(name = "nullableDt") @@ -177,7 +177,7 @@ public Foo nullableBinary(org.springframework.core.io.@Nullable Resource nullabl * @return nullableBinary */ @Valid - @Schema(name = "nullableBinary", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableBinary", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableBinary") @JacksonXmlProperty(localName = "nullableBinary") @XmlElement(name = "nullableBinary") @@ -275,7 +275,7 @@ public Foo addNullableListMinIntemsItem(java.time.Instant nullableListMinIntemsI * @return nullableListMinIntems */ @Valid @Size(min = 1) - @Schema(name = "nullableListMinIntems", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableListMinIntems", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableListMinIntems") @JacksonXmlProperty(localName = "nullableListMinIntems") @JacksonXmlElementWrapper(useWrapping = false) @@ -346,7 +346,7 @@ public Foo nullableNumber(java.math.@Nullable BigDecimal nullableNumber) { * @return nullableNumber */ @Valid - @Schema(name = "nullableNumber", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableNumber", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableNumber") @JacksonXmlProperty(localName = "nullableNumber") @XmlElement(name = "nullableNumber") @@ -416,7 +416,7 @@ public Foo nullableColor(@Nullable String nullableColor) { * @return nullableColor */ - @Schema(name = "nullableColor", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableColor", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableColor") @JacksonXmlProperty(localName = "nullableColor") @XmlElement(name = "nullableColor") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java index 7ef8508f4c61..2c6a044d8a07 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -4,6 +4,9 @@ import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.jspecify.annotations.Nullable; import org.openapitools.jackson.nullable.JsonNullable; import java.time.OffsetDateTime; @@ -29,14 +32,16 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredAndNullable { - private JsonNullable str = JsonNullable.undefined(); + private JsonNullable str = null; - private JsonNullable file = JsonNullable.undefined(); + private JsonNullable file = null; - private JsonNullable color = JsonNullable.undefined(); + private JsonNullable color = null; private String onlyRequired; + private JsonNullable> _list = null; + public RequiredAndNullable() { super(); } @@ -44,11 +49,12 @@ public RequiredAndNullable() { /** * Constructor with only required parameters and all parameters */ - public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired) { + public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired, @Nullable List _list) { this.str = JsonNullable.of(str); this.file = JsonNullable.of(file); this.color = JsonNullable.of(color); this.onlyRequired = onlyRequired; + this._list = JsonNullable.of(_list); } public RequiredAndNullable str(@Nullable String str) { @@ -61,7 +67,7 @@ public RequiredAndNullable str(@Nullable String str) { * @return str */ @NotNull - @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("str") @JacksonXmlProperty(localName = "str") @XmlElement(name = "str") @@ -85,7 +91,7 @@ public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource f * @return file */ @NotNull @Valid - @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("file") @JacksonXmlProperty(localName = "file") @XmlElement(name = "file") @@ -109,7 +115,7 @@ public RequiredAndNullable color(@Nullable String color) { * @return color */ @NotNull - @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("color") @JacksonXmlProperty(localName = "color") @XmlElement(name = "color") @@ -147,6 +153,40 @@ public void setOnlyRequired(String onlyRequired) { this.onlyRequired = onlyRequired; } + public RequiredAndNullable _list(@Nullable List _list) { + this._list = JsonNullable.of(_list); + return this; + } + + public RequiredAndNullable addListItem(String _listItem) { + if (this._list == null || !this._list.isPresent()) { + this._list = JsonNullable.of(new ArrayList<>()); + } + this._list.get().add(_listItem); + return this; + } + + /** + * Get _list + * @return _list + */ + @NotNull + @Schema(name = "list", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) + @JsonProperty("list") + @JacksonXmlProperty(localName = "list") + @JacksonXmlElementWrapper(useWrapping = false) + @XmlElement(name = "list") + public JsonNullable> getList() { + return _list; + } + + @JsonProperty("list") + @JacksonXmlProperty(localName = "list") + @JacksonXmlElementWrapper(useWrapping = false) + public void setList(JsonNullable> _list) { + this._list = _list; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -159,12 +199,13 @@ public boolean equals(Object o) { return Objects.equals(this.str, requiredAndNullable.str) && Objects.equals(this.file, requiredAndNullable.file) && Objects.equals(this.color, requiredAndNullable.color) && - Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired) && + Objects.equals(this._list, requiredAndNullable._list); } @Override public int hashCode() { - return Objects.hash(str, file, color, onlyRequired); + return Objects.hash(str, file, color, onlyRequired, _list); } @Override @@ -175,6 +216,7 @@ public String toString() { sb.append(" file: ").append(toIndentedString(file)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); sb.append("}"); return sb.toString(); } @@ -204,6 +246,7 @@ protected Builder copyOf(RequiredAndNullable value) { this.instance.setFile(value.file); this.instance.setColor(value.color); this.instance.setOnlyRequired(value.onlyRequired); + this.instance.setList(value._list); return this; } @@ -242,6 +285,16 @@ public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { return this; } + public RequiredAndNullable.Builder _list(@Nullable List _list) { + this.instance._list(_list); + return this; + } + + public RequiredAndNullable.Builder _list(JsonNullable> _list) { + this.instance._list = _list; + return this; + } + /** * returns a built RequiredAndNullable instance. * diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/RequiredAndNullableApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/RequiredAndNullableApi.java index 617b12cd447c..a7057ce15f82 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/RequiredAndNullableApi.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/RequiredAndNullableApi.java @@ -70,7 +70,7 @@ default ResponseEntity requiredAndNullablePost( getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "{ \"str\" : \"str\", \"file\" : \"\", \"color\" : \"red\", \"onlyRequired\" : \"onlyRequired\" }"; + String exampleString = "{ \"str\" : \"str\", \"file\" : \"\", \"color\" : \"red\", \"onlyRequired\" : \"onlyRequired\", \"list\" : [ \"list\", \"list\" ] }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java index 53fae78adf9f..df27e4b15416 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java @@ -131,7 +131,7 @@ public Foo nullableDt(java.time.@Nullable Instant nullableDt) { * @return nullableDt */ @Valid - @Schema(name = "nullableDt", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableDt", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableDt") @JacksonXmlProperty(localName = "nullableDt") @XmlElement(name = "nullableDt") @@ -177,7 +177,7 @@ public Foo nullableBinary(org.springframework.core.io.@Nullable Resource nullabl * @return nullableBinary */ @Valid - @Schema(name = "nullableBinary", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableBinary", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableBinary") @JacksonXmlProperty(localName = "nullableBinary") @XmlElement(name = "nullableBinary") @@ -275,7 +275,7 @@ public Foo addNullableListMinIntemsItem(java.time.Instant nullableListMinIntemsI * @return nullableListMinIntems */ @Valid @Size(min = 1) - @Schema(name = "nullableListMinIntems", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableListMinIntems", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableListMinIntems") @JacksonXmlProperty(localName = "nullableListMinIntems") @JacksonXmlElementWrapper(useWrapping = false) @@ -346,7 +346,7 @@ public Foo nullableNumber(java.math.@Nullable BigDecimal nullableNumber) { * @return nullableNumber */ @Valid - @Schema(name = "nullableNumber", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableNumber", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableNumber") @JacksonXmlProperty(localName = "nullableNumber") @XmlElement(name = "nullableNumber") @@ -416,7 +416,7 @@ public Foo nullableColor(@Nullable String nullableColor) { * @return nullableColor */ - @Schema(name = "nullableColor", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableColor", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableColor") @JacksonXmlProperty(localName = "nullableColor") @XmlElement(name = "nullableColor") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java index 7ef8508f4c61..2c6a044d8a07 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -4,6 +4,9 @@ import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.jspecify.annotations.Nullable; import org.openapitools.jackson.nullable.JsonNullable; import java.time.OffsetDateTime; @@ -29,14 +32,16 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredAndNullable { - private JsonNullable str = JsonNullable.undefined(); + private JsonNullable str = null; - private JsonNullable file = JsonNullable.undefined(); + private JsonNullable file = null; - private JsonNullable color = JsonNullable.undefined(); + private JsonNullable color = null; private String onlyRequired; + private JsonNullable> _list = null; + public RequiredAndNullable() { super(); } @@ -44,11 +49,12 @@ public RequiredAndNullable() { /** * Constructor with only required parameters and all parameters */ - public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired) { + public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired, @Nullable List _list) { this.str = JsonNullable.of(str); this.file = JsonNullable.of(file); this.color = JsonNullable.of(color); this.onlyRequired = onlyRequired; + this._list = JsonNullable.of(_list); } public RequiredAndNullable str(@Nullable String str) { @@ -61,7 +67,7 @@ public RequiredAndNullable str(@Nullable String str) { * @return str */ @NotNull - @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("str") @JacksonXmlProperty(localName = "str") @XmlElement(name = "str") @@ -85,7 +91,7 @@ public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource f * @return file */ @NotNull @Valid - @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("file") @JacksonXmlProperty(localName = "file") @XmlElement(name = "file") @@ -109,7 +115,7 @@ public RequiredAndNullable color(@Nullable String color) { * @return color */ @NotNull - @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("color") @JacksonXmlProperty(localName = "color") @XmlElement(name = "color") @@ -147,6 +153,40 @@ public void setOnlyRequired(String onlyRequired) { this.onlyRequired = onlyRequired; } + public RequiredAndNullable _list(@Nullable List _list) { + this._list = JsonNullable.of(_list); + return this; + } + + public RequiredAndNullable addListItem(String _listItem) { + if (this._list == null || !this._list.isPresent()) { + this._list = JsonNullable.of(new ArrayList<>()); + } + this._list.get().add(_listItem); + return this; + } + + /** + * Get _list + * @return _list + */ + @NotNull + @Schema(name = "list", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) + @JsonProperty("list") + @JacksonXmlProperty(localName = "list") + @JacksonXmlElementWrapper(useWrapping = false) + @XmlElement(name = "list") + public JsonNullable> getList() { + return _list; + } + + @JsonProperty("list") + @JacksonXmlProperty(localName = "list") + @JacksonXmlElementWrapper(useWrapping = false) + public void setList(JsonNullable> _list) { + this._list = _list; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -159,12 +199,13 @@ public boolean equals(Object o) { return Objects.equals(this.str, requiredAndNullable.str) && Objects.equals(this.file, requiredAndNullable.file) && Objects.equals(this.color, requiredAndNullable.color) && - Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired) && + Objects.equals(this._list, requiredAndNullable._list); } @Override public int hashCode() { - return Objects.hash(str, file, color, onlyRequired); + return Objects.hash(str, file, color, onlyRequired, _list); } @Override @@ -175,6 +216,7 @@ public String toString() { sb.append(" file: ").append(toIndentedString(file)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); sb.append("}"); return sb.toString(); } @@ -204,6 +246,7 @@ protected Builder copyOf(RequiredAndNullable value) { this.instance.setFile(value.file); this.instance.setColor(value.color); this.instance.setOnlyRequired(value.onlyRequired); + this.instance.setList(value._list); return this; } @@ -242,6 +285,16 @@ public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { return this; } + public RequiredAndNullable.Builder _list(@Nullable List _list) { + this.instance._list(_list); + return this; + } + + public RequiredAndNullable.Builder _list(JsonNullable> _list) { + this.instance._list = _list; + return this; + } + /** * returns a built RequiredAndNullable instance. * diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/RequiredAndNullableApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/RequiredAndNullableApi.java index 617b12cd447c..a7057ce15f82 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/RequiredAndNullableApi.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/RequiredAndNullableApi.java @@ -70,7 +70,7 @@ default ResponseEntity requiredAndNullablePost( getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - String exampleString = "{ \"str\" : \"str\", \"file\" : \"\", \"color\" : \"red\", \"onlyRequired\" : \"onlyRequired\" }"; + String exampleString = "{ \"str\" : \"str\", \"file\" : \"\", \"color\" : \"red\", \"onlyRequired\" : \"onlyRequired\", \"list\" : [ \"list\", \"list\" ] }"; ApiUtil.setExampleResponse(request, "application/json", exampleString); break; } diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java index 41b025136ba6..5977f48d0055 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/Foo.java @@ -145,7 +145,7 @@ public Foo nullableDt(java.time.@Nullable Instant nullableDt) { * @return nullableDt */ @Valid - @Schema(name = "nullableDt", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableDt", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableDt") @JacksonXmlProperty(localName = "nullableDt") @XmlElement(name = "nullableDt") @@ -193,7 +193,7 @@ public Foo nullableBinary(org.springframework.core.io.@Nullable Resource nullabl * @return nullableBinary */ @Valid - @Schema(name = "nullableBinary", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableBinary", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableBinary") @JacksonXmlProperty(localName = "nullableBinary") @XmlElement(name = "nullableBinary") @@ -293,7 +293,7 @@ public Foo addNullableListMinIntemsItem(java.time.Instant nullableListMinIntemsI * @return nullableListMinIntems */ @Valid @Size(min = 1) - @Schema(name = "nullableListMinIntems", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableListMinIntems", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableListMinIntems") @JacksonXmlProperty(localName = "nullableListMinIntems") @JacksonXmlElementWrapper(useWrapping = false) @@ -367,7 +367,7 @@ public Foo nullableNumber(java.math.@Nullable BigDecimal nullableNumber) { * @return nullableNumber */ @Valid - @Schema(name = "nullableNumber", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableNumber", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableNumber") @JacksonXmlProperty(localName = "nullableNumber") @XmlElement(name = "nullableNumber") @@ -439,7 +439,7 @@ public Foo nullableColor(@Nullable String nullableColor) { * @return nullableColor */ - @Schema(name = "nullableColor", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableColor", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableColor") @JacksonXmlProperty(localName = "nullableColor") @XmlElement(name = "nullableColor") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java index 5d40a6b2b546..1629985f9c71 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -5,6 +5,9 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.jspecify.annotations.Nullable; import java.time.OffsetDateTime; import jakarta.validation.Valid; @@ -41,6 +44,9 @@ public class RequiredAndNullable { @JsonInclude(JsonInclude.Include.NON_NULL) private String onlyRequired; + @JsonInclude(JsonInclude.Include.ALWAYS) + private @Nullable List _list; + public RequiredAndNullable() { super(); } @@ -48,11 +54,12 @@ public RequiredAndNullable() { /** * Constructor with only required parameters and all parameters */ - public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired) { + public RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired, @Nullable List _list) { this.str = str; this.file = file; this.color = color; this.onlyRequired = onlyRequired; + this._list = _list; } public RequiredAndNullable str(@Nullable String str) { @@ -65,7 +72,7 @@ public RequiredAndNullable str(@Nullable String str) { * @return str */ - @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("str") @JacksonXmlProperty(localName = "str") @XmlElement(name = "str") @@ -89,7 +96,7 @@ public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource f * @return file */ @Valid - @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("file") @JacksonXmlProperty(localName = "file") @XmlElement(name = "file") @@ -113,7 +120,7 @@ public RequiredAndNullable color(@Nullable String color) { * @return color */ - @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("color") @JacksonXmlProperty(localName = "color") @XmlElement(name = "color") @@ -151,6 +158,40 @@ public void setOnlyRequired(String onlyRequired) { this.onlyRequired = onlyRequired; } + public RequiredAndNullable _list(@Nullable List _list) { + this._list = _list; + return this; + } + + public RequiredAndNullable addListItem(String _listItem) { + if (this._list == null) { + this._list = new ArrayList<>(); + } + this._list.add(_listItem); + return this; + } + + /** + * Get _list + * @return _list + */ + + @Schema(name = "list", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) + @JsonProperty("list") + @JacksonXmlProperty(localName = "list") + @JacksonXmlElementWrapper(useWrapping = false) + @XmlElement(name = "list") + public @Nullable List getList() { + return _list; + } + + @JsonProperty("list") + @JacksonXmlProperty(localName = "list") + @JacksonXmlElementWrapper(useWrapping = false) + public void setList(@Nullable List _list) { + this._list = _list; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -163,12 +204,13 @@ public boolean equals(Object o) { return Objects.equals(this.str, requiredAndNullable.str) && Objects.equals(this.file, requiredAndNullable.file) && Objects.equals(this.color, requiredAndNullable.color) && - Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired); + Objects.equals(this.onlyRequired, requiredAndNullable.onlyRequired) && + Objects.equals(this._list, requiredAndNullable._list); } @Override public int hashCode() { - return Objects.hash(str, file, color, onlyRequired); + return Objects.hash(str, file, color, onlyRequired, _list); } @Override @@ -179,6 +221,7 @@ public String toString() { sb.append(" file: ").append(toIndentedString(file)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" onlyRequired: ").append(toIndentedString(onlyRequired)).append("\n"); + sb.append(" _list: ").append(toIndentedString(_list)).append("\n"); sb.append("}"); return sb.toString(); } @@ -208,6 +251,7 @@ protected Builder copyOf(RequiredAndNullable value) { this.instance.setFile(value.file); this.instance.setColor(value.color); this.instance.setOnlyRequired(value.onlyRequired); + this.instance.setList(value._list); return this; } @@ -231,6 +275,11 @@ public RequiredAndNullable.Builder onlyRequired(String onlyRequired) { return this; } + public RequiredAndNullable.Builder _list(@Nullable List _list) { + this.instance._list(_list); + return this; + } + /** * returns a built RequiredAndNullable instance. * diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index fc4f770ac1d9..4105491f50a1 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..8f543f3a2c60 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -68,7 +68,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -96,7 +96,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -154,7 +154,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java index 31127013b739..a2dd314abf7e 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java index d394b3e38431..dd5243a5203a 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index fc4f770ac1d9..4105491f50a1 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..8f543f3a2c60 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -68,7 +68,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -96,7 +96,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -154,7 +154,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java index 31127013b739..a2dd314abf7e 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ParentWithNullable.java index d394b3e38431..dd5243a5203a 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index fc4f770ac1d9..4105491f50a1 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..8f543f3a2c60 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -68,7 +68,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -96,7 +96,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -154,7 +154,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/NullableMapProperty.java index 31127013b739..a2dd314abf7e 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ParentWithNullable.java index d394b3e38431..dd5243a5203a 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/spring-boot-nullable-set/src/main/java/org/openapitools/model/ObjectWithUniqueItems.java b/samples/server/petstore/spring-boot-nullable-set/src/main/java/org/openapitools/model/ObjectWithUniqueItems.java index 430f680158d4..802d49ac4f14 100644 --- a/samples/server/petstore/spring-boot-nullable-set/src/main/java/org/openapitools/model/ObjectWithUniqueItems.java +++ b/samples/server/petstore/spring-boot-nullable-set/src/main/java/org/openapitools/model/ObjectWithUniqueItems.java @@ -69,7 +69,7 @@ public ObjectWithUniqueItems addNullSetItem(String nullSetItem) { * @return nullSet */ - @Schema(name = "nullSet", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullSet", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullSet") public JsonNullable> getNullSet() { return nullSet; @@ -127,7 +127,7 @@ public ObjectWithUniqueItems addNullListItem(String nullListItem) { * @return nullList */ - @Schema(name = "nullList", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullList", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullList") public JsonNullable> getNullList() { return nullList; diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index 8c8fef587001..047b517697a9 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -333,7 +333,7 @@ public AdditionalPropertiesClass anytype2(@Nullable Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public @Nullable Object getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ContainerDefaultValue.java index ea864f192024..d662c38a4a75 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -65,7 +65,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public @Nullable List getNullableArray() { return nullableArray; @@ -94,7 +94,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public List getNullableRequiredArray() { return nullableRequiredArray; @@ -152,7 +152,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public @Nullable List getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/NullableMapProperty.java index 855c53622446..0c9a62ab9578 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -43,7 +43,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public @Nullable Map getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ParentWithNullable.java index 032a06cb2a2b..069e175455ce 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -107,7 +107,7 @@ public ParentWithNullable nullableProperty(@Nullable String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public @Nullable String getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index fc4f770ac1d9..4105491f50a1 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..8f543f3a2c60 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -68,7 +68,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -96,7 +96,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -154,7 +154,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NullableMapProperty.java index 31127013b739..a2dd314abf7e 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ParentWithNullable.java index d394b3e38431..dd5243a5203a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index fc4f770ac1d9..4105491f50a1 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..8f543f3a2c60 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -68,7 +68,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -96,7 +96,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -154,7 +154,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/NullableMapProperty.java index 31127013b739..a2dd314abf7e 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ParentWithNullable.java index d394b3e38431..dd5243a5203a 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index fc4f770ac1d9..4105491f50a1 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..8f543f3a2c60 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -68,7 +68,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -96,7 +96,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -154,7 +154,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NullableMapProperty.java index 31127013b739..a2dd314abf7e 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ParentWithNullable.java index d394b3e38431..dd5243a5203a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index 32023ee3da1e..8f54cd848b67 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -346,7 +346,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index b6557ceff4e9..cf7b17976a31 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -78,7 +78,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -106,7 +106,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -164,7 +164,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java index e2ceeea637fe..c10cb4316340 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -58,7 +58,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java index 50c34a0c9121..dfa072f98090 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -120,7 +120,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index 3f6cf5af234f..d8c6725ed27c 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 1e996c854efe..5b25728b2a78 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -68,7 +68,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -96,7 +96,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -154,7 +154,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java index 56d45c3ad292..150e1756a665 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ParentWithNullable.java index af16949486cc..75408c9a5421 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/AdditionalPropertiesClassDto.java b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/AdditionalPropertiesClassDto.java index 9ea7f74985a9..4b738ea3239f 100644 --- a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/AdditionalPropertiesClassDto.java +++ b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/AdditionalPropertiesClassDto.java @@ -327,7 +327,7 @@ public AdditionalPropertiesClassDto anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 2bc02f7a7cc3..77153c6c94de 100644 --- a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -33,7 +33,7 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -70,7 +70,7 @@ public ContainerDefaultValueDto addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -98,7 +98,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -156,7 +156,7 @@ public ContainerDefaultValueDto addNullableArrayWithDefaultItem(String nullableA * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/NullableMapPropertyDto.java b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/NullableMapPropertyDto.java index 98ba228cdc9b..02d489f90cea 100644 --- a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/NullableMapPropertyDto.java +++ b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/NullableMapPropertyDto.java @@ -49,7 +49,7 @@ public NullableMapPropertyDto putLanguageValuesItem(String key, String languageV * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ParentWithNullableDto.java b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ParentWithNullableDto.java index 982f8d038258..213234e9599f 100644 --- a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ParentWithNullableDto.java +++ b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ParentWithNullableDto.java @@ -109,7 +109,7 @@ public ParentWithNullableDto nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index fc4f770ac1d9..4105491f50a1 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..8f543f3a2c60 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -68,7 +68,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -96,7 +96,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -154,7 +154,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java index 31127013b739..a2dd314abf7e 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ParentWithNullable.java index d394b3e38431..dd5243a5203a 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index fc4f770ac1d9..4105491f50a1 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a51bd99c90fc..8f543f3a2c60 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -68,7 +68,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -96,7 +96,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -154,7 +154,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java index 31127013b739..a2dd314abf7e 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ParentWithNullable.java index d394b3e38431..dd5243a5203a 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java b/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java index e6fa1ccea8b4..b9ba2773eed6 100644 --- a/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java +++ b/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java @@ -32,7 +32,7 @@ public class NullableModel implements Serializable { private String requiredNonNullable; @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable requiredNullable = JsonNullable.undefined(); + private JsonNullable requiredNullable = null; @JsonInclude(JsonInclude.Include.NON_NULL) private @Nullable String optionalNonNullable; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java index f28336e48905..0bc3c35c6272 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 89a4873f502e..0a565f396ad8 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -68,7 +68,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -96,7 +96,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -154,7 +154,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java index 1c8b66beb4e6..a89422830152 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java index db85e72833c9..2258fe6d6c95 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AdditionalPropertiesClass.java index 51f8239e6287..283ef0c9edf8 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AdditionalPropertiesClass.java @@ -325,7 +325,7 @@ public AdditionalPropertiesClass anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java index 2bd4f51c4140..eeff01ae5184 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -68,7 +68,7 @@ public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -96,7 +96,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -154,7 +154,7 @@ public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArra * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/NullableMapProperty.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/NullableMapProperty.java index fc013fe70f4c..72c5788f5b22 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/NullableMapProperty.java @@ -47,7 +47,7 @@ public NullableMapProperty putLanguageValuesItem(String key, String languageValu * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ParentWithNullable.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ParentWithNullable.java index bb28729decdd..c8ccf5a155c1 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ParentWithNullable.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ParentWithNullable.java @@ -108,7 +108,7 @@ public ParentWithNullable nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/EnumTestDto.java b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/EnumTestDto.java index 1576c5046e33..4b646de3b597 100644 --- a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/EnumTestDto.java +++ b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/EnumTestDto.java @@ -305,7 +305,7 @@ public EnumTestDto outerEnum(OuterEnumDto outerEnum) { * @return outerEnum */ @Valid - @Schema(name = "outerEnum", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "outerEnum", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("outerEnum") public JsonNullable getOuterEnum() { return outerEnum; diff --git a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/HealthCheckResultDto.java b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/HealthCheckResultDto.java index ac09a0a9834b..edb49de12b67 100644 --- a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/HealthCheckResultDto.java +++ b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/HealthCheckResultDto.java @@ -40,7 +40,7 @@ public HealthCheckResultDto nullableMessage(String nullableMessage) { * @return nullableMessage */ - @Schema(name = "NullableMessage", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "NullableMessage", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("NullableMessage") public JsonNullable getNullableMessage() { return nullableMessage; diff --git a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/NullableClassDto.java b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/NullableClassDto.java index 55fe5702be7f..330fa927f04a 100644 --- a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/NullableClassDto.java +++ b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/NullableClassDto.java @@ -78,7 +78,7 @@ public NullableClassDto integerProp(Integer integerProp) { * @return integerProp */ - @Schema(name = "integer_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "integer_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("integer_prop") public JsonNullable getIntegerProp() { return integerProp; @@ -98,7 +98,7 @@ public NullableClassDto numberProp(BigDecimal numberProp) { * @return numberProp */ @Valid - @Schema(name = "number_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "number_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("number_prop") public JsonNullable getNumberProp() { return numberProp; @@ -118,7 +118,7 @@ public NullableClassDto booleanProp(Boolean booleanProp) { * @return booleanProp */ - @Schema(name = "boolean_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "boolean_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("boolean_prop") public JsonNullable getBooleanProp() { return booleanProp; @@ -138,7 +138,7 @@ public NullableClassDto stringProp(String stringProp) { * @return stringProp */ - @Schema(name = "string_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "string_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("string_prop") public JsonNullable getStringProp() { return stringProp; @@ -158,7 +158,7 @@ public NullableClassDto dateProp(LocalDate dateProp) { * @return dateProp */ @Valid - @Schema(name = "date_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "date_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("date_prop") public JsonNullable getDateProp() { return dateProp; @@ -178,7 +178,7 @@ public NullableClassDto datetimeProp(OffsetDateTime datetimeProp) { * @return datetimeProp */ @Valid - @Schema(name = "datetime_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "datetime_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("datetime_prop") public JsonNullable getDatetimeProp() { return datetimeProp; @@ -206,7 +206,7 @@ public NullableClassDto addArrayNullablePropItem(Object arrayNullablePropItem) { * @return arrayNullableProp */ - @Schema(name = "array_nullable_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "array_nullable_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("array_nullable_prop") public JsonNullable> getArrayNullableProp() { return arrayNullableProp; @@ -234,7 +234,7 @@ public NullableClassDto addArrayAndItemsNullablePropItem(Object arrayAndItemsNul * @return arrayAndItemsNullableProp */ - @Schema(name = "array_and_items_nullable_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "array_and_items_nullable_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("array_and_items_nullable_prop") public JsonNullable> getArrayAndItemsNullableProp() { return arrayAndItemsNullableProp; @@ -291,7 +291,7 @@ public NullableClassDto putObjectNullablePropItem(String key, Object objectNulla * @return objectNullableProp */ - @Schema(name = "object_nullable_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "object_nullable_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("object_nullable_prop") public JsonNullable> getObjectNullableProp() { return objectNullableProp; @@ -319,7 +319,7 @@ public NullableClassDto putObjectAndItemsNullablePropItem(String key, Object obj * @return objectAndItemsNullableProp */ - @Schema(name = "object_and_items_nullable_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "object_and_items_nullable_prop", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("object_and_items_nullable_prop") public JsonNullable> getObjectAndItemsNullableProp() { return objectAndItemsNullableProp; diff --git a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/ParentWithNullableDto.java b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/ParentWithNullableDto.java index 982f8d038258..213234e9599f 100644 --- a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/ParentWithNullableDto.java +++ b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/ParentWithNullableDto.java @@ -109,7 +109,7 @@ public ParentWithNullableDto nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/AdditionalPropertiesClassDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/AdditionalPropertiesClassDto.java index 3115be7ad0b3..54a246e65c81 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/AdditionalPropertiesClassDto.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/AdditionalPropertiesClassDto.java @@ -327,7 +327,7 @@ public AdditionalPropertiesClassDto anytype2(Object anytype2) { * @return anytype2 */ - @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "anytype_2", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("anytype_2") public JsonNullable getAnytype2() { return anytype2; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 39f4e40b9ba0..eb832c43215d 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -33,7 +33,7 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); + private JsonNullable> nullableRequiredArray = null; @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -70,7 +70,7 @@ public ContainerDefaultValueDto addNullableArrayItem(String nullableArrayItem) { * @return nullableArray */ - @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array") public JsonNullable> getNullableArray() { return nullableArray; @@ -98,7 +98,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * @return nullableRequiredArray */ @NotNull - @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; @@ -156,7 +156,7 @@ public ContainerDefaultValueDto addNullableArrayWithDefaultItem(String nullableA * @return nullableArrayWithDefault */ - @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullable_array_with_default", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullable_array_with_default") public JsonNullable> getNullableArrayWithDefault() { return nullableArrayWithDefault; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NullableMapPropertyDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NullableMapPropertyDto.java index 50958c247610..f521013a9035 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NullableMapPropertyDto.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NullableMapPropertyDto.java @@ -49,7 +49,7 @@ public NullableMapPropertyDto putLanguageValuesItem(String key, String languageV * @return languageValues */ - @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "languageValues", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("languageValues") public JsonNullable> getLanguageValues() { return languageValues; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ParentWithNullableDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ParentWithNullableDto.java index af2b3803d750..590d7f63bc93 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ParentWithNullableDto.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ParentWithNullableDto.java @@ -110,7 +110,7 @@ public ParentWithNullableDto nullableProperty(String nullableProperty) { * @return nullableProperty */ - @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Schema(name = "nullableProperty", requiredMode = Schema.RequiredMode.NOT_REQUIRED, nullable = true) @JsonProperty("nullableProperty") public JsonNullable getNullableProperty() { return nullableProperty; From b3f6f5ef023e36f5360d24c553f0ad7f80c1e99c Mon Sep 17 00:00:00 2001 From: jpfinne Date: Sun, 16 Aug 2026 15:55:13 +0200 Subject: [PATCH 15/17] Rollback: @NotNull should not be present for required+nullable + openapiNullable --- .../main/resources/JavaSpring/notNull.mustache | 2 +- .../src/main/resources/JavaSpring/pojo.mustache | 4 ++-- .../codegen/java/spring/SpringCodegenTest.java | 10 +++++----- .../main/java/org/openapitools/model/Pet.java | 4 ++-- .../model/ContainerDefaultValueDto.java | 4 ++-- .../model/ContainerDefaultValueDto.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValueDto.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../openapitools/model/RequiredAndNullable.java | 16 ++++++++-------- .../openapitools/model/RequiredAndNullable.java | 16 ++++++++-------- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValueDto.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../org/openapitools/model/NullableModel.java | 4 ++-- .../model/ContainerDefaultValue.java | 4 ++-- .../virtualan/model/ContainerDefaultValue.java | 4 ++-- .../model/ContainerDefaultValueDto.java | 4 ++-- 29 files changed, 72 insertions(+), 72 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache index bcfeee53e15f..c74f667e8a87 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache @@ -1 +1 @@ -{{#required}}{{^isReadOnly}}{{#isNullable}}{{#openApiNullable}}@NotNull {{/openApiNullable}}{{/isNullable}}{{^isNullable}}@NotNull {{/isNullable}}{{/isReadOnly}}{{/required}} \ No newline at end of file +{{#required}}{{^isReadOnly}}{{^isNullable}}@NotNull {{/isNullable}}{{/isReadOnly}}{{/required}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index 81ebc104782c..f12c42fc3872 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -77,7 +77,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} {{/deprecated}} {{#isContainer}} {{#openApiNullable}} - private {{>nullableAnnotation}}{{#isNullable}}{{>nullableDataTypeBeanValidation}} {{name}} = {{#required}}null{{/required}}{{^required}}JsonNullable.<{{{datatypeWithEnum}}}>undefined(){{/required}};{{/isNullable}}{{^required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/isNullable}}{{/required}}{{#required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/isNullable}}{{/required}} + private {{>nullableAnnotation}}{{#isNullable}}{{>nullableDataTypeBeanValidation}} {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();{{/isNullable}}{{^required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/isNullable}}{{/required}}{{#required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/isNullable}}{{/required}} {{/openApiNullable}} {{^openApiNullable}} private {{>nullableAnnotation}}{{>nullableDataType}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; @@ -91,7 +91,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) {{/isDateTime}} {{#openApiNullable}} - private {{>nullableAnnotation}}{{#isNullable}}{{>nullableDataTypeBeanValidation}} {{name}} = {{#required}}null{{/required}}{{^required}}JsonNullable.<{{{datatypeWithEnum}}}>undefined(){{/required}};{{/isNullable}}{{^required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#useOptional}} = Optional.{{^defaultValue}}empty(){{/defaultValue}}{{#defaultValue}}of({{{.}}}){{/defaultValue}};{{/useOptional}}{{^useOptional}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/useOptional}}{{/isNullable}}{{/required}}{{^isNullable}}{{#required}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/required}}{{/isNullable}} + private {{>nullableAnnotation}}{{#isNullable}}{{>nullableDataTypeBeanValidation}} {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();{{/isNullable}}{{^required}}{{^isNullable}}{{>nullableDataTypeBeanValidation}} {{name}}{{#useOptional}} = Optional.{{^defaultValue}}empty(){{/defaultValue}}{{#defaultValue}}of({{{.}}}){{/defaultValue}};{{/useOptional}}{{^useOptional}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/useOptional}}{{/isNullable}}{{/required}}{{^isNullable}}{{#required}}{{>nullableDataTypeBeanValidation}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/required}}{{/isNullable}} {{/openApiNullable}} {{^openApiNullable}} private {{>nullableAnnotation}}{{>nullableDataType}} {{name}}{{#isNullable}} = null{{/isNullable}}{{^isNullable}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isNullable}}; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 52fa93744e51..e1052a481d8a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -7283,14 +7283,14 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) ); JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) .fileContains( - "private JsonNullable str = null;", - "private JsonNullable> _list = null;", + "private JsonNullable str = JsonNullable.undefined();", + "private JsonNullable> _list = JsonNullable.>undefined();", "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired, @Nullable List _list)", "JsonNullable getStr()", "void setStr(JsonNullable str)", "RequiredAndNullable str(@Nullable String str)", "RequiredAndNullable.Builder str(@Nullable String str)" - ).assertMethod("getStr").assertMethodAnnotations().containsWithName("NotNull"); + ).assertMethod("getStr").assertMethodAnnotations().doesNotContainWithName("NotNull"); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) @@ -7379,13 +7379,13 @@ public void testJspecify_useOptional(String library, int springBootVersion, bool ); JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) .fileContains( - "private JsonNullable str = null;", + "private JsonNullable str = JsonNullable.undefined();", "RequiredAndNullable(@Nullable String str, org.springframework.core.io.@Nullable Resource file, @Nullable String color, String onlyRequired, @Nullable List _list)", "JsonNullable getStr()", "void setStr(JsonNullable str)", "RequiredAndNullable str(@Nullable String str)", "RequiredAndNullable.Builder str(@Nullable String str)" - ).assertMethod("getStr").assertMethodAnnotations().containsWithName("NotNull"); + ).assertMethod("getStr").assertMethodAnnotations().doesNotContainWithName("NotNull"); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); JavaFileAssert.assertThat(files.get("model/package-info.java")) diff --git a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java index dab688a1d1c4..10897fc4fcb9 100644 --- a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java +++ b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java @@ -37,7 +37,7 @@ public class Pet { private @Nullable Category category; @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable name = null; + private JsonNullable name = JsonNullable.undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) @Deprecated @@ -149,7 +149,7 @@ public Pet name(String name) { * Get name * @return name */ - @NotNull + @Schema(name = "name", example = "doggie", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("name") public JsonNullable getName() { diff --git a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index c52b38ad6425..e4a2fca878d3 100644 --- a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -32,7 +32,7 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -87,7 +87,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 3b39c9708145..239c584e3950 100644 --- a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -31,7 +31,7 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -86,7 +86,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 84e1fea8b5d8..5b41cd4b3bc8 100644 --- a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -30,7 +30,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -93,7 +93,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index cb9a2939949c..6e358ec3540d 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -29,7 +29,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -92,7 +92,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index cb9a2939949c..6e358ec3540d 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -29,7 +29,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -92,7 +92,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 877b8520937c..553e2044e909 100644 --- a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -94,7 +94,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 3b39c9708145..239c584e3950 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -31,7 +31,7 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -86,7 +86,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 8523b866ee91..b42d60e67cb6 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -87,7 +87,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java index 2c6a044d8a07..c13dc0f82aa6 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -32,15 +32,15 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredAndNullable { - private JsonNullable str = null; + private JsonNullable str = JsonNullable.undefined(); - private JsonNullable file = null; + private JsonNullable file = JsonNullable.undefined(); - private JsonNullable color = null; + private JsonNullable color = JsonNullable.undefined(); private String onlyRequired; - private JsonNullable> _list = null; + private JsonNullable> _list = JsonNullable.>undefined(); public RequiredAndNullable() { super(); @@ -66,7 +66,7 @@ public RequiredAndNullable str(@Nullable String str) { * Get str * @return str */ - @NotNull + @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("str") @JacksonXmlProperty(localName = "str") @@ -90,7 +90,7 @@ public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource f * Get file * @return file */ - @NotNull @Valid + @Valid @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("file") @JacksonXmlProperty(localName = "file") @@ -114,7 +114,7 @@ public RequiredAndNullable color(@Nullable String color) { * Get color * @return color */ - @NotNull + @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("color") @JacksonXmlProperty(localName = "color") @@ -170,7 +170,7 @@ public RequiredAndNullable addListItem(String _listItem) { * Get _list * @return _list */ - @NotNull + @Schema(name = "list", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("list") @JacksonXmlProperty(localName = "list") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java index 2c6a044d8a07..c13dc0f82aa6 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -32,15 +32,15 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredAndNullable { - private JsonNullable str = null; + private JsonNullable str = JsonNullable.undefined(); - private JsonNullable file = null; + private JsonNullable file = JsonNullable.undefined(); - private JsonNullable color = null; + private JsonNullable color = JsonNullable.undefined(); private String onlyRequired; - private JsonNullable> _list = null; + private JsonNullable> _list = JsonNullable.>undefined(); public RequiredAndNullable() { super(); @@ -66,7 +66,7 @@ public RequiredAndNullable str(@Nullable String str) { * Get str * @return str */ - @NotNull + @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("str") @JacksonXmlProperty(localName = "str") @@ -90,7 +90,7 @@ public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource f * Get file * @return file */ - @NotNull @Valid + @Valid @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("file") @JacksonXmlProperty(localName = "file") @@ -114,7 +114,7 @@ public RequiredAndNullable color(@Nullable String color) { * Get color * @return color */ - @NotNull + @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("color") @JacksonXmlProperty(localName = "color") @@ -170,7 +170,7 @@ public RequiredAndNullable addListItem(String _listItem) { * Get _list * @return _list */ - @NotNull + @Schema(name = "list", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("list") @JacksonXmlProperty(localName = "list") diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 8f543f3a2c60..037685ee09ca 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 8f543f3a2c60..037685ee09ca 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 8f543f3a2c60..037685ee09ca 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 8f543f3a2c60..037685ee09ca 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 8f543f3a2c60..037685ee09ca 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 8f543f3a2c60..037685ee09ca 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index cf7b17976a31..8661a7032ca0 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -105,7 +105,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 5b25728b2a78..94b54f884ae4 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 77153c6c94de..978f7a735e38 100644 --- a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -33,7 +33,7 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -97,7 +97,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 8f543f3a2c60..037685ee09ca 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 8f543f3a2c60..037685ee09ca 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java b/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java index b9ba2773eed6..f027e0295735 100644 --- a/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java +++ b/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java @@ -32,7 +32,7 @@ public class NullableModel implements Serializable { private String requiredNonNullable; @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable requiredNullable = null; + private JsonNullable requiredNullable = JsonNullable.undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private @Nullable String optionalNonNullable; @@ -80,7 +80,7 @@ public NullableModel requiredNullable(String requiredNullable) { * Get requiredNullable * @return requiredNullable */ - @NotNull + @JsonProperty("requiredNullable") public JsonNullable getRequiredNullable() { return requiredNullable; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 0a565f396ad8..51c58fff7441 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java index eeff01ae5184..303e7bca4c39 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java @@ -31,7 +31,7 @@ public class ContainerDefaultValue { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index eb832c43215d..2754cf81224d 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -33,7 +33,7 @@ public class ContainerDefaultValueDto { private JsonNullable> nullableArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.ALWAYS) - private JsonNullable> nullableRequiredArray = null; + private JsonNullable> nullableRequiredArray = JsonNullable.>undefined(); @JsonInclude(JsonInclude.Include.NON_NULL) private List requiredArray = new ArrayList<>(); @@ -97,7 +97,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - @NotNull + @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { From 2257028a4e05c532d1470a8c41ceaf8524b0851f Mon Sep 17 00:00:00 2001 From: jpfinne Date: Sun, 16 Aug 2026 16:29:23 +0200 Subject: [PATCH 16/17] Fix a NPE in add and put item --- .../src/main/resources/Java/libraries/feign/pojo.mustache | 4 ++-- .../main/resources/Java/libraries/jersey2/pojo.mustache | 4 ++-- .../main/resources/Java/libraries/jersey3/pojo.mustache | 4 ++-- .../main/resources/Java/libraries/native/pojo.mustache | 4 ++-- .../resources/Java/libraries/restclient/pojo.mustache | 4 ++-- .../resources/Java/libraries/resttemplate/pojo.mustache | 4 ++-- .../main/resources/Java/libraries/webclient/pojo.mustache | 4 ++-- .../src/main/resources/Java/pojo.mustache | 4 ++-- .../src/main/resources/JavaSpring/pojo.mustache | 4 ++-- .../openapitools/codegen/java/JavaClientCodegenTest.java | 2 +- .../java/org/openapitools/client/model/DefaultValue.java | 4 ++-- .../java/org/openapitools/client/model/DefaultValue.java | 4 ++-- .../java/org/openapitools/client/model/DefaultValue.java | 4 ++-- .../java/org/openapitools/client/model/DefaultValue.java | 4 ++-- .../java/org/openapitools/client/model/DefaultValue.java | 4 ++-- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../src/main/java/org/openapitools/client/model/Foo.java | 2 +- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../org/openapitools/model/ContainerDefaultValueDto.java | 6 +++--- .../org/openapitools/model/NullableMapPropertyDto.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 6 +++--- .../org/openapitools/model/NullableMapPropertyDto.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 6 +++--- .../org/openapitools/model/NullableMapPropertyDto.java | 2 +- .../java/org/openapitools/client/model/NullableClass.java | 8 ++++---- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../src/main/java/org/openapitools/model/Foo.java | 2 +- .../java/org/openapitools/model/RequiredAndNullable.java | 2 +- .../src/main/java/org/openapitools/model/Foo.java | 2 +- .../java/org/openapitools/model/RequiredAndNullable.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ObjectWithUniqueItems.java | 4 ++-- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 6 +++--- .../org/openapitools/model/NullableMapPropertyDto.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 6 +++--- .../java/org/openapitools/model/NullableMapProperty.java | 2 +- .../virtualan/model/ContainerDefaultValue.java | 6 +++--- .../openapitools/virtualan/model/NullableMapProperty.java | 2 +- .../java/org/openapitools/model/NullableClassDto.java | 8 ++++---- .../org/openapitools/model/ContainerDefaultValueDto.java | 6 +++--- .../org/openapitools/model/NullableMapPropertyDto.java | 2 +- 90 files changed, 224 insertions(+), 224 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pojo.mustache index 6552166eaecf..dd8bdc7d0371 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pojo.mustache @@ -125,7 +125,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { @@ -148,7 +148,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache index cb7a77609cdd..4c6f9bf697e4 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pojo.mustache @@ -135,7 +135,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { @@ -158,7 +158,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache index cb7a77609cdd..4c6f9bf697e4 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey3/pojo.mustache @@ -135,7 +135,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { @@ -158,7 +158,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache index bd0a77b3bfe4..7994cc2d1181 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache @@ -126,7 +126,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { @@ -149,7 +149,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/pojo.mustache index a4a4c7db1e91..c720bbd89223 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/restclient/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/restclient/pojo.mustache @@ -151,7 +151,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { @@ -174,7 +174,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pojo.mustache index 4ff69044f32e..b45c6b5007b1 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pojo.mustache @@ -151,7 +151,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { @@ -174,7 +174,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pojo.mustache index 97855c736cff..95d6986ff4c6 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pojo.mustache @@ -151,7 +151,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { @@ -174,7 +174,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { diff --git a/modules/openapi-generator/src/main/resources/Java/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/pojo.mustache index 9b51a4681a57..14d2228aa97d 100644 --- a/modules/openapi-generator/src/main/resources/Java/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pojo.mustache @@ -154,7 +154,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}); } try { @@ -177,7 +177,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#vendorExtensions.x-is-jackson-optional-nullable}} - if (this.{{name}} == null || !this.{{name}}.isPresent()) { + if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) { this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}); } try { diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index f12c42fc3872..99dc720a635d 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -167,7 +167,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{#openApiNullable}} - if (this.{{name}} == null{{#isNullable}} || !this.{{name}}.isPresent(){{/isNullable}}) { + if (this.{{name}} == null{{#isNullable}} || !this.{{name}}.isPresent() || this.{{name}}.get() == null{{/isNullable}}) { this.{{name}} = {{#isNullable}}JsonNullable.of({{/isNullable}}{{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}{{#isNullable}}){{/isNullable}}; } this.{{name}}{{#isNullable}}.get(){{/isNullable}}.add({{name}}Item); @@ -185,7 +185,7 @@ public {{>sealed}}class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}} public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{#openApiNullable}} - if (this.{{name}} == null{{#isNullable}} || !this.{{name}}.isPresent(){{/isNullable}}) { + if (this.{{name}} == null{{#isNullable}} || !this.{{name}}.isPresent() || this.{{name}}.get() == null{{/isNullable}}) { this.{{name}} = {{#isNullable}}JsonNullable.of({{/isNullable}}{{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}HashMap{{/uniqueItems}}<>(){{/defaultValue}}{{#isNullable}}){{/isNullable}}; } this.{{name}}{{#isNullable}}.get(){{/isNullable}}.put(key, {{name}}Item); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index ce989a5fa47f..b3940c9078ba 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -4717,7 +4717,7 @@ public void testJspecify(String library, int springBootVersion, boolean hasJspec GENERATE_CONSTRUCTOR_WITH_ALL_ARGS, true, GENERATE_BUILDERS, true, USE_ABSTRACTION_FOR_FILES, true, - "annotationLibrary", "swagger2" + ANNOTATION_LIBRARY, "swagger2" ), codegenConfigurator -> codegenConfigurator diff --git a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DefaultValue.java index f1bde487d331..9187ba549dbc 100644 --- a/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DefaultValue.java +++ b/samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -293,7 +293,7 @@ public DefaultValue arrayStringNullable(@javax.annotation.Nullable List } public DefaultValue addArrayStringNullableItem(String arrayStringNullableItem) { - if (this.arrayStringNullable == null || !this.arrayStringNullable.isPresent()) { + if (this.arrayStringNullable == null || !this.arrayStringNullable.isPresent() || this.arrayStringNullable.get() == null) { this.arrayStringNullable = JsonNullable.>of(new ArrayList<>()); } try { @@ -338,7 +338,7 @@ public DefaultValue arrayStringExtensionNullable(@javax.annotation.Nullable List } public DefaultValue addArrayStringExtensionNullableItem(String arrayStringExtensionNullableItem) { - if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent()) { + if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent() || this.arrayStringExtensionNullable.get() == null) { this.arrayStringExtensionNullable = JsonNullable.>of(new ArrayList<>()); } try { diff --git a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DefaultValue.java index 3ef093b628b3..785dfa821858 100644 --- a/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DefaultValue.java +++ b/samples/client/echo_api/java/native/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -286,7 +286,7 @@ public DefaultValue arrayStringNullable(@javax.annotation.Nullable List } public DefaultValue addArrayStringNullableItem(String arrayStringNullableItem) { - if (this.arrayStringNullable == null || !this.arrayStringNullable.isPresent()) { + if (this.arrayStringNullable == null || !this.arrayStringNullable.isPresent() || this.arrayStringNullable.get() == null) { this.arrayStringNullable = JsonNullable.>of(new ArrayList<>()); } try { @@ -330,7 +330,7 @@ public DefaultValue arrayStringExtensionNullable(@javax.annotation.Nullable List } public DefaultValue addArrayStringExtensionNullableItem(String arrayStringExtensionNullableItem) { - if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent()) { + if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent() || this.arrayStringExtensionNullable.get() == null) { this.arrayStringExtensionNullable = JsonNullable.>of(new ArrayList<>()); } try { diff --git a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DefaultValue.java index a9d8e94e3ef7..73a13cf4bb17 100644 --- a/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DefaultValue.java +++ b/samples/client/echo_api/java/restclient/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -291,7 +291,7 @@ public DefaultValue arrayStringNullable(@jakarta.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -336,7 +336,7 @@ public DefaultValue arrayStringExtensionNullable(@jakarta.annotation.Nullable Li } public DefaultValue addArrayStringExtensionNullableItem(String arrayStringExtensionNullableItem) { - if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent()) { + if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent() || this.arrayStringExtensionNullable.get() == null) { this.arrayStringExtensionNullable = JsonNullable.>of(new ArrayList<>()); } try { diff --git a/samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/model/DefaultValue.java index af5ff83400cc..a39e748782ad 100644 --- a/samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/model/DefaultValue.java +++ b/samples/client/echo_api/java/resteasy/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -290,7 +290,7 @@ public DefaultValue arrayStringNullable(@javax.annotation.Nullable List } public DefaultValue addArrayStringNullableItem(String arrayStringNullableItem) { - if (this.arrayStringNullable == null || !this.arrayStringNullable.isPresent()) { + if (this.arrayStringNullable == null || !this.arrayStringNullable.isPresent() || this.arrayStringNullable.get() == null) { this.arrayStringNullable = JsonNullable.>of(new ArrayList<>()); } try { @@ -335,7 +335,7 @@ public DefaultValue arrayStringExtensionNullable(@javax.annotation.Nullable List } public DefaultValue addArrayStringExtensionNullableItem(String arrayStringExtensionNullableItem) { - if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent()) { + if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent() || this.arrayStringExtensionNullable.get() == null) { this.arrayStringExtensionNullable = JsonNullable.>of(new ArrayList<>()); } try { diff --git a/samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/model/DefaultValue.java index a25c25ef60fe..1cd4856963c5 100644 --- a/samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/model/DefaultValue.java +++ b/samples/client/echo_api/java/resttemplate/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -291,7 +291,7 @@ public DefaultValue arrayStringNullable(@javax.annotation.Nullable List } public DefaultValue addArrayStringNullableItem(String arrayStringNullableItem) { - if (this.arrayStringNullable == null || !this.arrayStringNullable.isPresent()) { + if (this.arrayStringNullable == null || !this.arrayStringNullable.isPresent() || this.arrayStringNullable.get() == null) { this.arrayStringNullable = JsonNullable.>of(new ArrayList<>()); } try { @@ -336,7 +336,7 @@ public DefaultValue arrayStringExtensionNullable(@javax.annotation.Nullable List } public DefaultValue addArrayStringExtensionNullableItem(String arrayStringExtensionNullableItem) { - if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent()) { + if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent() || this.arrayStringExtensionNullable.get() == null) { this.arrayStringExtensionNullable = JsonNullable.>of(new ArrayList<>()); } try { diff --git a/samples/client/petstore/java/apache-httpclient-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/apache-httpclient-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java index 7fc9fa102da5..ef4b78a8f79a 100644 --- a/samples/client/petstore/java/apache-httpclient-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/apache-httpclient-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java @@ -319,7 +319,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -364,7 +364,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -442,7 +442,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -487,7 +487,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/NullableClass.java index 9d6883690dee..0a4f4ab52ae5 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/NullableClass.java @@ -320,7 +320,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -365,7 +365,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -443,7 +443,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -488,7 +488,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/NullableClass.java index 7b7b56d9ba9d..dd85b49235bd 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/model/NullableClass.java @@ -310,7 +310,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -356,7 +356,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -436,7 +436,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -482,7 +482,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NullableClass.java index 7b7b56d9ba9d..dd85b49235bd 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/NullableClass.java @@ -310,7 +310,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -356,7 +356,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -436,7 +436,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -482,7 +482,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/jersey3-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/jersey3-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java index e6fb45eef3ec..c0da02d667fa 100644 --- a/samples/client/petstore/java/jersey3-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/jersey3-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java @@ -317,7 +317,7 @@ public NullableClass arrayNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -363,7 +363,7 @@ public NullableClass arrayAndItemsNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { - if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent() || this.arrayAndItemsNullableProp.get() == null) { this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -443,7 +443,7 @@ public NullableClass objectNullableProp(@jakarta.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -489,7 +489,7 @@ public NullableClass objectAndItemsNullableProp(@jakarta.annotation.Nullable Map } public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { - if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent() || this.objectAndItemsNullableProp.get() == null) { this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableClass.java index 16526b1f6127..4152edc03094 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/model/NullableClass.java @@ -318,7 +318,7 @@ public NullableClass arrayNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -364,7 +364,7 @@ public NullableClass arrayAndItemsNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { - if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent() || this.arrayAndItemsNullableProp.get() == null) { this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -444,7 +444,7 @@ public NullableClass objectNullableProp(@jakarta.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -490,7 +490,7 @@ public NullableClass objectAndItemsNullableProp(@jakarta.annotation.Nullable Map } public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { - if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent() || this.objectAndItemsNullableProp.get() == null) { this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/NullableClass.java index b85b8b99e0d5..96a4e9964643 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/NullableClass.java @@ -302,7 +302,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -346,7 +346,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -422,7 +422,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -466,7 +466,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NullableClass.java index e7440e03ef92..6569aaded6ce 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/NullableClass.java @@ -304,7 +304,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -348,7 +348,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -424,7 +424,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -468,7 +468,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/Foo.java index 3397bcbf9b49..e5cc9c951158 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/model/Foo.java @@ -317,7 +317,7 @@ public Foo nullableListMinIntems(@Nullable List nullableListM } public Foo addNullableListMinIntemsItem(java.time.Instant nullableListMinIntemsItem) { - if (this.nullableListMinIntems == null || !this.nullableListMinIntems.isPresent()) { + if (this.nullableListMinIntems == null || !this.nullableListMinIntems.isPresent() || this.nullableListMinIntems.get() == null) { this.nullableListMinIntems = JsonNullable.>of(new ArrayList<>()); } try { diff --git a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java index 742c20a37b1e..0d4c5fb23fde 100644 --- a/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/restclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java @@ -322,7 +322,7 @@ public NullableClass arrayNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -368,7 +368,7 @@ public NullableClass arrayAndItemsNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { - if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent() || this.arrayAndItemsNullableProp.get() == null) { this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -448,7 +448,7 @@ public NullableClass objectNullableProp(@jakarta.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -494,7 +494,7 @@ public NullableClass objectAndItemsNullableProp(@jakarta.annotation.Nullable Map } public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { - if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent() || this.objectAndItemsNullableProp.get() == null) { this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/model/NullableClass.java index 8e50413b1253..bcb4cde1aa7b 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/model/NullableClass.java @@ -315,7 +315,7 @@ public NullableClass arrayNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -360,7 +360,7 @@ public NullableClass arrayAndItemsNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { - if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent() || this.arrayAndItemsNullableProp.get() == null) { this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -438,7 +438,7 @@ public NullableClass objectNullableProp(@jakarta.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -483,7 +483,7 @@ public NullableClass objectAndItemsNullableProp(@jakarta.annotation.Nullable Map } public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { - if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent() || this.objectAndItemsNullableProp.get() == null) { this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java index 8e50413b1253..bcb4cde1aa7b 100644 --- a/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/restclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java @@ -315,7 +315,7 @@ public NullableClass arrayNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -360,7 +360,7 @@ public NullableClass arrayAndItemsNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { - if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent() || this.arrayAndItemsNullableProp.get() == null) { this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -438,7 +438,7 @@ public NullableClass objectNullableProp(@jakarta.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -483,7 +483,7 @@ public NullableClass objectAndItemsNullableProp(@jakarta.annotation.Nullable Map } public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { - if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent() || this.objectAndItemsNullableProp.get() == null) { this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NullableClass.java index 46625c62e002..0b54c6d0fcf5 100644 --- a/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/restclient/src/main/java/org/openapitools/client/model/NullableClass.java @@ -315,7 +315,7 @@ public NullableClass arrayNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -360,7 +360,7 @@ public NullableClass arrayAndItemsNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { - if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent() || this.arrayAndItemsNullableProp.get() == null) { this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -438,7 +438,7 @@ public NullableClass objectNullableProp(@jakarta.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -483,7 +483,7 @@ public NullableClass objectAndItemsNullableProp(@jakarta.annotation.Nullable Map } public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { - if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent() || this.objectAndItemsNullableProp.get() == null) { this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NullableClass.java index c84494a9487a..e8a4f5eb3b28 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NullableClass.java @@ -317,7 +317,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -362,7 +362,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -440,7 +440,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -485,7 +485,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NullableClass.java index 424dfc9afe8e..e0705bb0c852 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NullableClass.java @@ -341,7 +341,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -388,7 +388,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -472,7 +472,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -519,7 +519,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java index 118676eda91d..1dfe7ed13186 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NullableClass.java @@ -333,7 +333,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -378,7 +378,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -456,7 +456,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -501,7 +501,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/NullableClass.java index c84494a9487a..e8a4f5eb3b28 100644 --- a/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/model/NullableClass.java @@ -317,7 +317,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -362,7 +362,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -440,7 +440,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -485,7 +485,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NullableClass.java index c84494a9487a..e8a4f5eb3b28 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NullableClass.java @@ -317,7 +317,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -362,7 +362,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -440,7 +440,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -485,7 +485,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/vertx5-supportVertxFuture/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/vertx5-supportVertxFuture/src/main/java/org/openapitools/client/model/NullableClass.java index c84494a9487a..e8a4f5eb3b28 100644 --- a/samples/client/petstore/java/vertx5-supportVertxFuture/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/vertx5-supportVertxFuture/src/main/java/org/openapitools/client/model/NullableClass.java @@ -317,7 +317,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -362,7 +362,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -440,7 +440,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -485,7 +485,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/vertx5/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/vertx5/src/main/java/org/openapitools/client/model/NullableClass.java index c84494a9487a..e8a4f5eb3b28 100644 --- a/samples/client/petstore/java/vertx5/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/vertx5/src/main/java/org/openapitools/client/model/NullableClass.java @@ -317,7 +317,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -362,7 +362,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -440,7 +440,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -485,7 +485,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/NullableClass.java index d401652b6fa7..de26bea586ab 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/NullableClass.java @@ -314,7 +314,7 @@ public NullableClass arrayNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -359,7 +359,7 @@ public NullableClass arrayAndItemsNullableProp(@jakarta.annotation.Nullable List } public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { - if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent() || this.arrayAndItemsNullableProp.get() == null) { this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -437,7 +437,7 @@ public NullableClass objectNullableProp(@jakarta.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -482,7 +482,7 @@ public NullableClass objectAndItemsNullableProp(@jakarta.annotation.Nullable Map } public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { - if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent() || this.objectAndItemsNullableProp.get() == null) { this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java index 8ebf1367d7c1..e33c593549c5 100644 --- a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/NullableClass.java @@ -321,7 +321,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -367,7 +367,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -447,7 +447,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -493,7 +493,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java index de1623f94d5d..d043d63cd0db 100644 --- a/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/model/NullableClass.java @@ -314,7 +314,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -359,7 +359,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -437,7 +437,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -482,7 +482,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NullableClass.java index ecc0197fc121..8229f317c5a9 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NullableClass.java @@ -314,7 +314,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -359,7 +359,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -437,7 +437,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -482,7 +482,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index e4a2fca878d3..0264dcbfcc90 100644 --- a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -49,7 +49,7 @@ public ContainerDefaultValueDto nullableArray(List nullableArray) { } public ContainerDefaultValueDto addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -76,7 +76,7 @@ public ContainerDefaultValueDto nullableRequiredArray(List nullableRequi } public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -132,7 +132,7 @@ public ContainerDefaultValueDto nullableArrayWithDefault(List nullableAr } public ContainerDefaultValueDto addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/NullableMapPropertyDto.java b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/NullableMapPropertyDto.java index f84d9d21f9cf..9014b6f011cb 100644 --- a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/NullableMapPropertyDto.java +++ b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/NullableMapPropertyDto.java @@ -36,7 +36,7 @@ public NullableMapPropertyDto languageValues(Map languageValues) } public NullableMapPropertyDto putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 239c584e3950..a9447aafb5ac 100644 --- a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -48,7 +48,7 @@ public ContainerDefaultValueDto nullableArray(List nullableArray) { } public ContainerDefaultValueDto addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -75,7 +75,7 @@ public ContainerDefaultValueDto nullableRequiredArray(List nullableRequi } public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -131,7 +131,7 @@ public ContainerDefaultValueDto nullableArrayWithDefault(List nullableAr } public ContainerDefaultValueDto addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/NullableMapPropertyDto.java b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/NullableMapPropertyDto.java index d9edf72050f1..4e174dcc657b 100644 --- a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/NullableMapPropertyDto.java +++ b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/NullableMapPropertyDto.java @@ -35,7 +35,7 @@ public NullableMapPropertyDto languageValues(Map languageValues) } public NullableMapPropertyDto putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 5b41cd4b3bc8..912f8ae4ba1c 100644 --- a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -55,7 +55,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -82,7 +82,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -138,7 +138,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/NullableMapProperty.java index dff5aa4523f8..591056e5100f 100644 --- a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -34,7 +34,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 6e358ec3540d..da07e2a84e98 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -54,7 +54,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -81,7 +81,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -137,7 +137,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java index 5e0395f3fd34..a723c91d0d1c 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -33,7 +33,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 6e358ec3540d..da07e2a84e98 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -54,7 +54,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -81,7 +81,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -137,7 +137,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java index 5e0395f3fd34..a723c91d0d1c 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -33,7 +33,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 553e2044e909..a095dfa6e206 100644 --- a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -83,7 +83,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -139,7 +139,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/NullableMapProperty.java index c25a2eaa55bf..77672ce2ef4f 100644 --- a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 239c584e3950..a9447aafb5ac 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -48,7 +48,7 @@ public ContainerDefaultValueDto nullableArray(List nullableArray) { } public ContainerDefaultValueDto addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -75,7 +75,7 @@ public ContainerDefaultValueDto nullableRequiredArray(List nullableRequi } public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -131,7 +131,7 @@ public ContainerDefaultValueDto nullableArrayWithDefault(List nullableAr } public ContainerDefaultValueDto addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NullableMapPropertyDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NullableMapPropertyDto.java index d9edf72050f1..4e174dcc657b 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NullableMapPropertyDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/NullableMapPropertyDto.java @@ -35,7 +35,7 @@ public NullableMapPropertyDto languageValues(Map languageValues) } public NullableMapPropertyDto putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java index 84830c15f4a2..b24140ddb017 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java @@ -307,7 +307,7 @@ public NullableClass arrayNullableProp(@javax.annotation.Nullable List a } public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); } try { @@ -352,7 +352,7 @@ public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List>of(new ArrayList<>()); } try { @@ -430,7 +430,7 @@ public NullableClass objectNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { @@ -475,7 +475,7 @@ public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map>of(new HashMap<>()); } try { diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java index b42d60e67cb6..a80851bbee1f 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -48,7 +48,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -76,7 +76,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -134,7 +134,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/NullableMapProperty.java index a2dd314abf7e..1e54ce87a90f 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java index 3e698bc233d9..edae969af681 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/Foo.java @@ -263,7 +263,7 @@ public Foo nullableListMinIntems(@Nullable List nullableListM } public Foo addNullableListMinIntemsItem(java.time.Instant nullableListMinIntemsItem) { - if (this.nullableListMinIntems == null || !this.nullableListMinIntems.isPresent()) { + if (this.nullableListMinIntems == null || !this.nullableListMinIntems.isPresent() || this.nullableListMinIntems.get() == null) { this.nullableListMinIntems = JsonNullable.of(new ArrayList<>()); } this.nullableListMinIntems.get().add(nullableListMinIntemsItem); diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java index c13dc0f82aa6..901a1b2a1d3e 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -159,7 +159,7 @@ public RequiredAndNullable _list(@Nullable List _list) { } public RequiredAndNullable addListItem(String _listItem) { - if (this._list == null || !this._list.isPresent()) { + if (this._list == null || !this._list.isPresent() || this._list.get() == null) { this._list = JsonNullable.of(new ArrayList<>()); } this._list.get().add(_listItem); diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java index df27e4b15416..3fb4d4b8ada4 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/Foo.java @@ -263,7 +263,7 @@ public Foo nullableListMinIntems(@Nullable List nullableListM } public Foo addNullableListMinIntemsItem(java.time.Instant nullableListMinIntemsItem) { - if (this.nullableListMinIntems == null || !this.nullableListMinIntems.isPresent()) { + if (this.nullableListMinIntems == null || !this.nullableListMinIntems.isPresent() || this.nullableListMinIntems.get() == null) { this.nullableListMinIntems = JsonNullable.of(new ArrayList<>()); } this.nullableListMinIntems.get().add(nullableListMinIntemsItem); diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java index c13dc0f82aa6..901a1b2a1d3e 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -159,7 +159,7 @@ public RequiredAndNullable _list(@Nullable List _list) { } public RequiredAndNullable addListItem(String _listItem) { - if (this._list == null || !this._list.isPresent()) { + if (this._list == null || !this._list.isPresent() || this._list.get() == null) { this._list = JsonNullable.of(new ArrayList<>()); } this._list.get().add(_listItem); diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 037685ee09ca..3a018e9357ad 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -84,7 +84,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -142,7 +142,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java index a2dd314abf7e..1e54ce87a90f 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 037685ee09ca..3a018e9357ad 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -84,7 +84,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -142,7 +142,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java index a2dd314abf7e..1e54ce87a90f 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 037685ee09ca..3a018e9357ad 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -84,7 +84,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -142,7 +142,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/NullableMapProperty.java index a2dd314abf7e..1e54ce87a90f 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/spring-boot-nullable-set/src/main/java/org/openapitools/model/ObjectWithUniqueItems.java b/samples/server/petstore/spring-boot-nullable-set/src/main/java/org/openapitools/model/ObjectWithUniqueItems.java index 802d49ac4f14..30bff5f61534 100644 --- a/samples/server/petstore/spring-boot-nullable-set/src/main/java/org/openapitools/model/ObjectWithUniqueItems.java +++ b/samples/server/petstore/spring-boot-nullable-set/src/main/java/org/openapitools/model/ObjectWithUniqueItems.java @@ -57,7 +57,7 @@ public ObjectWithUniqueItems nullSet(Set nullSet) { } public ObjectWithUniqueItems addNullSetItem(String nullSetItem) { - if (this.nullSet == null || !this.nullSet.isPresent()) { + if (this.nullSet == null || !this.nullSet.isPresent() || this.nullSet.get() == null) { this.nullSet = JsonNullable.of(new LinkedHashSet<>()); } this.nullSet.get().add(nullSetItem); @@ -115,7 +115,7 @@ public ObjectWithUniqueItems nullList(List nullList) { } public ObjectWithUniqueItems addNullListItem(String nullListItem) { - if (this.nullList == null || !this.nullList.isPresent()) { + if (this.nullList == null || !this.nullList.isPresent() || this.nullList.get() == null) { this.nullList = JsonNullable.of(new ArrayList<>()); } this.nullList.get().add(nullListItem); diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 037685ee09ca..3a018e9357ad 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -84,7 +84,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -142,7 +142,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NullableMapProperty.java index a2dd314abf7e..1e54ce87a90f 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 037685ee09ca..3a018e9357ad 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -84,7 +84,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -142,7 +142,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/NullableMapProperty.java index a2dd314abf7e..1e54ce87a90f 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 037685ee09ca..3a018e9357ad 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -84,7 +84,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -142,7 +142,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NullableMapProperty.java index a2dd314abf7e..1e54ce87a90f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 8661a7032ca0..4f7a0e1214a5 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -66,7 +66,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -94,7 +94,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -152,7 +152,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java index c10cb4316340..3db7f9296c5b 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -46,7 +46,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 94b54f884ae4..7a1cb3b9623d 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -84,7 +84,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -142,7 +142,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java index 150e1756a665..71380912bcc1 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 978f7a735e38..5a8d8822146e 100644 --- a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -58,7 +58,7 @@ public ContainerDefaultValueDto nullableArray(List nullableArray) { } public ContainerDefaultValueDto addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -86,7 +86,7 @@ public ContainerDefaultValueDto nullableRequiredArray(List nullableRequi } public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -144,7 +144,7 @@ public ContainerDefaultValueDto nullableArrayWithDefault(List nullableAr } public ContainerDefaultValueDto addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/NullableMapPropertyDto.java b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/NullableMapPropertyDto.java index 02d489f90cea..6f63407a6d66 100644 --- a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/NullableMapPropertyDto.java +++ b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/NullableMapPropertyDto.java @@ -37,7 +37,7 @@ public NullableMapPropertyDto languageValues(Map languageValues) } public NullableMapPropertyDto putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 037685ee09ca..3a018e9357ad 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -84,7 +84,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -142,7 +142,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java index a2dd314abf7e..1e54ce87a90f 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 037685ee09ca..3a018e9357ad 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -84,7 +84,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -142,7 +142,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java index a2dd314abf7e..1e54ce87a90f 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 51c58fff7441..f4d4d5867f0f 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -84,7 +84,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -142,7 +142,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java index a89422830152..199467adfb4a 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java index 303e7bca4c39..ba1b8aa727b8 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java @@ -56,7 +56,7 @@ public ContainerDefaultValue nullableArray(List nullableArray) { } public ContainerDefaultValue addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -84,7 +84,7 @@ public ContainerDefaultValue nullableRequiredArray(List nullableRequired } public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -142,7 +142,7 @@ public ContainerDefaultValue nullableArrayWithDefault(List nullableArray } public ContainerDefaultValue addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/NullableMapProperty.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/NullableMapProperty.java index 72c5788f5b22..64a065bae769 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/NullableMapProperty.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/NullableMapProperty.java @@ -35,7 +35,7 @@ public NullableMapProperty languageValues(Map languageValues) { } public NullableMapProperty putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); diff --git a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/NullableClassDto.java b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/NullableClassDto.java index 330fa927f04a..8631a088be7f 100644 --- a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/NullableClassDto.java +++ b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/model/NullableClassDto.java @@ -194,7 +194,7 @@ public NullableClassDto arrayNullableProp(List arrayNullableProp) { } public NullableClassDto addArrayNullablePropItem(Object arrayNullablePropItem) { - if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent() || this.arrayNullableProp.get() == null) { this.arrayNullableProp = JsonNullable.of(new ArrayList<>()); } this.arrayNullableProp.get().add(arrayNullablePropItem); @@ -222,7 +222,7 @@ public NullableClassDto arrayAndItemsNullableProp(List arrayAndItemsNull } public NullableClassDto addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { - if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent() || this.arrayAndItemsNullableProp.get() == null) { this.arrayAndItemsNullableProp = JsonNullable.of(new ArrayList<>()); } this.arrayAndItemsNullableProp.get().add(arrayAndItemsNullablePropItem); @@ -279,7 +279,7 @@ public NullableClassDto objectNullableProp(Map objectNullablePro } public NullableClassDto putObjectNullablePropItem(String key, Object objectNullablePropItem) { - if (this.objectNullableProp == null || !this.objectNullableProp.isPresent()) { + if (this.objectNullableProp == null || !this.objectNullableProp.isPresent() || this.objectNullableProp.get() == null) { this.objectNullableProp = JsonNullable.of(new HashMap<>()); } this.objectNullableProp.get().put(key, objectNullablePropItem); @@ -307,7 +307,7 @@ public NullableClassDto objectAndItemsNullableProp(Map objectAnd } public NullableClassDto putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { - if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent() || this.objectAndItemsNullableProp.get() == null) { this.objectAndItemsNullableProp = JsonNullable.of(new HashMap<>()); } this.objectAndItemsNullableProp.get().put(key, objectAndItemsNullablePropItem); diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 2754cf81224d..e0fe0b385ea0 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -58,7 +58,7 @@ public ContainerDefaultValueDto nullableArray(List nullableArray) { } public ContainerDefaultValueDto addNullableArrayItem(String nullableArrayItem) { - if (this.nullableArray == null || !this.nullableArray.isPresent()) { + if (this.nullableArray == null || !this.nullableArray.isPresent() || this.nullableArray.get() == null) { this.nullableArray = JsonNullable.of(new ArrayList<>()); } this.nullableArray.get().add(nullableArrayItem); @@ -86,7 +86,7 @@ public ContainerDefaultValueDto nullableRequiredArray(List nullableRequi } public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequiredArrayItem) { - if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent()) { + if (this.nullableRequiredArray == null || !this.nullableRequiredArray.isPresent() || this.nullableRequiredArray.get() == null) { this.nullableRequiredArray = JsonNullable.of(new ArrayList<>()); } this.nullableRequiredArray.get().add(nullableRequiredArrayItem); @@ -144,7 +144,7 @@ public ContainerDefaultValueDto nullableArrayWithDefault(List nullableAr } public ContainerDefaultValueDto addNullableArrayWithDefaultItem(String nullableArrayWithDefaultItem) { - if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent()) { + if (this.nullableArrayWithDefault == null || !this.nullableArrayWithDefault.isPresent() || this.nullableArrayWithDefault.get() == null) { this.nullableArrayWithDefault = JsonNullable.of(new ArrayList<>(Arrays.asList("foo", "bar"))); } this.nullableArrayWithDefault.get().add(nullableArrayWithDefaultItem); diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NullableMapPropertyDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NullableMapPropertyDto.java index f521013a9035..0e002790e407 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NullableMapPropertyDto.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NullableMapPropertyDto.java @@ -37,7 +37,7 @@ public NullableMapPropertyDto languageValues(Map languageValues) } public NullableMapPropertyDto putLanguageValuesItem(String key, String languageValuesItem) { - if (this.languageValues == null || !this.languageValues.isPresent()) { + if (this.languageValues == null || !this.languageValues.isPresent() || this.languageValues.get() == null) { this.languageValues = JsonNullable.of(new HashMap<>()); } this.languageValues.get().put(key, languageValuesItem); From 9eaa2b0779e03fbbf74238f28956c9b162359898 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Mon, 17 Aug 2026 08:27:42 +0200 Subject: [PATCH 17/17] Add @Present comment --- .../src/main/resources/JavaSpring/notNull.mustache | 2 +- .../codegen/java/spring/SpringCodegenTest.java | 3 ++- .../src/main/java/org/openapitools/model/Pet.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../java/org/openapitools/model/RequiredAndNullable.java | 8 ++++---- .../java/org/openapitools/model/RequiredAndNullable.java | 8 ++++---- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../main/java/org/openapitools/model/NullableModel.java | 2 +- .../org/openapitools/model/ContainerDefaultValue.java | 2 +- .../virtualan/model/ContainerDefaultValue.java | 2 +- .../org/openapitools/model/ContainerDefaultValueDto.java | 2 +- 28 files changed, 35 insertions(+), 34 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache index c74f667e8a87..590235a968a5 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/notNull.mustache @@ -1 +1 @@ -{{#required}}{{^isReadOnly}}{{^isNullable}}@NotNull {{/isNullable}}{{/isReadOnly}}{{/required}} \ No newline at end of file +{{#required}}{{^isReadOnly}}{{#isNullable}}{{#openApiNullable}}/* @Present */ {{/openApiNullable}}{{/isNullable}}{{^isNullable}}@NotNull {{/isNullable}}{{/isReadOnly}}{{/required}} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index e1052a481d8a..d959fdcb607a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -7289,7 +7289,8 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) "JsonNullable getStr()", "void setStr(JsonNullable str)", "RequiredAndNullable str(@Nullable String str)", - "RequiredAndNullable.Builder str(@Nullable String str)" + "RequiredAndNullable.Builder str(@Nullable String str)", + " /* @Present */" ).assertMethod("getStr").assertMethodAnnotations().doesNotContainWithName("NotNull"); JavaFileAssert.assertThat(files.get("api/package-info.java")) .fileContains("@org.jspecify.annotations.NullMarked"); diff --git a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java index 10897fc4fcb9..cbfefe49d0ce 100644 --- a/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java +++ b/samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java @@ -149,7 +149,7 @@ public Pet name(String name) { * Get name * @return name */ - + /* @Present */ @Schema(name = "name", example = "doggie", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("name") public JsonNullable getName() { diff --git a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 0264dcbfcc90..bff7e7b1bf37 100644 --- a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -87,7 +87,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index a9447aafb5ac..97abe298e2a2 100644 --- a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -86,7 +86,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 912f8ae4ba1c..e01eaa250b71 100644 --- a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -93,7 +93,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index da07e2a84e98..d0b2e33d0b77 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -92,7 +92,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index da07e2a84e98..d0b2e33d0b77 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -92,7 +92,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a095dfa6e206..0876fa4f8b1f 100644 --- a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -94,7 +94,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index a9447aafb5ac..97abe298e2a2 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -86,7 +86,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { return nullableRequiredArray; diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java index a80851bbee1f..8caad40bef04 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -87,7 +87,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java index 901a1b2a1d3e..3db95fb22627 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -66,7 +66,7 @@ public RequiredAndNullable str(@Nullable String str) { * Get str * @return str */ - + /* @Present */ @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("str") @JacksonXmlProperty(localName = "str") @@ -90,7 +90,7 @@ public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource f * Get file * @return file */ - @Valid + /* @Present */ @Valid @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("file") @JacksonXmlProperty(localName = "file") @@ -114,7 +114,7 @@ public RequiredAndNullable color(@Nullable String color) { * Get color * @return color */ - + /* @Present */ @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("color") @JacksonXmlProperty(localName = "color") @@ -170,7 +170,7 @@ public RequiredAndNullable addListItem(String _listItem) { * Get _list * @return _list */ - + /* @Present */ @Schema(name = "list", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("list") @JacksonXmlProperty(localName = "list") diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java index 901a1b2a1d3e..3db95fb22627 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/model/RequiredAndNullable.java @@ -66,7 +66,7 @@ public RequiredAndNullable str(@Nullable String str) { * Get str * @return str */ - + /* @Present */ @Schema(name = "str", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("str") @JacksonXmlProperty(localName = "str") @@ -90,7 +90,7 @@ public RequiredAndNullable file(org.springframework.core.io.@Nullable Resource f * Get file * @return file */ - @Valid + /* @Present */ @Valid @Schema(name = "file", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("file") @JacksonXmlProperty(localName = "file") @@ -114,7 +114,7 @@ public RequiredAndNullable color(@Nullable String color) { * Get color * @return color */ - + /* @Present */ @Schema(name = "color", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("color") @JacksonXmlProperty(localName = "color") @@ -170,7 +170,7 @@ public RequiredAndNullable addListItem(String _listItem) { * Get _list * @return _list */ - + /* @Present */ @Schema(name = "list", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("list") @JacksonXmlProperty(localName = "list") diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 3a018e9357ad..2828ceb3a770 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 3a018e9357ad..2828ceb3a770 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 3a018e9357ad..2828ceb3a770 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 3a018e9357ad..2828ceb3a770 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 3a018e9357ad..2828ceb3a770 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 3a018e9357ad..2828ceb3a770 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 4f7a0e1214a5..ce39cfc4f753 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -105,7 +105,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 7a1cb3b9623d..b7d3d6d42d75 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index 5a8d8822146e..6c8f9274fcdf 100644 --- a/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot-include-http-request-context/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -97,7 +97,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 3a018e9357ad..2828ceb3a770 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java index 3a018e9357ad..2828ceb3a770 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java b/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java index f027e0295735..dfaee4afe5db 100644 --- a/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java +++ b/samples/server/petstore/springboot-sort-validation/src/main/java/org/openapitools/model/NullableModel.java @@ -80,7 +80,7 @@ public NullableModel requiredNullable(String requiredNullable) { * Get requiredNullable * @return requiredNullable */ - + /* @Present */ @JsonProperty("requiredNullable") public JsonNullable getRequiredNullable() { return requiredNullable; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java index f4d4d5867f0f..a023236fb245 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java index ba1b8aa727b8..6c4935f5803c 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ContainerDefaultValue.java @@ -95,7 +95,7 @@ public ContainerDefaultValue addNullableRequiredArrayItem(String nullableRequire * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java index e0fe0b385ea0..ba50a4de0576 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ContainerDefaultValueDto.java @@ -97,7 +97,7 @@ public ContainerDefaultValueDto addNullableRequiredArrayItem(String nullableRequ * Get nullableRequiredArray * @return nullableRequiredArray */ - + /* @Present */ @Schema(name = "nullable_required_array", requiredMode = Schema.RequiredMode.REQUIRED, nullable = true) @JsonProperty("nullable_required_array") public JsonNullable> getNullableRequiredArray() {