From a41028691fff46b5cf188d08899100e852b975e6 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Wed, 19 Aug 2026 19:11:22 +0200 Subject: [PATCH 01/12] Fix spring-http-interface @Nullable if default --- .../nullableAnnotation.mustache | 1 + .../nullableAnnotation_apiArgument.mustache | 1 + .../java/spring/SpringCodegenTest.java | 35 +++++++------------ .../java/org/openapitools/api/FakeApi.java | 4 +-- .../java/org/openapitools/api/FakeApi.java | 4 +-- .../java/org/openapitools/api/FakeApi.java | 4 +-- .../java/org/openapitools/api/FakeApi.java | 4 +-- .../java/org/openapitools/api/FakeApi.java | 4 +-- .../java/org/openapitools/api/FakeApi.java | 4 +-- .../java/org/openapitools/api/FakeApi.java | 4 +-- .../java/org/openapitools/api/FakeApi.java | 4 +-- 11 files changed, 30 insertions(+), 39 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation.mustache new file mode 100644 index 000000000000..16209a40fb6c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation.mustache @@ -0,0 +1 @@ +{{#paramName}}{{>nullableAnnotation_apiArgument}}{{/paramName}}{{^paramName}}{{>nullableAnnotation_jspecify}}{{^useJspecify}}{{!backward compatibility}}{{>nullableAnnotation_default}}{{/useJspecify}}{{/paramName}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache new file mode 100644 index 000000000000..a1a0ed33254b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache @@ -0,0 +1 @@ +{{#lambda.jSpecifyNullable}}{{#defaultValue}}@Nullable {{/defaultValue}}{{^required}}{{^defaultValue}}{{^useOptional}}{{#openApiNullable}}{{^isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/useOptional}}{{/defaultValue}}{{#defaultValue}}{{^openApiNullable}}{{#isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{/defaultValue}}{{/required}}{{/lambda.jSpecifyNullable}} \ 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 d959fdcb607a..13225f180de1 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 @@ -7180,34 +7180,23 @@ 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( - "javax.annotation.Nullable", - "jakarta.annotation.Nullable") - .assertMethod("getRequiredDt").assertMethodAnnotations().containsWithName("NotNull").containsWithName("Valid"); - JavaFileAssert.assertThat(files.get("FooApi.java")) + ); + JavaFileAssert fooApi = JavaFileAssert.assertThat(files.get("FooApi.java")); + fooApi .assertTypeAnnotations().doesImportAnnotation("org.jspecify.annotations.Nullable").toType() .fileContains( "java.time.@Nullable Instant dtParam", "java.time.@Nullable Instant dtQuery", - "java.time.@Nullable Instant dtCookie", - " @RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color" + "java.time.@Nullable Instant dtCookie" ); - JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) - .fileContains( - "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)"); + if (SPRING_HTTP_INTERFACE.equals(library)) { + fooApi.fileContains( + "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") @Nullable String color" + ); + } else { + fooApi.fileContains( + "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color" + ); } JavaFileAssert.assertThat(files.get("FileContent.java")) .fileContains("VirusScanEnum getVirusScan()"); diff --git a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/api/FakeApi.java b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/api/FakeApi.java index 7358c6c39e53..3a5e73e2421b 100644 --- a/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/client/petstore/spring-http-interface-bean-validation/src/main/java/org/openapitools/api/FakeApi.java @@ -248,9 +248,9 @@ ResponseEntity testEndpointParameters( ) ResponseEntity testEnumParameters( @RequestHeader(value = "enum_header_string_array", required = false) @Nullable List enumHeaderStringArray, - @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") String enumHeaderString, + @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") @Nullable String enumHeaderString, @Valid @RequestParam(value = "enum_query_string_array", required = false) @Nullable List enumQueryStringArray, - @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, + @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") @Nullable String enumQueryString, @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, diff --git a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java index 540a382c4ada..d4f956e27b69 100644 --- a/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/client/petstore/spring-http-interface-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java @@ -255,9 +255,9 @@ void testEndpointParameters( ) void testEnumParameters( @RequestHeader(value = "enum_header_string_array", required = false) @Nullable List enumHeaderStringArray, - @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") String enumHeaderString, + @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") @Nullable String enumHeaderString, @RequestParam(value = "enum_query_string_array", required = false) @Nullable List enumQueryStringArray, - @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, + @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") @Nullable String enumQueryString, @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, diff --git a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/api/FakeApi.java b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/api/FakeApi.java index 749cc042e246..be9694a1acc2 100644 --- a/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/client/petstore/spring-http-interface-reactive-bean-validation/src/main/java/org/openapitools/api/FakeApi.java @@ -252,9 +252,9 @@ Mono> testEndpointParameters( ) Mono> testEnumParameters( @RequestHeader(value = "enum_header_string_array", required = false) @Nullable List enumHeaderStringArray, - @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") String enumHeaderString, + @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") @Nullable String enumHeaderString, @Valid @RequestParam(value = "enum_query_string_array", required = false) @Nullable List enumQueryStringArray, - @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, + @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") @Nullable String enumQueryString, @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java index 5ae358897b23..1cd88b7569af 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java @@ -259,9 +259,9 @@ Mono testEndpointParameters( ) Mono testEnumParameters( @RequestHeader(value = "enum_header_string_array", required = false) @Nullable List enumHeaderStringArray, - @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") String enumHeaderString, + @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") @Nullable String enumHeaderString, @RequestParam(value = "enum_query_string_array", required = false) @Nullable List enumQueryStringArray, - @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, + @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") @Nullable String enumQueryString, @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/FakeApi.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/FakeApi.java index 7e98783fcfb6..2d65801a2210 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/FakeApi.java @@ -249,9 +249,9 @@ Mono> testEndpointParameters( ) Mono> testEnumParameters( @RequestHeader(value = "enum_header_string_array", required = false) @Nullable List enumHeaderStringArray, - @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") String enumHeaderString, + @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") @Nullable String enumHeaderString, @RequestParam(value = "enum_query_string_array", required = false) @Nullable List enumQueryStringArray, - @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, + @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") @Nullable String enumQueryString, @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, diff --git a/samples/client/petstore/spring-http-interface-springboot-4/src/main/java/org/openapitools/api/FakeApi.java b/samples/client/petstore/spring-http-interface-springboot-4/src/main/java/org/openapitools/api/FakeApi.java index 7358c6c39e53..3a5e73e2421b 100644 --- a/samples/client/petstore/spring-http-interface-springboot-4/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/client/petstore/spring-http-interface-springboot-4/src/main/java/org/openapitools/api/FakeApi.java @@ -248,9 +248,9 @@ ResponseEntity testEndpointParameters( ) ResponseEntity testEnumParameters( @RequestHeader(value = "enum_header_string_array", required = false) @Nullable List enumHeaderStringArray, - @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") String enumHeaderString, + @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") @Nullable String enumHeaderString, @Valid @RequestParam(value = "enum_query_string_array", required = false) @Nullable List enumQueryStringArray, - @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, + @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") @Nullable String enumQueryString, @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, diff --git a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/api/FakeApi.java b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/api/FakeApi.java index 49e2652ea1aa..2701a428f9c2 100644 --- a/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/client/petstore/spring-http-interface-useHttpServiceProxyFactoryInterfacesConfigurator/src/main/java/org/openapitools/api/FakeApi.java @@ -248,9 +248,9 @@ ResponseEntity testEndpointParameters( ) ResponseEntity testEnumParameters( @RequestHeader(value = "enum_header_string_array", required = false) @Nullable List enumHeaderStringArray, - @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") String enumHeaderString, + @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") @Nullable String enumHeaderString, @Valid @RequestParam(value = "enum_query_string_array", required = false) @Nullable List enumQueryStringArray, - @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, + @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") @Nullable String enumQueryString, @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, diff --git a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/api/FakeApi.java b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/api/FakeApi.java index d4dd396c38fe..c0d879d448c5 100644 --- a/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/client/petstore/spring-http-interface/src/main/java/org/openapitools/api/FakeApi.java @@ -245,9 +245,9 @@ ResponseEntity testEndpointParameters( ) ResponseEntity testEnumParameters( @RequestHeader(value = "enum_header_string_array", required = false) @Nullable List enumHeaderStringArray, - @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") String enumHeaderString, + @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") @Nullable String enumHeaderString, @RequestParam(value = "enum_query_string_array", required = false) @Nullable List enumQueryStringArray, - @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, + @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") @Nullable String enumQueryString, @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, From 16f02cc6f170f6783a4e7a1f7a8ef9a12f5214eb Mon Sep 17 00:00:00 2001 From: jpfinne Date: Thu, 20 Aug 2026 11:14:31 +0200 Subject: [PATCH 02/12] Force build --- .../codegen/java/spring/SpringCodegenTest.java | 8 ++------ 1 file changed, 2 insertions(+), 6 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 13225f180de1..fd91c6436465 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 @@ -7190,13 +7190,9 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti "java.time.@Nullable Instant dtCookie" ); if (SPRING_HTTP_INTERFACE.equals(library)) { - fooApi.fileContains( - "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") @Nullable String color" - ); + fooApi.fileContains("@RequestParam(value = \"color\", required = false, defaultValue = \"red\") @Nullable String color"); } else { - fooApi.fileContains( - "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color" - ); + fooApi.fileContains("@RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color"); } JavaFileAssert.assertThat(files.get("FileContent.java")) .fileContains("VirusScanEnum getVirusScan()"); From 61eb6bf8da6bd0cbcad3a9a4ab661062590e8728 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Thu, 20 Aug 2026 18:48:57 +0200 Subject: [PATCH 03/12] Force build --- .../codegen/java/spring/SpringCodegenTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 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 fd91c6436465..13225f180de1 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 @@ -7190,9 +7190,13 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti "java.time.@Nullable Instant dtCookie" ); if (SPRING_HTTP_INTERFACE.equals(library)) { - fooApi.fileContains("@RequestParam(value = \"color\", required = false, defaultValue = \"red\") @Nullable String color"); + fooApi.fileContains( + "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") @Nullable String color" + ); } else { - fooApi.fileContains("@RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color"); + fooApi.fileContains( + "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color" + ); } JavaFileAssert.assertThat(files.get("FileContent.java")) .fileContains("VirusScanEnum getVirusScan()"); From 455affefa21deb8829fea833b3a3778a150f9be7 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Thu, 20 Aug 2026 19:15:44 +0200 Subject: [PATCH 04/12] Refactoring of nullableAnnotation -> nullable_apiArgument for api parameters --- .../src/main/resources/JavaSpring/cookieParams.mustache | 2 +- .../src/main/resources/JavaSpring/headerParams.mustache | 2 +- .../libraries/spring-http-interface/nullableAnnotation.mustache | 1 - .../src/main/resources/JavaSpring/nullableAnnotation.mustache | 2 +- .../JavaSpring/nullableAnnotation_apiArgument.mustache | 1 + .../resources/JavaSpring/nullableAnnotation_jspecify.mustache | 2 +- .../src/main/resources/JavaSpring/pathParams.mustache | 2 +- .../src/main/resources/JavaSpring/queryParams.mustache | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation_apiArgument.mustache diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/cookieParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/cookieParams.mustache index a255b5c7daf2..32db956c4813 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/cookieParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/cookieParams.mustache @@ -1 +1 @@ -{{#isCookieParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @CookieValue(name = "{{baseName}}"{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isCookieParam}} \ No newline at end of file +{{#isCookieParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @CookieValue(name = "{{baseName}}"{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>nullableAnnotation_apiArgument}}{{>optionalDataType}} {{paramName}}{{/isCookieParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/headerParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/headerParams.mustache index 80b1d0a82341..61c5b3e6257c 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/headerParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/headerParams.mustache @@ -1 +1 @@ -{{#isHeaderParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file +{{#isHeaderParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}} @RequestHeader(value = "{{baseName}}", required = {{#required}}true{{/required}}{{^required}}false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{>dateTimeParam}} {{>nullableAnnotation_apiArgument}}{{>optionalDataType}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation.mustache deleted file mode 100644 index 16209a40fb6c..000000000000 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#paramName}}{{>nullableAnnotation_apiArgument}}{{/paramName}}{{^paramName}}{{>nullableAnnotation_jspecify}}{{^useJspecify}}{{!backward compatibility}}{{>nullableAnnotation_default}}{{/useJspecify}}{{/paramName}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation.mustache index 65c0e39b2ead..f389ca095c8c 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation.mustache @@ -1 +1 @@ -{{#paramName}}{{>nullableAnnotation_default}}{{/paramName}}{{^paramName}}{{>nullableAnnotation_jspecify}}{{^useJspecify}}{{!backward compatibility}}{{>nullableAnnotation_default}}{{/useJspecify}}{{/paramName}} \ No newline at end of file +{{#useJspecify}}{{>nullableAnnotation_jspecify}}{{/useJspecify}}{{^useJspecify}}{{!backward compatibility}}{{>nullableAnnotation_default}}{{/useJspecify}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation_apiArgument.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation_apiArgument.mustache new file mode 100644 index 000000000000..a3ff1bad10e2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/nullableAnnotation_apiArgument.mustache @@ -0,0 +1 @@ +{{#lambda.jSpecifyNullable}}{{^required}}{{^defaultValue}}{{^useOptional}}{{#openApiNullable}}{{^isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/useOptional}}{{/defaultValue}}{{#defaultValue}}{{^openApiNullable}}{{#isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{/defaultValue}}{{/required}}{{/lambda.jSpecifyNullable}} \ 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 c7624e180091..a121f6bc6625 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}}{{#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 +{{#lambda.jSpecifyNullable}}{{#required}}{{#isNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/isNullable}}{{/required}}{{^required}}{{^useOptional}}{{#openApiNullable}}{{^isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/useOptional}}{{/required}}{{/lambda.jSpecifyNullable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache index 5a351829131d..881becf0f0de 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache @@ -1 +1 @@ -{{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file +{{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation_apiArgument}}{{>optionalDataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache index 56f7527eb92a..786be39bba78 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = {{#isMap}}""{{/isMap}}{{^isMap}}"{{baseName}}"{{/isMap}}{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/isModel}}{{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = {{#isMap}}""{{/isMap}}{{^isMap}}"{{baseName}}"{{/isMap}}{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}){{/isModel}}{{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation_apiArgument}}{{>optionalDataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file From 9d1fc7d313e2094a04a04b296ccd1cd2e2a18292 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Thu, 20 Aug 2026 21:24:06 +0200 Subject: [PATCH 05/12] Refactoring of nullableAnnotation -> nullable_apiArgument for api parameters --- .../src/main/resources/JavaSpring/bodyParams.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/bodyParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/bodyParams.mustache index 26bea8c9b706..fb36a1407072 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/bodyParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/bodyParams.mustache @@ -1 +1 @@ -{{#isBodyParam}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{^reactive}}{{>nullableAnnotation}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isBodyParam}} \ No newline at end of file +{{#isBodyParam}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} @RequestBody{{^required}}(required = false){{/required}} {{^reactive}}{{>nullableAnnotation_apiArgument}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isBodyParam}} \ No newline at end of file From 5d162d114bc99373f976aa121c95e04c6f47dd22 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Thu, 20 Aug 2026 21:36:24 +0200 Subject: [PATCH 06/12] fix double @Nullable --- .../nullableAnnotation_apiArgument.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache index a1a0ed33254b..dfb00beab5af 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache @@ -1 +1 @@ -{{#lambda.jSpecifyNullable}}{{#defaultValue}}@Nullable {{/defaultValue}}{{^required}}{{^defaultValue}}{{^useOptional}}{{#openApiNullable}}{{^isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/useOptional}}{{/defaultValue}}{{#defaultValue}}{{^openApiNullable}}{{#isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{/defaultValue}}{{/required}}{{/lambda.jSpecifyNullable}} \ No newline at end of file +{{#lambda.jSpecifyNullable}}{{#defaultValue}}@Nullable {{/defaultValue}}{{^required}}{{^defaultValue}}{{^useOptional}}{{#openApiNullable}}{{^isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/useOptional}}{{/defaultValue}}{{/required}}{{/lambda.jSpecifyNullable}} \ No newline at end of file From fb38a0c45f8e52673faed05ad15e7f0d44ab5990 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Thu, 20 Aug 2026 21:43:02 +0200 Subject: [PATCH 07/12] Revert missing test --- .../java/spring/SpringCodegenTest.java | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 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 13225f180de1..91998a5d7dc1 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 @@ -7180,23 +7180,39 @@ 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)" - ); - JavaFileAssert fooApi = JavaFileAssert.assertThat(files.get("FooApi.java")); - fooApi + ).fileDoesNotContain( + "javax.annotation.Nullable", + "jakarta.annotation.Nullable") + .assertMethod("getRequiredDt").assertMethodAnnotations().containsWithName("NotNull").containsWithName("Valid"); + JavaFileAssert fooApiAsset = JavaFileAssert.assertThat(files.get("FooApi.java")) .assertTypeAnnotations().doesImportAnnotation("org.jspecify.annotations.Nullable").toType() .fileContains( "java.time.@Nullable Instant dtParam", "java.time.@Nullable Instant dtQuery", - "java.time.@Nullable Instant dtCookie" - ); + "java.time.@Nullable Instant dtCookie"); if (SPRING_HTTP_INTERFACE.equals(library)) { - fooApi.fileContains( - "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") @Nullable String color" - ); + fooApiAsset.fileContains( + "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") @Nullable String color"); } else { - fooApi.fileContains( - "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color" - ); + fooApiAsset.fileContains( + "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color"); + } + JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) + .fileContains( + "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()"); From c2003fac899bab712ed7ebe70d03614b692aee3e Mon Sep 17 00:00:00 2001 From: jpfinne Date: Fri, 21 Aug 2026 09:12:58 +0200 Subject: [PATCH 08/12] Better default vs !default --- .../nullableAnnotation_apiArgument.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache index dfb00beab5af..ee377a07c167 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache @@ -1 +1 @@ -{{#lambda.jSpecifyNullable}}{{#defaultValue}}@Nullable {{/defaultValue}}{{^required}}{{^defaultValue}}{{^useOptional}}{{#openApiNullable}}{{^isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/useOptional}}{{/defaultValue}}{{/required}}{{/lambda.jSpecifyNullable}} \ No newline at end of file +{{#lambda.jSpecifyNullable}}{{#defaultValue}}@Nullable {{/defaultValue}}{{^defaultValue}}{{^required}}{{^useOptional}}{{#openApiNullable}}{{^isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/useOptional}}{{/required}}{{/defaultValue}}{{/lambda.jSpecifyNullable}} \ No newline at end of file From 0923570f0998519e618d2ad091594928d9b48986 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Fri, 21 Aug 2026 09:13:20 +0200 Subject: [PATCH 09/12] Fix typo --- .../openapitools/codegen/java/spring/SpringCodegenTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 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 91998a5d7dc1..a1524b7080da 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 @@ -7184,17 +7184,17 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti "javax.annotation.Nullable", "jakarta.annotation.Nullable") .assertMethod("getRequiredDt").assertMethodAnnotations().containsWithName("NotNull").containsWithName("Valid"); - JavaFileAssert fooApiAsset = JavaFileAssert.assertThat(files.get("FooApi.java")) + JavaFileAssert fooApiAssert = JavaFileAssert.assertThat(files.get("FooApi.java")) .assertTypeAnnotations().doesImportAnnotation("org.jspecify.annotations.Nullable").toType() .fileContains( "java.time.@Nullable Instant dtParam", "java.time.@Nullable Instant dtQuery", "java.time.@Nullable Instant dtCookie"); if (SPRING_HTTP_INTERFACE.equals(library)) { - fooApiAsset.fileContains( + fooApiAssert.fileContains( "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") @Nullable String color"); } else { - fooApiAsset.fileContains( + fooApiAssert.fileContains( "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color"); } JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) From 4e821b1ff6a6dd72bebec0d777dd55fd4a5385b3 Mon Sep 17 00:00:00 2001 From: jpfinne Date: Fri, 21 Aug 2026 10:38:04 +0200 Subject: [PATCH 10/12] Force build --- .../openapitools/codegen/java/spring/SpringCodegenTest.java | 3 +++ 1 file changed, 3 insertions(+) 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 a1524b7080da..0ae03030fb3c 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 @@ -7190,6 +7190,8 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti "java.time.@Nullable Instant dtParam", "java.time.@Nullable Instant dtQuery", "java.time.@Nullable Instant dtCookie"); + + // SPRING_HTTP_INTERFACE has other requirements for default in api arguments if (SPRING_HTTP_INTERFACE.equals(library)) { fooApiAssert.fileContains( "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") @Nullable String color"); @@ -7197,6 +7199,7 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti fooApiAssert.fileContains( "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color"); } + JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) .fileContains( "private @Nullable String str = null;", From c62a962895286c2637c65fc524405efa6a41b48c Mon Sep 17 00:00:00 2001 From: jpfinne Date: Tue, 1 Sep 2026 08:23:23 +0200 Subject: [PATCH 11/12] Handling of SPRING_HTTP_INTERFACE query param required=false, nullable=true --- .../nullableAnnotation_apiArgument.mustache | 2 +- .../java/spring/SpringCodegenTest.java | 30 ++-- .../src/test/resources/3_0/java/jspecify.yaml | 14 ++ .../java/native-jackson3-jspecify/README.md | 2 + .../native-jackson3-jspecify/api/openapi.yaml | 17 +++ .../docs/RequiredAndNullableApi.md | 130 ++++++++++++++++++ .../client/api/RequiredAndNullableApi.java | 115 ++++++++++++++++ .../README.md | 1 + .../api/openapi.yaml | 17 +++ .../docs/RequiredAndNullableApi.md | 64 +++++++++ .../client/api/RequiredAndNullableApi.java | 67 +++++++++ .../README.md | 1 + .../api/openapi.yaml | 17 +++ .../docs/RequiredAndNullableApi.md | 64 +++++++++ .../client/api/RequiredAndNullableApi.java | 67 +++++++++ .../README.md | 1 + .../api/openapi.yaml | 17 +++ .../docs/RequiredAndNullableApi.md | 64 +++++++++ .../client/api/RequiredAndNullableApi.java | 42 ++++++ .../README.md | 1 + .../api/openapi.yaml | 17 +++ .../docs/RequiredAndNullableApi.md | 64 +++++++++ .../client/api/RequiredAndNullableApi.java | 67 +++++++++ .../api/RequiredAndNullableApi.java | 27 ++++ .../api/RequiredAndNullableApi.java | 27 ++++ .../api/RequiredAndNullableApi.java | 27 ++++ 26 files changed, 953 insertions(+), 9 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache index ee377a07c167..b533e787a36b 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/nullableAnnotation_apiArgument.mustache @@ -1 +1 @@ -{{#lambda.jSpecifyNullable}}{{#defaultValue}}@Nullable {{/defaultValue}}{{^defaultValue}}{{^required}}{{^useOptional}}{{#openApiNullable}}{{^isNullable}}@Nullable {{/isNullable}}{{/openApiNullable}}{{^openApiNullable}}@Nullable {{/openApiNullable}}{{/useOptional}}{{/required}}{{/defaultValue}}{{/lambda.jSpecifyNullable}} \ No newline at end of file +{{#lambda.jSpecifyNullable}}{{#defaultValue}}@Nullable {{/defaultValue}}{{^defaultValue}}{{^required}}{{^useOptional}}@Nullable {{/useOptional}}{{/required}}{{/defaultValue}}{{/lambda.jSpecifyNullable}} \ 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 1a61dd7685f4..954a25a683b3 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 @@ -7231,11 +7231,16 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti "java.time.@Nullable Instant dtQuery", "java.time.@Nullable Instant dtCookie"); + JavaFileAssert requiredApi = JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")); // SPRING_HTTP_INTERFACE has other requirements for default in api arguments if (SPRING_HTTP_INTERFACE.equals(library)) { + requiredApi.fileContains( + " @Nullable String filter"); fooApiAssert.fileContains( "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") @Nullable String color"); } else { + requiredApi.fileContains( + " @Nullable String filter"); fooApiAssert.fileContains( "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color"); } @@ -7322,13 +7327,7 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) "javax.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( - "java.time.@Nullable Instant dtParam", - "java.time.@Nullable Instant dtQuery", - "java.time.@Nullable Instant dtCookie" - ); + JavaFileAssert.assertThat(files.get("RequiredAndNullable.java")) .fileContains( "private JsonNullable str = JsonNullable.undefined();", @@ -7352,6 +7351,19 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) .doesNotContainWithName("Nullable") .doesImportAnnotation("org.jspecify.annotations.Nullable"); } + JavaFileAssert.assertThat(files.get("FooApi.java")) + .assertTypeAnnotations().doesImportAnnotation("org.jspecify.annotations.Nullable").toType() + .fileContains( + "java.time.@Nullable Instant dtParam", + "java.time.@Nullable Instant dtQuery", + "java.time.@Nullable Instant dtCookie"); + JavaFileAssert requiredApi = JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")); + if (SPRING_HTTP_INTERFACE.equals(library)) { + requiredApi .fileContains("@RequestParam(value = \"filter\", required = false) @Nullable String filter"); + } else { + // incorrect generation for required=false, nullable=true + } + } @DataProvider(name = "jspecifyLibrariesUseOptional") @@ -7447,7 +7459,9 @@ public void testJspecify_useOptional(String library, int springBootVersion, bool .doesNotContainWithName("Nullable") .doesImportAnnotation("org.jspecify.annotations.Nullable"); } - } + JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")) + .fileContains("@RequestParam(value = \"filter\", required = false) Optional filter"); + } // ------------------------------------------------------------------------- // autoXSpringPaginated tests 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 4d166384f1ad..1ea765bfe296 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 @@ -48,6 +48,19 @@ paths: schema: $ref: '#/components/schemas/Foo' /requiredAndNullable: + get: + tags: + - requiredAndNullable + parameters: + - name: filter + in: query + required: false + schema: + type: string + nullable: true + responses: + default: + description: OK post: tags: - requiredAndNullable @@ -65,6 +78,7 @@ paths: application/json: schema: $ref: '#/components/schemas/RequiredAndNullable' + /upload: post: tags: diff --git a/samples/client/petstore/java/native-jackson3-jspecify/README.md b/samples/client/petstore/java/native-jackson3-jspecify/README.md index 7acdf0a9430c..9c53b1445e7f 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/native-jackson3-jspecify/README.md @@ -111,6 +111,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* | [**requiredAndNullableGet**](docs/RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | +*RequiredAndNullableApi* | [**requiredAndNullableGetWithHttpInfo**](docs/RequiredAndNullableApi.md#requiredAndNullableGetWithHttpInfo) | **GET** /requiredAndNullable | *RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | *RequiredAndNullableApi* | [**requiredAndNullablePostWithHttpInfo**](docs/RequiredAndNullableApi.md#requiredAndNullablePostWithHttpInfo) | **POST** /requiredAndNullable | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | 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 15c1f4176a50..a1e9afebc747 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml @@ -62,6 +62,23 @@ paths: x-accepts: - application/json /requiredAndNullable: + get: + parameters: + - explode: true + in: query + name: filter + required: false + schema: + nullable: true + type: string + style: form + responses: + default: + description: OK + tags: + - requiredAndNullable + x-accepts: + - application/json post: requestBody: content: diff --git a/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullableApi.md b/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullableApi.md index eaad2b9ed25c..398a683bc143 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullableApi.md +++ b/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullableApi.md @@ -4,11 +4,141 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**requiredAndNullableGet**](RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | | +| [**requiredAndNullableGetWithHttpInfo**](RequiredAndNullableApi.md#requiredAndNullableGetWithHttpInfo) | **GET** /requiredAndNullable | | | [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | | [**requiredAndNullablePostWithHttpInfo**](RequiredAndNullableApi.md#requiredAndNullablePostWithHttpInfo) | **POST** /requiredAndNullable | | +## requiredAndNullableGet + +> void requiredAndNullableGet(filter) + + + +### 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); + String filter = "filter_example"; // String | + try { + apiInstance.requiredAndNullableGet(filter); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **filter** | **String**| | [optional] | + +### Return type + + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | OK | - | + +## requiredAndNullableGetWithHttpInfo + +> ApiResponse requiredAndNullableGetWithHttpInfo(filter) + + + +### 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); + String filter = "filter_example"; // String | + try { + ApiResponse response = apiInstance.requiredAndNullableGetWithHttpInfo(filter); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **filter** | **String**| | [optional] | + +### Return type + + +ApiResponse + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | OK | - | + + ## requiredAndNullablePost > RequiredAndNullable requiredAndNullablePost(requiredAndNullable) 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 index 0209382a5611..cae962a31316 100644 --- 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 @@ -18,6 +18,7 @@ import org.openapitools.client.Configuration; import org.openapitools.client.Pair; +import org.jspecify.annotations.Nullable; import org.openapitools.client.model.RequiredAndNullable; import tools.jackson.core.JacksonException; @@ -163,6 +164,120 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx return file; } + /** + * + * + * @param filter (optional) + * @throws ApiException if fails to make API call + */ + public void requiredAndNullableGet(@Nullable String filter) throws ApiException { + requiredAndNullableGet(filter, null); + } + + /** + * + * + * @param filter (optional) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void requiredAndNullableGet(@Nullable String filter, Map headers) throws ApiException { + requiredAndNullableGetWithHttpInfo(filter, headers); + } + + /** + * + * + * @param filter (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse requiredAndNullableGetWithHttpInfo(@Nullable String filter) throws ApiException { + return requiredAndNullableGetWithHttpInfo(filter, null); + } + + /** + * + * + * @param filter (optional) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse requiredAndNullableGetWithHttpInfo(@Nullable String filter, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = requiredAndNullableGetRequestBuilder(filter, 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("requiredAndNullableGet", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody != null) { + localVarResponseBody.readAllBytes(); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder requiredAndNullableGetRequestBuilder(@Nullable String filter, Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/requiredAndNullable"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "filter"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("filter", filter)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + 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/restclient-springBoot4-jackson3-jspecify-openapiNullable/README.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/README.md index d39d8c8a37a4..5a5e0c9c85a6 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 @@ -117,6 +117,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* | [**requiredAndNullableGet**](docs/RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | *RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | 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 15c1f4176a50..a1e9afebc747 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 @@ -62,6 +62,23 @@ paths: x-accepts: - application/json /requiredAndNullable: + get: + parameters: + - explode: true + in: query + name: filter + required: false + schema: + nullable: true + type: string + style: form + responses: + default: + description: OK + tags: + - requiredAndNullable + x-accepts: + - application/json post: requestBody: content: 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 index ada434bf0b9e..3873b33f25ad 100644 --- 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 @@ -4,10 +4,74 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**requiredAndNullableGet**](RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | | | [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | +## requiredAndNullableGet + +> requiredAndNullableGet(filter) + + + +### 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); + String filter = "filter_example"; // String | + try { + apiInstance.requiredAndNullableGet(filter); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **filter** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | OK | - | + + ## requiredAndNullablePost > RequiredAndNullable requiredAndNullablePost(requiredAndNullable) 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 index fb14eed980f0..eb0991553af0 100644 --- 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 @@ -2,6 +2,7 @@ import org.openapitools.client.ApiClient; +import org.jspecify.annotations.Nullable; import org.openapitools.client.model.RequiredAndNullable; import java.util.HashMap; @@ -44,6 +45,72 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec requiredAndNullableGetRequestCreation(@Nullable String filter) throws RestClientResponseException { + Object postBody = 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<>(); + + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "filter", filter)); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public void requiredAndNullableGet(@Nullable String filter) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + requiredAndNullableGetRequestCreation(filter).body(localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity requiredAndNullableGetWithHttpInfo(@Nullable String filter) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return requiredAndNullableGetRequestCreation(filter).toEntity(localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec requiredAndNullableGetWithResponseSpec(@Nullable String filter) throws RestClientResponseException { + return requiredAndNullableGetRequestCreation(filter); + } + /** * * 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 d39d8c8a37a4..5a5e0c9c85a6 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md @@ -117,6 +117,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* | [**requiredAndNullableGet**](docs/RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | *RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | 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 15c1f4176a50..a1e9afebc747 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 @@ -62,6 +62,23 @@ paths: x-accepts: - application/json /requiredAndNullable: + get: + parameters: + - explode: true + in: query + name: filter + required: false + schema: + nullable: true + type: string + style: form + responses: + default: + description: OK + tags: + - requiredAndNullable + x-accepts: + - application/json post: requestBody: content: 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 index ada434bf0b9e..3873b33f25ad 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md @@ -4,10 +4,74 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**requiredAndNullableGet**](RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | | | [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | +## requiredAndNullableGet + +> requiredAndNullableGet(filter) + + + +### 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); + String filter = "filter_example"; // String | + try { + apiInstance.requiredAndNullableGet(filter); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **filter** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | OK | - | + + ## requiredAndNullablePost > RequiredAndNullable requiredAndNullablePost(requiredAndNullable) 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 index fb14eed980f0..eb0991553af0 100644 --- 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 @@ -2,6 +2,7 @@ import org.openapitools.client.ApiClient; +import org.jspecify.annotations.Nullable; import org.openapitools.client.model.RequiredAndNullable; import java.util.HashMap; @@ -44,6 +45,72 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec requiredAndNullableGetRequestCreation(@Nullable String filter) throws RestClientResponseException { + Object postBody = 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<>(); + + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "filter", filter)); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public void requiredAndNullableGet(@Nullable String filter) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + requiredAndNullableGetRequestCreation(filter).body(localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity requiredAndNullableGetWithHttpInfo(@Nullable String filter) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return requiredAndNullableGetRequestCreation(filter).toEntity(localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec requiredAndNullableGetWithResponseSpec(@Nullable String filter) throws RestClientResponseException { + return requiredAndNullableGetRequestCreation(filter); + } + /** * * 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 9c14e0b7fca2..07deaf823718 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md @@ -117,6 +117,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* | [**requiredAndNullableGet**](docs/RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | *RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | 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 15c1f4176a50..a1e9afebc747 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 @@ -62,6 +62,23 @@ paths: x-accepts: - application/json /requiredAndNullable: + get: + parameters: + - explode: true + in: query + name: filter + required: false + schema: + nullable: true + type: string + style: form + responses: + default: + description: OK + tags: + - requiredAndNullable + x-accepts: + - application/json post: requestBody: content: 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 index ada434bf0b9e..3873b33f25ad 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md @@ -4,10 +4,74 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**requiredAndNullableGet**](RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | | | [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | +## requiredAndNullableGet + +> requiredAndNullableGet(filter) + + + +### 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); + String filter = "filter_example"; // String | + try { + apiInstance.requiredAndNullableGet(filter); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **filter** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | OK | - | + + ## requiredAndNullablePost > RequiredAndNullable requiredAndNullablePost(requiredAndNullable) 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 index 150edbb586db..f2657d5cf390 100644 --- 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 @@ -3,6 +3,7 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.BaseApi; +import org.jspecify.annotations.Nullable; import org.openapitools.client.model.RequiredAndNullable; import java.util.Collections; @@ -37,6 +38,47 @@ public RequiredAndNullableApi(ApiClient apiClient) { super(apiClient); } + /** + * + * + *

0 - OK + * @param filter (optional) + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void requiredAndNullableGet(String filter) throws RestClientException { + requiredAndNullableGetWithHttpInfo(filter); + } + + /** + * + * + *

0 - OK + * @param filter (optional) + * @return ResponseEntity<Void> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity requiredAndNullableGetWithHttpInfo(String filter) throws RestClientException { + Object localVarPostBody = null; + + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); + final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "filter", filter)); + + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.GET, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); + } /** * * 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 ca33e3707136..8c468d3df02d 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md @@ -117,6 +117,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* | [**requiredAndNullableGet**](docs/RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | *RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | 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 15c1f4176a50..a1e9afebc747 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 @@ -62,6 +62,23 @@ paths: x-accepts: - application/json /requiredAndNullable: + get: + parameters: + - explode: true + in: query + name: filter + required: false + schema: + nullable: true + type: string + style: form + responses: + default: + description: OK + tags: + - requiredAndNullable + x-accepts: + - application/json post: requestBody: content: 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 index ada434bf0b9e..3873b33f25ad 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md @@ -4,10 +4,74 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**requiredAndNullableGet**](RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | | | [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | +## requiredAndNullableGet + +> requiredAndNullableGet(filter) + + + +### 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); + String filter = "filter_example"; // String | + try { + apiInstance.requiredAndNullableGet(filter); + } catch (ApiException e) { + System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **filter** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | OK | - | + + ## requiredAndNullablePost > RequiredAndNullable requiredAndNullablePost(requiredAndNullable) 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 index a7cf9f2d8749..162b7fc60f19 100644 --- 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 @@ -2,6 +2,7 @@ import org.openapitools.client.ApiClient; +import org.jspecify.annotations.Nullable; import org.openapitools.client.model.RequiredAndNullable; import java.util.HashMap; @@ -46,6 +47,72 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec requiredAndNullableGetRequestCreation(@Nullable String filter) throws WebClientResponseException { + Object postBody = 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(); + + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "filter", filter)); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono requiredAndNullableGet(@Nullable String filter) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return requiredAndNullableGetRequestCreation(filter).bodyToMono(localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> requiredAndNullableGetWithHttpInfo(@Nullable String filter) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return requiredAndNullableGetRequestCreation(filter).toEntity(localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param filter The filter parameter + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec requiredAndNullableGetWithResponseSpec(@Nullable String filter) throws WebClientResponseException { + return requiredAndNullableGetRequestCreation(filter); + } + /** * * 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 916596c41adb..decc24fc5304 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 @@ -5,6 +5,7 @@ */ package org.openapitools.api; +import org.jspecify.annotations.Nullable; import org.openapitools.model.RequiredAndNullable; import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; @@ -42,6 +43,32 @@ default Optional getRequest() { return Optional.empty(); } + String PATH_REQUIRED_AND_NULLABLE_GET = "/requiredAndNullable"; + /** + * GET /requiredAndNullable + * + * @param filter (optional) + * @return OK (status code 200) + */ + @Operation( + operationId = "requiredAndNullableGet", + tags = { "requiredAndNullable" }, + responses = { + @ApiResponse(responseCode = "default", description = "OK") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_GET + ) + default ResponseEntity requiredAndNullableGet( + @Parameter(name = "filter", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "filter", required = false) String filter + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + String PATH_REQUIRED_AND_NULLABLE_POST = "/requiredAndNullable"; /** * POST /requiredAndNullable 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 916596c41adb..1d55f60c1545 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 @@ -5,6 +5,7 @@ */ package org.openapitools.api; +import org.jspecify.annotations.Nullable; import org.openapitools.model.RequiredAndNullable; import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; @@ -42,6 +43,32 @@ default Optional getRequest() { return Optional.empty(); } + String PATH_REQUIRED_AND_NULLABLE_GET = "/requiredAndNullable"; + /** + * GET /requiredAndNullable + * + * @param filter (optional) + * @return OK (status code 200) + */ + @Operation( + operationId = "requiredAndNullableGet", + tags = { "requiredAndNullable" }, + responses = { + @ApiResponse(responseCode = "default", description = "OK") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_GET + ) + default ResponseEntity requiredAndNullableGet( + @Parameter(name = "filter", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "filter", required = false) Optional filter + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + String PATH_REQUIRED_AND_NULLABLE_POST = "/requiredAndNullable"; /** * POST /requiredAndNullable 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 916596c41adb..5961cbd5acc2 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 @@ -5,6 +5,7 @@ */ package org.openapitools.api; +import org.jspecify.annotations.Nullable; import org.openapitools.model.RequiredAndNullable; import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; @@ -42,6 +43,32 @@ default Optional getRequest() { return Optional.empty(); } + String PATH_REQUIRED_AND_NULLABLE_GET = "/requiredAndNullable"; + /** + * GET /requiredAndNullable + * + * @param filter (optional) + * @return OK (status code 200) + */ + @Operation( + operationId = "requiredAndNullableGet", + tags = { "requiredAndNullable" }, + responses = { + @ApiResponse(responseCode = "default", description = "OK") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_GET + ) + default ResponseEntity requiredAndNullableGet( + @Parameter(name = "filter", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "filter", required = false) @Nullable String filter + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + String PATH_REQUIRED_AND_NULLABLE_POST = "/requiredAndNullable"; /** * POST /requiredAndNullable From 6432c0b7e352aba768b5956bfe8d8d5a5b3fd30b Mon Sep 17 00:00:00 2001 From: jpfinne Date: Tue, 1 Sep 2026 18:46:03 +0200 Subject: [PATCH 12/12] Handling of SPRING_HTTP_INTERFACE query param required=false, nullable=true --- .../java/spring/SpringCodegenTest.java | 29 +- .../src/test/resources/3_0/java/jspecify.yaml | 14 +- .../.openapi-generator/FILES | 4 +- .../java/native-jackson3-jspecify/README.md | 8 +- .../native-jackson3-jspecify/api/openapi.yaml | 16 +- .../{RequiredAndNullableApi.md => NbleApi.md} | 70 ++-- ...quiredAndNullableApi.java => NbleApi.java} | 74 +++-- ...dNullableApiTest.java => NbleApiTest.java} | 28 +- .../.openapi-generator/FILES | 4 +- .../README.md | 4 +- .../api/openapi.yaml | 16 +- .../docs/NbleApi.md} | 36 ++- ...quiredAndNullableApi.java => NbleApi.java} | 95 ++++-- ...dNullableApiTest.java => NbleApiTest.java} | 24 +- .../.openapi-generator/FILES | 4 +- .../README.md | 4 +- .../api/openapi.yaml | 16 +- .../docs/NbleApi.md} | 36 ++- ...quiredAndNullableApi.java => NbleApi.java} | 95 ++++-- ...dNullableApiTest.java => NbleApiTest.java} | 24 +- .../.openapi-generator/FILES | 4 +- .../README.md | 4 +- .../api/openapi.yaml | 16 +- .../docs/NbleApi.md} | 36 ++- ...quiredAndNullableApi.java => NbleApi.java} | 38 ++- ...dNullableApiTest.java => NbleApiTest.java} | 28 +- .../.openapi-generator/FILES | 4 +- .../README.md | 4 +- .../api/openapi.yaml | 16 +- .../docs/NbleApi.md} | 36 ++- .../org/openapitools/client/api/NbleApi.java | 298 ++++++++++++++++++ .../client/api/RequiredAndNullableApi.java | 190 ----------- ...dNullableApiTest.java => NbleApiTest.java} | 25 +- .../.openapi-generator/FILES | 2 +- .../src/main/java/org/openapitools/Main.java | 27 ++ ...quiredAndNullableApi.java => NbleApi.java} | 34 +- .../.openapi-generator/FILES | 2 +- ...quiredAndNullableApi.java => NbleApi.java} | 34 +- .../.openapi-generator/FILES | 2 +- ...quiredAndNullableApi.java => NbleApi.java} | 34 +- 40 files changed, 914 insertions(+), 521 deletions(-) rename samples/client/petstore/java/native-jackson3-jspecify/docs/{RequiredAndNullableApi.md => NbleApi.md} (70%) rename samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/{RequiredAndNullableApi.java => NbleApi.java} (81%) rename samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/api/{RequiredAndNullableApiTest.java => NbleApiTest.java} (63%) rename samples/client/petstore/java/{restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md => restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/NbleApi.md} (70%) rename samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/{RequiredAndNullableApi.java => NbleApi.java} (56%) rename samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/api/{RequiredAndNullableApiTest.java => NbleApiTest.java} (63%) rename samples/client/petstore/java/{resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md => restclient-springBoot4-jackson3-jspecify/docs/NbleApi.md} (70%) rename samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/{RequiredAndNullableApi.java => NbleApi.java} (56%) rename samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/{RequiredAndNullableApiTest.java => NbleApiTest.java} (63%) rename samples/client/petstore/java/{webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md => resttemplate-springBoot4-jackson3-jspecify/docs/NbleApi.md} (70%) rename samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/{RequiredAndNullableApi.java => NbleApi.java} (76%) rename samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/{RequiredAndNullableApiTest.java => NbleApiTest.java} (65%) rename samples/client/petstore/java/{restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullableApi.md => webclient-springBoot4-jackson3-jspecify/docs/NbleApi.md} (70%) create mode 100644 samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/NbleApi.java delete mode 100644 samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java rename samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/{RequiredAndNullableApiTest.java => NbleApiTest.java} (62%) create mode 100644 samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/Main.java rename samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/{RequiredAndNullableApi.java => NbleApi.java} (78%) rename samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/{RequiredAndNullableApi.java => NbleApi.java} (78%) rename samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/{RequiredAndNullableApi.java => NbleApi.java} (78%) 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 954a25a683b3..9530753e256f 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 @@ -7231,16 +7231,18 @@ public void testJspecify(String library, int springBootVersion) throws IOExcepti "java.time.@Nullable Instant dtQuery", "java.time.@Nullable Instant dtCookie"); - JavaFileAssert requiredApi = JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")); + JavaFileAssert nbleApi = JavaFileAssert.assertThat(files.get("NbleApi.java")); // SPRING_HTTP_INTERFACE has other requirements for default in api arguments if (SPRING_HTTP_INTERFACE.equals(library)) { - requiredApi.fileContains( - " @Nullable String filter"); + nbleApi.fileContains( + ") String mandatory", + ") @Nullable String optional"); fooApiAssert.fileContains( "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") @Nullable String color"); } else { - requiredApi.fileContains( - " @Nullable String filter"); + nbleApi.fileContains( + ") String mandatory", + ") @Nullable String optional"); fooApiAssert.fileContains( "@RequestParam(value = \"color\", required = false, defaultValue = \"red\") String color"); } @@ -7357,13 +7359,17 @@ public void testJspecify_openapiNullable(String library, int springBootVersion) "java.time.@Nullable Instant dtParam", "java.time.@Nullable Instant dtQuery", "java.time.@Nullable Instant dtCookie"); - JavaFileAssert requiredApi = JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")); + JavaFileAssert nbleApi = JavaFileAssert.assertThat(files.get("NbleApi.java")); if (SPRING_HTTP_INTERFACE.equals(library)) { - requiredApi .fileContains("@RequestParam(value = \"filter\", required = false) @Nullable String filter"); + nbleApi .fileContains( + "@RequestParam(value = \"mandatory\", required = true) String mandatory", + "@RequestParam(value = \"optional\", required = false) @Nullable String optional"); } else { - // incorrect generation for required=false, nullable=true + // incorrect generation for required=false, nullable=true? + nbleApi .fileContains( + "@RequestParam(value = \"mandatory\", required = true) String mandatory", + "@RequestParam(value = \"optional\", required = false) String optional"); } - } @DataProvider(name = "jspecifyLibrariesUseOptional") @@ -7459,8 +7465,9 @@ public void testJspecify_useOptional(String library, int springBootVersion, bool .doesNotContainWithName("Nullable") .doesImportAnnotation("org.jspecify.annotations.Nullable"); } - JavaFileAssert.assertThat(files.get("RequiredAndNullableApi.java")) - .fileContains("@RequestParam(value = \"filter\", required = false) Optional filter"); + JavaFileAssert.assertThat(files.get("NbleApi.java")).fileContains( + "@RequestParam(value = \"mandatory\", required = true) String mandatory", + "@RequestParam(value = \"optional\", required = false) Optional optional"); } // ------------------------------------------------------------------------- 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 1ea765bfe296..9ccca42ec630 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 @@ -47,23 +47,29 @@ paths: application/json: schema: $ref: '#/components/schemas/Foo' - /requiredAndNullable: + /nble: get: tags: - - requiredAndNullable + - nble parameters: - - name: filter + - name: optional in: query required: false schema: type: string nullable: true + - name: mandatory + in: query + required: true + schema: + type: string + nullable: true responses: default: description: OK post: tags: - - requiredAndNullable + - nble requestBody: required: true description: bodyWithRequiredAndNullableAttributes 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 b169aa1ef064..89d15fb8016f 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES @@ -9,8 +9,8 @@ docs/FileApi.md docs/FileContent.md docs/Foo.md docs/FooApi.md +docs/NbleApi.md docs/RequiredAndNullable.md -docs/RequiredAndNullableApi.md docs/UploadApi.md git_push.sh gradle.properties @@ -34,7 +34,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/NbleApi.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 diff --git a/samples/client/petstore/java/native-jackson3-jspecify/README.md b/samples/client/petstore/java/native-jackson3-jspecify/README.md index 9c53b1445e7f..e0425bfbbb0c 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/native-jackson3-jspecify/README.md @@ -111,10 +111,10 @@ 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* | [**requiredAndNullableGet**](docs/RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | -*RequiredAndNullableApi* | [**requiredAndNullableGetWithHttpInfo**](docs/RequiredAndNullableApi.md#requiredAndNullableGetWithHttpInfo) | **GET** /requiredAndNullable | -*RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | -*RequiredAndNullableApi* | [**requiredAndNullablePostWithHttpInfo**](docs/RequiredAndNullableApi.md#requiredAndNullablePostWithHttpInfo) | **POST** /requiredAndNullable | +*NbleApi* | [**nbleGet**](docs/NbleApi.md#nbleGet) | **GET** /nble | +*NbleApi* | [**nbleGetWithHttpInfo**](docs/NbleApi.md#nbleGetWithHttpInfo) | **GET** /nble | +*NbleApi* | [**nblePost**](docs/NbleApi.md#nblePost) | **POST** /nble | +*NbleApi* | [**nblePostWithHttpInfo**](docs/NbleApi.md#nblePostWithHttpInfo) | **POST** /nble | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadFilesPostWithHttpInfo**](docs/UploadApi.md#uploadFilesPostWithHttpInfo) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | 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 a1e9afebc747..9c5f4e7cdb47 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml @@ -61,22 +61,30 @@ paths: - foo x-accepts: - application/json - /requiredAndNullable: + /nble: get: parameters: - explode: true in: query - name: filter + name: optional required: false schema: nullable: true type: string style: form + - explode: true + in: query + name: mandatory + required: true + schema: + nullable: true + type: string + style: form responses: default: description: OK tags: - - requiredAndNullable + - nble x-accepts: - application/json post: @@ -95,7 +103,7 @@ paths: $ref: "#/components/schemas/RequiredAndNullable" description: response tags: - - requiredAndNullable + - nble x-content-type: application/json x-accepts: - application/json diff --git a/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullableApi.md b/samples/client/petstore/java/native-jackson3-jspecify/docs/NbleApi.md similarity index 70% rename from samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullableApi.md rename to samples/client/petstore/java/native-jackson3-jspecify/docs/NbleApi.md index 398a683bc143..53d0df32ae58 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/docs/RequiredAndNullableApi.md +++ b/samples/client/petstore/java/native-jackson3-jspecify/docs/NbleApi.md @@ -1,19 +1,19 @@ -# RequiredAndNullableApi +# NbleApi All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| -| [**requiredAndNullableGet**](RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | | -| [**requiredAndNullableGetWithHttpInfo**](RequiredAndNullableApi.md#requiredAndNullableGetWithHttpInfo) | **GET** /requiredAndNullable | | -| [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | -| [**requiredAndNullablePostWithHttpInfo**](RequiredAndNullableApi.md#requiredAndNullablePostWithHttpInfo) | **POST** /requiredAndNullable | | +| [**nbleGet**](NbleApi.md#nbleGet) | **GET** /nble | | +| [**nbleGetWithHttpInfo**](NbleApi.md#nbleGetWithHttpInfo) | **GET** /nble | | +| [**nblePost**](NbleApi.md#nblePost) | **POST** /nble | | +| [**nblePostWithHttpInfo**](NbleApi.md#nblePostWithHttpInfo) | **POST** /nble | | -## requiredAndNullableGet +## nbleGet -> void requiredAndNullableGet(filter) +> void nbleGet(mandatory, optional) @@ -25,19 +25,20 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); - String filter = "filter_example"; // String | + NbleApi apiInstance = new NbleApi(defaultClient); + String mandatory = "mandatory_example"; // String | + String optional = "optional_example"; // String | try { - apiInstance.requiredAndNullableGet(filter); + apiInstance.nbleGet(mandatory, optional); } catch (ApiException e) { - System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + System.err.println("Exception when calling NbleApi#nbleGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -52,7 +53,8 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **filter** | **String**| | [optional] | +| **mandatory** | **String**| | | +| **optional** | **String**| | [optional] | ### Return type @@ -73,9 +75,9 @@ No authorization required |-------------|-------------|------------------| | **0** | OK | - | -## requiredAndNullableGetWithHttpInfo +## nbleGetWithHttpInfo -> ApiResponse requiredAndNullableGetWithHttpInfo(filter) +> ApiResponse nbleGetWithHttpInfo(mandatory, optional) @@ -88,21 +90,22 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); - String filter = "filter_example"; // String | + NbleApi apiInstance = new NbleApi(defaultClient); + String mandatory = "mandatory_example"; // String | + String optional = "optional_example"; // String | try { - ApiResponse response = apiInstance.requiredAndNullableGetWithHttpInfo(filter); + ApiResponse response = apiInstance.nbleGetWithHttpInfo(mandatory, optional); System.out.println("Status code: " + response.getStatusCode()); System.out.println("Response headers: " + response.getHeaders()); } catch (ApiException e) { - System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + System.err.println("Exception when calling NbleApi#nbleGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Response headers: " + e.getResponseHeaders()); System.err.println("Reason: " + e.getResponseBody()); @@ -117,7 +120,8 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **filter** | **String**| | [optional] | +| **mandatory** | **String**| | | +| **optional** | **String**| | [optional] | ### Return type @@ -139,9 +143,9 @@ No authorization required | **0** | OK | - | -## requiredAndNullablePost +## nblePost -> RequiredAndNullable requiredAndNullablePost(requiredAndNullable) +> RequiredAndNullable nblePost(requiredAndNullable) @@ -153,20 +157,20 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + NbleApi apiInstance = new NbleApi(defaultClient); RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes try { - RequiredAndNullable result = apiInstance.requiredAndNullablePost(requiredAndNullable); + RequiredAndNullable result = apiInstance.nblePost(requiredAndNullable); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullablePost"); + System.err.println("Exception when calling NbleApi#nblePost"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -202,9 +206,9 @@ No authorization required |-------------|-------------|------------------| | **0** | response | - | -## requiredAndNullablePostWithHttpInfo +## nblePostWithHttpInfo -> ApiResponse requiredAndNullablePostWithHttpInfo(requiredAndNullable) +> ApiResponse nblePostWithHttpInfo(requiredAndNullable) @@ -217,22 +221,22 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + NbleApi apiInstance = new NbleApi(defaultClient); RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes try { - ApiResponse response = apiInstance.requiredAndNullablePostWithHttpInfo(requiredAndNullable); + ApiResponse response = apiInstance.nblePostWithHttpInfo(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("Exception when calling NbleApi#nblePost"); System.err.println("Status code: " + e.getCode()); System.err.println("Response headers: " + e.getResponseHeaders()); System.err.println("Reason: " + e.getResponseBody()); 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/NbleApi.java similarity index 81% rename from samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java rename to samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/NbleApi.java index cae962a31316..c6d9fb056507 100644 --- 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/NbleApi.java @@ -48,7 +48,7 @@ import java.util.function.Consumer; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0-SNAPSHOT") -public class RequiredAndNullableApi { +public class NbleApi { /** * Utility class for extending HttpRequest.Builder functionality. */ @@ -77,11 +77,11 @@ static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Ma private final Consumer> memberVarResponseInterceptor; private final Consumer> memberVarAsyncResponseInterceptor; - public RequiredAndNullableApi() { + public NbleApi() { this(Configuration.getDefaultApiClient()); } - public RequiredAndNullableApi(ApiClient apiClient) { + public NbleApi(ApiClient apiClient) { memberVarHttpClient = apiClient.getHttpClient(); memberVarObjectMapper = apiClient.getObjectMapper(); memberVarBaseUri = apiClient.getBaseUri(); @@ -167,45 +167,49 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx /** * * - * @param filter (optional) + * @param mandatory (required) + * @param optional (optional) * @throws ApiException if fails to make API call */ - public void requiredAndNullableGet(@Nullable String filter) throws ApiException { - requiredAndNullableGet(filter, null); + public void nbleGet(@Nullable String mandatory, @Nullable String optional) throws ApiException { + nbleGet(mandatory, optional, null); } /** * * - * @param filter (optional) + * @param mandatory (required) + * @param optional (optional) * @param headers Optional headers to include in the request * @throws ApiException if fails to make API call */ - public void requiredAndNullableGet(@Nullable String filter, Map headers) throws ApiException { - requiredAndNullableGetWithHttpInfo(filter, headers); + public void nbleGet(@Nullable String mandatory, @Nullable String optional, Map headers) throws ApiException { + nbleGetWithHttpInfo(mandatory, optional, headers); } /** * * - * @param filter (optional) + * @param mandatory (required) + * @param optional (optional) * @return ApiResponse<Void> * @throws ApiException if fails to make API call */ - public ApiResponse requiredAndNullableGetWithHttpInfo(@Nullable String filter) throws ApiException { - return requiredAndNullableGetWithHttpInfo(filter, null); + public ApiResponse nbleGetWithHttpInfo(@Nullable String mandatory, @Nullable String optional) throws ApiException { + return nbleGetWithHttpInfo(mandatory, optional, null); } /** * * - * @param filter (optional) + * @param mandatory (required) + * @param optional (optional) * @param headers Optional headers to include in the request * @return ApiResponse<Void> * @throws ApiException if fails to make API call */ - public ApiResponse requiredAndNullableGetWithHttpInfo(@Nullable String filter, Map headers) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = requiredAndNullableGetRequestBuilder(filter, headers); + public ApiResponse nbleGetWithHttpInfo(@Nullable String mandatory, @Nullable String optional, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = nbleGetRequestBuilder(mandatory, optional, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -216,7 +220,7 @@ public ApiResponse requiredAndNullableGetWithHttpInfo(@Nullable String fil InputStream localVarResponseBody = null; try { if (localVarResponse.statusCode()/ 100 != 2) { - throw getApiException("requiredAndNullableGet", localVarResponse); + throw getApiException("nbleGet", localVarResponse); } localVarResponseBody = ApiClient.getResponseBody(localVarResponse); if (localVarResponseBody != null) { @@ -241,17 +245,23 @@ public ApiResponse requiredAndNullableGetWithHttpInfo(@Nullable String fil } } - private HttpRequest.Builder requiredAndNullableGetRequestBuilder(@Nullable String filter, Map headers) throws ApiException { + private HttpRequest.Builder nbleGetRequestBuilder(@Nullable String mandatory, @Nullable String optional, Map headers) throws ApiException { + // verify the required parameter 'mandatory' is set + if (mandatory == null) { + throw new ApiException(400, "Missing the required parameter 'mandatory' when calling nbleGet"); + } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); - String localVarPath = "/requiredAndNullable"; + String localVarPath = "/nble"; List localVarQueryParams = new ArrayList<>(); StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); String localVarQueryParameterBaseName; - localVarQueryParameterBaseName = "filter"; - localVarQueryParams.addAll(ApiClient.parameterToPairs("filter", filter)); + localVarQueryParameterBaseName = "optional"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("optional", optional)); + localVarQueryParameterBaseName = "mandatory"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("mandatory", mandatory)); if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { StringJoiner queryJoiner = new StringJoiner("&"); @@ -285,8 +295,8 @@ private HttpRequest.Builder requiredAndNullableGetRequestBuilder(@Nullable Strin * @return RequiredAndNullable * @throws ApiException if fails to make API call */ - public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredAndNullable) throws ApiException { - return requiredAndNullablePost(requiredAndNullable, null); + public RequiredAndNullable nblePost(RequiredAndNullable requiredAndNullable) throws ApiException { + return nblePost(requiredAndNullable, null); } /** @@ -297,8 +307,8 @@ public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredA * @return RequiredAndNullable * @throws ApiException if fails to make API call */ - public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredAndNullable, Map headers) throws ApiException { - ApiResponse localVarResponse = requiredAndNullablePostWithHttpInfo(requiredAndNullable, headers); + public RequiredAndNullable nblePost(RequiredAndNullable requiredAndNullable, Map headers) throws ApiException { + ApiResponse localVarResponse = nblePostWithHttpInfo(requiredAndNullable, headers); return localVarResponse.getData(); } @@ -309,8 +319,8 @@ public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredA * @return ApiResponse<RequiredAndNullable> * @throws ApiException if fails to make API call */ - public ApiResponse requiredAndNullablePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws ApiException { - return requiredAndNullablePostWithHttpInfo(requiredAndNullable, null); + public ApiResponse nblePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws ApiException { + return nblePostWithHttpInfo(requiredAndNullable, null); } /** @@ -321,8 +331,8 @@ public ApiResponse requiredAndNullablePostWithHttpInfo(Requ * @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); + public ApiResponse nblePostWithHttpInfo(RequiredAndNullable requiredAndNullable, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = nblePostRequestBuilder(requiredAndNullable, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -333,7 +343,7 @@ public ApiResponse requiredAndNullablePostWithHttpInfo(Requ InputStream localVarResponseBody = null; try { if (localVarResponse.statusCode()/ 100 != 2) { - throw getApiException("requiredAndNullablePost", localVarResponse); + throw getApiException("nblePost", localVarResponse); } localVarResponseBody = ApiClient.getResponseBody(localVarResponse); if (localVarResponseBody == null) { @@ -369,15 +379,15 @@ public ApiResponse requiredAndNullablePostWithHttpInfo(Requ } } - private HttpRequest.Builder requiredAndNullablePostRequestBuilder(RequiredAndNullable requiredAndNullable, Map headers) throws ApiException { + private HttpRequest.Builder nblePostRequestBuilder(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"); + throw new ApiException(400, "Missing the required parameter 'requiredAndNullable' when calling nblePost"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); - String localVarPath = "/requiredAndNullable"; + String localVarPath = "/nble"; localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); 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/NbleApiTest.java similarity index 63% rename from samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java rename to samples/client/petstore/java/native-jackson3-jspecify/src/test/java/org/openapitools/client/api/NbleApiTest.java index e978305a1590..8a9f7cacc7eb 100644 --- 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/NbleApiTest.java @@ -14,6 +14,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiException; +import org.jspecify.annotations.Nullable; import org.openapitools.client.model.RequiredAndNullable; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -26,12 +27,12 @@ /** - * API tests for RequiredAndNullableApi + * API tests for NbleApi */ @Disabled -public class RequiredAndNullableApiTest { +public class NbleApiTest { - private final RequiredAndNullableApi api = new RequiredAndNullableApi(); + private final NbleApi api = new NbleApi(); /** @@ -43,10 +44,27 @@ public class RequiredAndNullableApiTest { * if the Api call fails */ @Test - public void requiredAndNullablePostTest() throws ApiException { + public void nbleGetTest() throws ApiException { + String filter = null; + + api.nbleGet(filter); + + // TODO: test validations + } + + /** + * + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void nblePostTest() throws ApiException { RequiredAndNullable requiredAndNullable = null; RequiredAndNullable response = - api.requiredAndNullablePost(requiredAndNullable); + api.nblePost(requiredAndNullable); // TODO: test validations } 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 a9762735bc0b..6e335fb89a26 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 @@ -9,8 +9,8 @@ docs/FileApi.md docs/FileContent.md docs/Foo.md docs/FooApi.md +docs/NbleApi.md docs/RequiredAndNullable.md -docs/RequiredAndNullableApi.md docs/UploadApi.md git_push.sh gradle.properties @@ -30,7 +30,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/NbleApi.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 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 5a5e0c9c85a6..4e5ccb264c9b 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 @@ -117,8 +117,8 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *FileApi* | [**fileIdGet**](docs/FileApi.md#fileIdGet) | **GET** /file/{id} | *FooApi* | [**fooDtParamGet**](docs/FooApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | -*RequiredAndNullableApi* | [**requiredAndNullableGet**](docs/RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | -*RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | +*NbleApi* | [**nbleGet**](docs/NbleApi.md#nbleGet) | **GET** /nble | +*NbleApi* | [**nblePost**](docs/NbleApi.md#nblePost) | **POST** /nble | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | 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 a1e9afebc747..9c5f4e7cdb47 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 @@ -61,22 +61,30 @@ paths: - foo x-accepts: - application/json - /requiredAndNullable: + /nble: get: parameters: - explode: true in: query - name: filter + name: optional required: false schema: nullable: true type: string style: form + - explode: true + in: query + name: mandatory + required: true + schema: + nullable: true + type: string + style: form responses: default: description: OK tags: - - requiredAndNullable + - nble x-accepts: - application/json post: @@ -95,7 +103,7 @@ paths: $ref: "#/components/schemas/RequiredAndNullable" description: response tags: - - requiredAndNullable + - nble x-content-type: application/json x-accepts: - application/json diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/NbleApi.md similarity index 70% rename from samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md rename to samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/NbleApi.md index 3873b33f25ad..0ad469cec5e2 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/NbleApi.md @@ -1,17 +1,17 @@ -# RequiredAndNullableApi +# NbleApi All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| -| [**requiredAndNullableGet**](RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | | -| [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | +| [**nbleGet**](NbleApi.md#nbleGet) | **GET** /nble | | +| [**nblePost**](NbleApi.md#nblePost) | **POST** /nble | | -## requiredAndNullableGet +## nbleGet -> requiredAndNullableGet(filter) +> nbleGet(mandatory, optional) @@ -23,19 +23,20 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); - String filter = "filter_example"; // String | + NbleApi apiInstance = new NbleApi(defaultClient); + String mandatory = "mandatory_example"; // String | + String optional = "optional_example"; // String | try { - apiInstance.requiredAndNullableGet(filter); + apiInstance.nbleGet(mandatory, optional); } catch (ApiException e) { - System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + System.err.println("Exception when calling NbleApi#nbleGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -50,7 +51,8 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **filter** | **String**| | [optional] | +| **mandatory** | **String**| | | +| **optional** | **String**| | [optional] | ### Return type @@ -72,9 +74,9 @@ No authorization required | **0** | OK | - | -## requiredAndNullablePost +## nblePost -> RequiredAndNullable requiredAndNullablePost(requiredAndNullable) +> RequiredAndNullable nblePost(requiredAndNullable) @@ -86,20 +88,20 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + NbleApi apiInstance = new NbleApi(defaultClient); RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes try { - RequiredAndNullable result = apiInstance.requiredAndNullablePost(requiredAndNullable); + RequiredAndNullable result = apiInstance.nblePost(requiredAndNullable); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullablePost"); + System.err.println("Exception when calling NbleApi#nblePost"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); 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/NbleApi.java similarity index 56% rename from samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java rename to samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/NbleApi.java index eb0991553af0..09a811a25c70 100644 --- 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/NbleApi.java @@ -26,14 +26,14 @@ import org.springframework.web.client.RestClientResponseException; @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0-SNAPSHOT") -public class RequiredAndNullableApi { +public class NbleApi { private ApiClient apiClient; - public RequiredAndNullableApi() { + public NbleApi() { this(new ApiClient()); } - public RequiredAndNullableApi(ApiClient apiClient) { + public NbleApi(ApiClient apiClient) { this.apiClient = apiClient; } @@ -45,15 +45,56 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + public record NbleGetRequest(@Nullable String mandatory, @Nullable String optional){} + + /** + * + * + *

0 - OK + * @param requestParameters The nbleGet request parameters as object + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public void nbleGet(NbleGetRequest requestParameters) throws RestClientResponseException { + this.nbleGet(requestParameters.mandatory(), requestParameters.optional()); + } + /** * * *

0 - OK - * @param filter The filter parameter + * @param requestParameters The nbleGet request parameters as object * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - private ResponseSpec requiredAndNullableGetRequestCreation(@Nullable String filter) throws RestClientResponseException { + public ResponseEntity nbleGetWithHttpInfo(NbleGetRequest requestParameters) throws RestClientResponseException { + return this.nbleGetWithHttpInfo(requestParameters.mandatory(), requestParameters.optional()); + } + + /** + * + * + *

0 - OK + * @param requestParameters The nbleGet request parameters as object + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec nbleGetWithResponseSpec(NbleGetRequest requestParameters) throws RestClientResponseException { + return this.nbleGetWithResponseSpec(requestParameters.mandatory(), requestParameters.optional()); + } + + /** + * + * + *

0 - OK + * @param mandatory The mandatory parameter + * @param optional The optional parameter + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec nbleGetRequestCreation(@Nullable String mandatory, @Nullable String optional) throws RestClientResponseException { Object postBody = null; + // verify the required parameter 'mandatory' is set + if (mandatory == null) { + throw new RestClientResponseException("Missing the required parameter 'mandatory' when calling nbleGet", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } // create path and map variables final Map pathParams = new HashMap<>(); @@ -62,7 +103,8 @@ private ResponseSpec requiredAndNullableGetRequestCreation(@Nullable String filt final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); final MultiValueMap formParams = new LinkedMultiValueMap<>(); - localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "filter", filter)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "optional", optional)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "mandatory", mandatory)); final String[] localVarAccepts = { }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -72,43 +114,46 @@ private ResponseSpec requiredAndNullableGetRequestCreation(@Nullable String filt String[] localVarAuthNames = new String[] { }; ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + return apiClient.invokeAPI("/nble", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } /** * * *

0 - OK - * @param filter The filter parameter + * @param mandatory The mandatory parameter + * @param optional The optional parameter * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public void requiredAndNullableGet(@Nullable String filter) throws RestClientResponseException { + public void nbleGet(@Nullable String mandatory, @Nullable String optional) throws RestClientResponseException { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - requiredAndNullableGetRequestCreation(filter).body(localVarReturnType); + nbleGetRequestCreation(mandatory, optional).body(localVarReturnType); } /** * * *

0 - OK - * @param filter The filter parameter + * @param mandatory The mandatory parameter + * @param optional The optional parameter * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseEntity requiredAndNullableGetWithHttpInfo(@Nullable String filter) throws RestClientResponseException { + public ResponseEntity nbleGetWithHttpInfo(@Nullable String mandatory, @Nullable String optional) throws RestClientResponseException { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return requiredAndNullableGetRequestCreation(filter).toEntity(localVarReturnType); + return nbleGetRequestCreation(mandatory, optional).toEntity(localVarReturnType); } /** * * *

0 - OK - * @param filter The filter parameter + * @param mandatory The mandatory parameter + * @param optional The optional parameter * @return ResponseSpec * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseSpec requiredAndNullableGetWithResponseSpec(@Nullable String filter) throws RestClientResponseException { - return requiredAndNullableGetRequestCreation(filter); + public ResponseSpec nbleGetWithResponseSpec(@Nullable String mandatory, @Nullable String optional) throws RestClientResponseException { + return nbleGetRequestCreation(mandatory, optional); } /** @@ -119,11 +164,11 @@ public ResponseSpec requiredAndNullableGetWithResponseSpec(@Nullable String filt * @return RequiredAndNullable * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - private ResponseSpec requiredAndNullablePostRequestCreation(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + private ResponseSpec nblePostRequestCreation(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); + throw new RestClientResponseException("Missing the required parameter 'requiredAndNullable' when calling nblePost", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // create path and map variables final Map pathParams = new HashMap<>(); @@ -145,7 +190,7 @@ private ResponseSpec requiredAndNullablePostRequestCreation(RequiredAndNullable String[] localVarAuthNames = new String[] { }; ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.POST, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + return apiClient.invokeAPI("/nble", HttpMethod.POST, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } /** @@ -156,9 +201,9 @@ private ResponseSpec requiredAndNullablePostRequestCreation(RequiredAndNullable * @return RequiredAndNullable * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + public RequiredAndNullable nblePost(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return requiredAndNullablePostRequestCreation(requiredAndNullable).body(localVarReturnType); + return nblePostRequestCreation(requiredAndNullable).body(localVarReturnType); } /** @@ -169,9 +214,9 @@ public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredA * @return ResponseEntity<RequiredAndNullable> * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseEntity requiredAndNullablePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + public ResponseEntity nblePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return requiredAndNullablePostRequestCreation(requiredAndNullable).toEntity(localVarReturnType); + return nblePostRequestCreation(requiredAndNullable).toEntity(localVarReturnType); } /** @@ -182,7 +227,7 @@ public ResponseEntity requiredAndNullablePostWithHttpInfo(R * @return ResponseSpec * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseSpec requiredAndNullablePostWithResponseSpec(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { - return requiredAndNullablePostRequestCreation(requiredAndNullable); + public ResponseSpec nblePostWithResponseSpec(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + return nblePostRequestCreation(requiredAndNullable); } } 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/NbleApiTest.java similarity index 63% rename from samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java rename to samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/test/java/org/openapitools/client/api/NbleApiTest.java index 41e971ae1aa5..3aa85c44cec3 100644 --- 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/NbleApiTest.java @@ -13,6 +13,7 @@ package org.openapitools.client.api; +import org.jspecify.annotations.Nullable; import org.openapitools.client.model.RequiredAndNullable; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -24,12 +25,12 @@ import java.util.stream.Collectors; /** - * API tests for RequiredAndNullableApi + * API tests for NbleApi */ @Disabled -public class RequiredAndNullableApiTest { +public class NbleApiTest { - private final RequiredAndNullableApi api = new RequiredAndNullableApi(); + private final NbleApi api = new NbleApi(); /** @@ -38,9 +39,22 @@ public class RequiredAndNullableApiTest { * */ @Test - public void requiredAndNullablePostTest() { + public void nbleGetTest() { + String filter = null; + api.nbleGet(filter); + + // TODO: test validations + } + + /** + * + * + * + */ + @Test + public void nblePostTest() { RequiredAndNullable requiredAndNullable = null; - RequiredAndNullable response = api.requiredAndNullablePost(requiredAndNullable); + RequiredAndNullable response = api.nblePost(requiredAndNullable); // TODO: test validations } 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 a9762735bc0b..6e335fb89a26 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 @@ -9,8 +9,8 @@ docs/FileApi.md docs/FileContent.md docs/Foo.md docs/FooApi.md +docs/NbleApi.md docs/RequiredAndNullable.md -docs/RequiredAndNullableApi.md docs/UploadApi.md git_push.sh gradle.properties @@ -30,7 +30,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/NbleApi.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 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 5a5e0c9c85a6..4e5ccb264c9b 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md @@ -117,8 +117,8 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *FileApi* | [**fileIdGet**](docs/FileApi.md#fileIdGet) | **GET** /file/{id} | *FooApi* | [**fooDtParamGet**](docs/FooApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | -*RequiredAndNullableApi* | [**requiredAndNullableGet**](docs/RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | -*RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | +*NbleApi* | [**nbleGet**](docs/NbleApi.md#nbleGet) | **GET** /nble | +*NbleApi* | [**nblePost**](docs/NbleApi.md#nblePost) | **POST** /nble | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | 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 a1e9afebc747..9c5f4e7cdb47 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 @@ -61,22 +61,30 @@ paths: - foo x-accepts: - application/json - /requiredAndNullable: + /nble: get: parameters: - explode: true in: query - name: filter + name: optional required: false schema: nullable: true type: string style: form + - explode: true + in: query + name: mandatory + required: true + schema: + nullable: true + type: string + style: form responses: default: description: OK tags: - - requiredAndNullable + - nble x-accepts: - application/json post: @@ -95,7 +103,7 @@ paths: $ref: "#/components/schemas/RequiredAndNullable" description: response tags: - - requiredAndNullable + - nble x-content-type: application/json x-accepts: - application/json diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/NbleApi.md similarity index 70% rename from samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md rename to samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/NbleApi.md index 3873b33f25ad..0ad469cec5e2 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/NbleApi.md @@ -1,17 +1,17 @@ -# RequiredAndNullableApi +# NbleApi All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| -| [**requiredAndNullableGet**](RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | | -| [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | +| [**nbleGet**](NbleApi.md#nbleGet) | **GET** /nble | | +| [**nblePost**](NbleApi.md#nblePost) | **POST** /nble | | -## requiredAndNullableGet +## nbleGet -> requiredAndNullableGet(filter) +> nbleGet(mandatory, optional) @@ -23,19 +23,20 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); - String filter = "filter_example"; // String | + NbleApi apiInstance = new NbleApi(defaultClient); + String mandatory = "mandatory_example"; // String | + String optional = "optional_example"; // String | try { - apiInstance.requiredAndNullableGet(filter); + apiInstance.nbleGet(mandatory, optional); } catch (ApiException e) { - System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + System.err.println("Exception when calling NbleApi#nbleGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -50,7 +51,8 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **filter** | **String**| | [optional] | +| **mandatory** | **String**| | | +| **optional** | **String**| | [optional] | ### Return type @@ -72,9 +74,9 @@ No authorization required | **0** | OK | - | -## requiredAndNullablePost +## nblePost -> RequiredAndNullable requiredAndNullablePost(requiredAndNullable) +> RequiredAndNullable nblePost(requiredAndNullable) @@ -86,20 +88,20 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + NbleApi apiInstance = new NbleApi(defaultClient); RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes try { - RequiredAndNullable result = apiInstance.requiredAndNullablePost(requiredAndNullable); + RequiredAndNullable result = apiInstance.nblePost(requiredAndNullable); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullablePost"); + System.err.println("Exception when calling NbleApi#nblePost"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); 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/NbleApi.java similarity index 56% rename from samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java rename to samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/NbleApi.java index eb0991553af0..09a811a25c70 100644 --- 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/NbleApi.java @@ -26,14 +26,14 @@ import org.springframework.web.client.RestClientResponseException; @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0-SNAPSHOT") -public class RequiredAndNullableApi { +public class NbleApi { private ApiClient apiClient; - public RequiredAndNullableApi() { + public NbleApi() { this(new ApiClient()); } - public RequiredAndNullableApi(ApiClient apiClient) { + public NbleApi(ApiClient apiClient) { this.apiClient = apiClient; } @@ -45,15 +45,56 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + public record NbleGetRequest(@Nullable String mandatory, @Nullable String optional){} + + /** + * + * + *

0 - OK + * @param requestParameters The nbleGet request parameters as object + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public void nbleGet(NbleGetRequest requestParameters) throws RestClientResponseException { + this.nbleGet(requestParameters.mandatory(), requestParameters.optional()); + } + /** * * *

0 - OK - * @param filter The filter parameter + * @param requestParameters The nbleGet request parameters as object * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - private ResponseSpec requiredAndNullableGetRequestCreation(@Nullable String filter) throws RestClientResponseException { + public ResponseEntity nbleGetWithHttpInfo(NbleGetRequest requestParameters) throws RestClientResponseException { + return this.nbleGetWithHttpInfo(requestParameters.mandatory(), requestParameters.optional()); + } + + /** + * + * + *

0 - OK + * @param requestParameters The nbleGet request parameters as object + * @return ResponseSpec + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec nbleGetWithResponseSpec(NbleGetRequest requestParameters) throws RestClientResponseException { + return this.nbleGetWithResponseSpec(requestParameters.mandatory(), requestParameters.optional()); + } + + /** + * + * + *

0 - OK + * @param mandatory The mandatory parameter + * @param optional The optional parameter + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec nbleGetRequestCreation(@Nullable String mandatory, @Nullable String optional) throws RestClientResponseException { Object postBody = null; + // verify the required parameter 'mandatory' is set + if (mandatory == null) { + throw new RestClientResponseException("Missing the required parameter 'mandatory' when calling nbleGet", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } // create path and map variables final Map pathParams = new HashMap<>(); @@ -62,7 +103,8 @@ private ResponseSpec requiredAndNullableGetRequestCreation(@Nullable String filt final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); final MultiValueMap formParams = new LinkedMultiValueMap<>(); - localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "filter", filter)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "optional", optional)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "mandatory", mandatory)); final String[] localVarAccepts = { }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -72,43 +114,46 @@ private ResponseSpec requiredAndNullableGetRequestCreation(@Nullable String filt String[] localVarAuthNames = new String[] { }; ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + return apiClient.invokeAPI("/nble", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } /** * * *

0 - OK - * @param filter The filter parameter + * @param mandatory The mandatory parameter + * @param optional The optional parameter * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public void requiredAndNullableGet(@Nullable String filter) throws RestClientResponseException { + public void nbleGet(@Nullable String mandatory, @Nullable String optional) throws RestClientResponseException { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - requiredAndNullableGetRequestCreation(filter).body(localVarReturnType); + nbleGetRequestCreation(mandatory, optional).body(localVarReturnType); } /** * * *

0 - OK - * @param filter The filter parameter + * @param mandatory The mandatory parameter + * @param optional The optional parameter * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseEntity requiredAndNullableGetWithHttpInfo(@Nullable String filter) throws RestClientResponseException { + public ResponseEntity nbleGetWithHttpInfo(@Nullable String mandatory, @Nullable String optional) throws RestClientResponseException { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return requiredAndNullableGetRequestCreation(filter).toEntity(localVarReturnType); + return nbleGetRequestCreation(mandatory, optional).toEntity(localVarReturnType); } /** * * *

0 - OK - * @param filter The filter parameter + * @param mandatory The mandatory parameter + * @param optional The optional parameter * @return ResponseSpec * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseSpec requiredAndNullableGetWithResponseSpec(@Nullable String filter) throws RestClientResponseException { - return requiredAndNullableGetRequestCreation(filter); + public ResponseSpec nbleGetWithResponseSpec(@Nullable String mandatory, @Nullable String optional) throws RestClientResponseException { + return nbleGetRequestCreation(mandatory, optional); } /** @@ -119,11 +164,11 @@ public ResponseSpec requiredAndNullableGetWithResponseSpec(@Nullable String filt * @return RequiredAndNullable * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - private ResponseSpec requiredAndNullablePostRequestCreation(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + private ResponseSpec nblePostRequestCreation(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); + throw new RestClientResponseException("Missing the required parameter 'requiredAndNullable' when calling nblePost", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // create path and map variables final Map pathParams = new HashMap<>(); @@ -145,7 +190,7 @@ private ResponseSpec requiredAndNullablePostRequestCreation(RequiredAndNullable String[] localVarAuthNames = new String[] { }; ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.POST, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + return apiClient.invokeAPI("/nble", HttpMethod.POST, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } /** @@ -156,9 +201,9 @@ private ResponseSpec requiredAndNullablePostRequestCreation(RequiredAndNullable * @return RequiredAndNullable * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + public RequiredAndNullable nblePost(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return requiredAndNullablePostRequestCreation(requiredAndNullable).body(localVarReturnType); + return nblePostRequestCreation(requiredAndNullable).body(localVarReturnType); } /** @@ -169,9 +214,9 @@ public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredA * @return ResponseEntity<RequiredAndNullable> * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseEntity requiredAndNullablePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + public ResponseEntity nblePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return requiredAndNullablePostRequestCreation(requiredAndNullable).toEntity(localVarReturnType); + return nblePostRequestCreation(requiredAndNullable).toEntity(localVarReturnType); } /** @@ -182,7 +227,7 @@ public ResponseEntity requiredAndNullablePostWithHttpInfo(R * @return ResponseSpec * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseSpec requiredAndNullablePostWithResponseSpec(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { - return requiredAndNullablePostRequestCreation(requiredAndNullable); + public ResponseSpec nblePostWithResponseSpec(RequiredAndNullable requiredAndNullable) throws RestClientResponseException { + return nblePostRequestCreation(requiredAndNullable); } } 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/NbleApiTest.java similarity index 63% rename from samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java rename to samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/NbleApiTest.java index 41e971ae1aa5..3aa85c44cec3 100644 --- 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/NbleApiTest.java @@ -13,6 +13,7 @@ package org.openapitools.client.api; +import org.jspecify.annotations.Nullable; import org.openapitools.client.model.RequiredAndNullable; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -24,12 +25,12 @@ import java.util.stream.Collectors; /** - * API tests for RequiredAndNullableApi + * API tests for NbleApi */ @Disabled -public class RequiredAndNullableApiTest { +public class NbleApiTest { - private final RequiredAndNullableApi api = new RequiredAndNullableApi(); + private final NbleApi api = new NbleApi(); /** @@ -38,9 +39,22 @@ public class RequiredAndNullableApiTest { * */ @Test - public void requiredAndNullablePostTest() { + public void nbleGetTest() { + String filter = null; + api.nbleGet(filter); + + // TODO: test validations + } + + /** + * + * + * + */ + @Test + public void nblePostTest() { RequiredAndNullable requiredAndNullable = null; - RequiredAndNullable response = api.requiredAndNullablePost(requiredAndNullable); + RequiredAndNullable response = api.nblePost(requiredAndNullable); // TODO: test validations } 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 61311fa8a555..55c8459480ef 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 @@ -9,8 +9,8 @@ docs/FileApi.md docs/FileContent.md docs/Foo.md docs/FooApi.md +docs/NbleApi.md docs/RequiredAndNullable.md -docs/RequiredAndNullableApi.md docs/UploadApi.md git_push.sh gradle.properties @@ -31,7 +31,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/NbleApi.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 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 07deaf823718..89826fad3979 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md @@ -117,8 +117,8 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *FileApi* | [**fileIdGet**](docs/FileApi.md#fileIdGet) | **GET** /file/{id} | *FooApi* | [**fooDtParamGet**](docs/FooApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | -*RequiredAndNullableApi* | [**requiredAndNullableGet**](docs/RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | -*RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | +*NbleApi* | [**nbleGet**](docs/NbleApi.md#nbleGet) | **GET** /nble | +*NbleApi* | [**nblePost**](docs/NbleApi.md#nblePost) | **POST** /nble | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | 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 a1e9afebc747..9c5f4e7cdb47 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 @@ -61,22 +61,30 @@ paths: - foo x-accepts: - application/json - /requiredAndNullable: + /nble: get: parameters: - explode: true in: query - name: filter + name: optional required: false schema: nullable: true type: string style: form + - explode: true + in: query + name: mandatory + required: true + schema: + nullable: true + type: string + style: form responses: default: description: OK tags: - - requiredAndNullable + - nble x-accepts: - application/json post: @@ -95,7 +103,7 @@ paths: $ref: "#/components/schemas/RequiredAndNullable" description: response tags: - - requiredAndNullable + - nble x-content-type: application/json x-accepts: - application/json diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/NbleApi.md similarity index 70% rename from samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md rename to samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/NbleApi.md index 3873b33f25ad..0ad469cec5e2 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/RequiredAndNullableApi.md +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/NbleApi.md @@ -1,17 +1,17 @@ -# RequiredAndNullableApi +# NbleApi All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| -| [**requiredAndNullableGet**](RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | | -| [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | +| [**nbleGet**](NbleApi.md#nbleGet) | **GET** /nble | | +| [**nblePost**](NbleApi.md#nblePost) | **POST** /nble | | -## requiredAndNullableGet +## nbleGet -> requiredAndNullableGet(filter) +> nbleGet(mandatory, optional) @@ -23,19 +23,20 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); - String filter = "filter_example"; // String | + NbleApi apiInstance = new NbleApi(defaultClient); + String mandatory = "mandatory_example"; // String | + String optional = "optional_example"; // String | try { - apiInstance.requiredAndNullableGet(filter); + apiInstance.nbleGet(mandatory, optional); } catch (ApiException e) { - System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + System.err.println("Exception when calling NbleApi#nbleGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -50,7 +51,8 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **filter** | **String**| | [optional] | +| **mandatory** | **String**| | | +| **optional** | **String**| | [optional] | ### Return type @@ -72,9 +74,9 @@ No authorization required | **0** | OK | - | -## requiredAndNullablePost +## nblePost -> RequiredAndNullable requiredAndNullablePost(requiredAndNullable) +> RequiredAndNullable nblePost(requiredAndNullable) @@ -86,20 +88,20 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + NbleApi apiInstance = new NbleApi(defaultClient); RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes try { - RequiredAndNullable result = apiInstance.requiredAndNullablePost(requiredAndNullable); + RequiredAndNullable result = apiInstance.nblePost(requiredAndNullable); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullablePost"); + System.err.println("Exception when calling NbleApi#nblePost"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); 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/NbleApi.java similarity index 76% rename from samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java rename to samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/NbleApi.java index f2657d5cf390..a5d4b4766760 100644 --- 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/NbleApi.java @@ -28,13 +28,13 @@ import org.springframework.http.ResponseEntity; @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.26.0-SNAPSHOT") -public class RequiredAndNullableApi extends BaseApi { +public class NbleApi extends BaseApi { - public RequiredAndNullableApi() { + public NbleApi() { super(new ApiClient()); } - public RequiredAndNullableApi(ApiClient apiClient) { + public NbleApi(ApiClient apiClient) { super(apiClient); } @@ -42,31 +42,39 @@ public RequiredAndNullableApi(ApiClient apiClient) { * * *

0 - OK - * @param filter (optional) + * @param mandatory (required) + * @param optional (optional) * @throws RestClientException if an error occurs while attempting to invoke the API */ - public void requiredAndNullableGet(String filter) throws RestClientException { - requiredAndNullableGetWithHttpInfo(filter); + public void nbleGet(String mandatory, String optional) throws RestClientException { + nbleGetWithHttpInfo(mandatory, optional); } /** * * *

0 - OK - * @param filter (optional) + * @param mandatory (required) + * @param optional (optional) * @return ResponseEntity<Void> * @throws RestClientException if an error occurs while attempting to invoke the API */ - public ResponseEntity requiredAndNullableGetWithHttpInfo(String filter) throws RestClientException { + public ResponseEntity nbleGetWithHttpInfo(String mandatory, String optional) throws RestClientException { Object localVarPostBody = null; + // verify the required parameter 'mandatory' is set + if (mandatory == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'mandatory' when calling nbleGet"); + } + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); final HttpHeaders localVarHeaderParams = new HttpHeaders(); final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); - localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "filter", filter)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "optional", optional)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "mandatory", mandatory)); final String[] localVarAccepts = { }; @@ -77,7 +85,7 @@ public ResponseEntity requiredAndNullableGetWithHttpInfo(String filter) th String[] localVarAuthNames = new String[] { }; ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; - return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.GET, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); + return apiClient.invokeAPI("/nble", HttpMethod.GET, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); } /** * @@ -87,8 +95,8 @@ public ResponseEntity requiredAndNullableGetWithHttpInfo(String filter) th * @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(); + public RequiredAndNullable nblePost(RequiredAndNullable requiredAndNullable) throws RestClientException { + return nblePostWithHttpInfo(requiredAndNullable).getBody(); } /** @@ -99,12 +107,12 @@ public RequiredAndNullable requiredAndNullablePost(RequiredAndNullable requiredA * @return ResponseEntity<RequiredAndNullable> * @throws RestClientException if an error occurs while attempting to invoke the API */ - public ResponseEntity requiredAndNullablePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws RestClientException { + public ResponseEntity nblePostWithHttpInfo(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"); + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'requiredAndNullable' when calling nblePost"); } @@ -125,7 +133,7 @@ public ResponseEntity requiredAndNullablePostWithHttpInfo(R 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); + return apiClient.invokeAPI("/nble", HttpMethod.POST, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); } @Override 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/NbleApiTest.java similarity index 65% rename from samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java rename to samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/NbleApiTest.java index e082ae37e368..81b1d1d267c2 100644 --- 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/NbleApiTest.java @@ -13,6 +13,7 @@ package org.openapitools.client.api; +import org.jspecify.annotations.Nullable; import org.openapitools.client.model.RequiredAndNullable; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -26,12 +27,12 @@ import java.util.Map; /** - * API tests for RequiredAndNullableApi + * API tests for NbleApi */ @Disabled -class RequiredAndNullableApiTest { +class NbleApiTest { - private final RequiredAndNullableApi api = new RequiredAndNullableApi(); + private final NbleApi api = new NbleApi(); /** @@ -43,10 +44,27 @@ class RequiredAndNullableApiTest { * if the Api call fails */ @Test - void requiredAndNullablePostTest() { + void nbleGetTest() { + String filter = null; + + api.nbleGet(filter); + + // TODO: test validations + } + + /** + * + * + * + * + * @throws RestClientException + * if the Api call fails + */ + @Test + void nblePostTest() { RequiredAndNullable requiredAndNullable = null; - RequiredAndNullable response = api.requiredAndNullablePost(requiredAndNullable); + RequiredAndNullable response = api.nblePost(requiredAndNullable); // TODO: test validations } 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 821db0873c19..064925b4dd06 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 @@ -9,8 +9,8 @@ docs/FileApi.md docs/FileContent.md docs/Foo.md docs/FooApi.md +docs/NbleApi.md docs/RequiredAndNullable.md -docs/RequiredAndNullableApi.md docs/UploadApi.md git_push.sh gradle.properties @@ -32,7 +32,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/NbleApi.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 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 8c468d3df02d..9d61aa0efc87 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md @@ -117,8 +117,8 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *FileApi* | [**fileIdGet**](docs/FileApi.md#fileIdGet) | **GET** /file/{id} | *FooApi* | [**fooDtParamGet**](docs/FooApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | -*RequiredAndNullableApi* | [**requiredAndNullableGet**](docs/RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | -*RequiredAndNullableApi* | [**requiredAndNullablePost**](docs/RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | +*NbleApi* | [**nbleGet**](docs/NbleApi.md#nbleGet) | **GET** /nble | +*NbleApi* | [**nblePost**](docs/NbleApi.md#nblePost) | **POST** /nble | *UploadApi* | [**uploadFilesPost**](docs/UploadApi.md#uploadFilesPost) | **POST** /uploadFiles | *UploadApi* | [**uploadPost**](docs/UploadApi.md#uploadPost) | **POST** /upload | 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 a1e9afebc747..9c5f4e7cdb47 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 @@ -61,22 +61,30 @@ paths: - foo x-accepts: - application/json - /requiredAndNullable: + /nble: get: parameters: - explode: true in: query - name: filter + name: optional required: false schema: nullable: true type: string style: form + - explode: true + in: query + name: mandatory + required: true + schema: + nullable: true + type: string + style: form responses: default: description: OK tags: - - requiredAndNullable + - nble x-accepts: - application/json post: @@ -95,7 +103,7 @@ paths: $ref: "#/components/schemas/RequiredAndNullable" description: response tags: - - requiredAndNullable + - nble x-content-type: application/json x-accepts: - application/json diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullableApi.md b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/NbleApi.md similarity index 70% rename from samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullableApi.md rename to samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/NbleApi.md index 3873b33f25ad..0ad469cec5e2 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/docs/RequiredAndNullableApi.md +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/NbleApi.md @@ -1,17 +1,17 @@ -# RequiredAndNullableApi +# NbleApi All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| -| [**requiredAndNullableGet**](RequiredAndNullableApi.md#requiredAndNullableGet) | **GET** /requiredAndNullable | | -| [**requiredAndNullablePost**](RequiredAndNullableApi.md#requiredAndNullablePost) | **POST** /requiredAndNullable | | +| [**nbleGet**](NbleApi.md#nbleGet) | **GET** /nble | | +| [**nblePost**](NbleApi.md#nblePost) | **POST** /nble | | -## requiredAndNullableGet +## nbleGet -> requiredAndNullableGet(filter) +> nbleGet(mandatory, optional) @@ -23,19 +23,20 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); - String filter = "filter_example"; // String | + NbleApi apiInstance = new NbleApi(defaultClient); + String mandatory = "mandatory_example"; // String | + String optional = "optional_example"; // String | try { - apiInstance.requiredAndNullableGet(filter); + apiInstance.nbleGet(mandatory, optional); } catch (ApiException e) { - System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullableGet"); + System.err.println("Exception when calling NbleApi#nbleGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -50,7 +51,8 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **filter** | **String**| | [optional] | +| **mandatory** | **String**| | | +| **optional** | **String**| | [optional] | ### Return type @@ -72,9 +74,9 @@ No authorization required | **0** | OK | - | -## requiredAndNullablePost +## nblePost -> RequiredAndNullable requiredAndNullablePost(requiredAndNullable) +> RequiredAndNullable nblePost(requiredAndNullable) @@ -86,20 +88,20 @@ 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; +import org.openapitools.client.api.NbleApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://localhost"); - RequiredAndNullableApi apiInstance = new RequiredAndNullableApi(defaultClient); + NbleApi apiInstance = new NbleApi(defaultClient); RequiredAndNullable requiredAndNullable = new RequiredAndNullable(); // RequiredAndNullable | bodyWithRequiredAndNullableAttributes try { - RequiredAndNullable result = apiInstance.requiredAndNullablePost(requiredAndNullable); + RequiredAndNullable result = apiInstance.nblePost(requiredAndNullable); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling RequiredAndNullableApi#requiredAndNullablePost"); + System.err.println("Exception when calling NbleApi#nblePost"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/NbleApi.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/NbleApi.java new file mode 100644 index 000000000000..874a34bc970a --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/NbleApi.java @@ -0,0 +1,298 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; + +import org.jspecify.annotations.Nullable; +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.26.0-SNAPSHOT") +public class NbleApi { + private ApiClient apiClient; + + public NbleApi() { + this(new ApiClient()); + } + + public NbleApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public class NbleGetRequest { + private @Nullable String mandatory; + private @Nullable String optional; + + public NbleGetRequest() {} + + public NbleGetRequest(@Nullable String mandatory, @Nullable String optional) { + this.mandatory = mandatory; + this.optional = optional; + } + + public @Nullable String mandatory() { + return this.mandatory; + } + public NbleGetRequest mandatory(@Nullable String mandatory) { + this.mandatory = mandatory; + return this; + } + + public @Nullable String optional() { + return this.optional; + } + public NbleGetRequest optional(@Nullable String optional) { + this.optional = optional; + return this; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NbleGetRequest request = (NbleGetRequest) o; + return Objects.equals(this.mandatory, request.mandatory()) && + Objects.equals(this.optional, request.optional()); + } + + @Override + public int hashCode() { + return Objects.hash(mandatory, optional); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NbleGetRequest {\n"); + sb.append(" mandatory: ").append(toIndentedString(mandatory)).append("\n"); + sb.append(" optional: ").append(toIndentedString(optional)).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 "); + } + } + + /** + * + * + *

0 - OK + * @param requestParameters The nbleGet request parameters as object + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono nbleGet(NbleGetRequest requestParameters) throws WebClientResponseException { + return this.nbleGet(requestParameters.mandatory(), requestParameters.optional()); + } + + /** + * + * + *

0 - OK + * @param requestParameters The nbleGet request parameters as object + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> nbleGetWithHttpInfo(NbleGetRequest requestParameters) throws WebClientResponseException { + return this.nbleGetWithHttpInfo(requestParameters.mandatory(), requestParameters.optional()); + } + + /** + * + * + *

0 - OK + * @param requestParameters The nbleGet request parameters as object + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec nbleGetWithResponseSpec(NbleGetRequest requestParameters) throws WebClientResponseException { + return this.nbleGetWithResponseSpec(requestParameters.mandatory(), requestParameters.optional()); + } + + + /** + * + * + *

0 - OK + * @param mandatory The mandatory parameter + * @param optional The optional parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec nbleGetRequestCreation(@Nullable String mandatory, @Nullable String optional) throws WebClientResponseException { + Object postBody = null; + // verify the required parameter 'mandatory' is set + if (mandatory == null) { + throw new WebClientResponseException("Missing the required parameter 'mandatory' when calling nbleGet", 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(); + + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "optional", optional)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "mandatory", mandatory)); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/nble", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param mandatory The mandatory parameter + * @param optional The optional parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono nbleGet(@Nullable String mandatory, @Nullable String optional) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return nbleGetRequestCreation(mandatory, optional).bodyToMono(localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param mandatory The mandatory parameter + * @param optional The optional parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> nbleGetWithHttpInfo(@Nullable String mandatory, @Nullable String optional) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return nbleGetRequestCreation(mandatory, optional).toEntity(localVarReturnType); + } + + /** + * + * + *

0 - OK + * @param mandatory The mandatory parameter + * @param optional The optional parameter + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec nbleGetWithResponseSpec(@Nullable String mandatory, @Nullable String optional) throws WebClientResponseException { + return nbleGetRequestCreation(mandatory, optional); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return RequiredAndNullable + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec nblePostRequestCreation(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 nblePost", 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("/nble", 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 nblePost(RequiredAndNullable requiredAndNullable) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return nblePostRequestCreation(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> nblePostWithHttpInfo(RequiredAndNullable requiredAndNullable) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return nblePostRequestCreation(requiredAndNullable).toEntity(localVarReturnType); + } + + /** + * + * + *

0 - response + * @param requiredAndNullable bodyWithRequiredAndNullableAttributes + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec nblePostWithResponseSpec(RequiredAndNullable requiredAndNullable) throws WebClientResponseException { + return nblePostRequestCreation(requiredAndNullable); + } +} 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 deleted file mode 100644 index 162b7fc60f19..000000000000 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/RequiredAndNullableApi.java +++ /dev/null @@ -1,190 +0,0 @@ -package org.openapitools.client.api; - -import org.openapitools.client.ApiClient; - -import org.jspecify.annotations.Nullable; -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.26.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 - OK - * @param filter The filter parameter - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - private ResponseSpec requiredAndNullableGetRequestCreation(@Nullable String filter) throws WebClientResponseException { - Object postBody = 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(); - - localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "filter", filter)); - - final String[] localVarAccepts = { }; - final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { }; - final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { }; - - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return apiClient.invokeAPI("/requiredAndNullable", HttpMethod.GET, pathParams, localVarQueryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - } - - /** - * - * - *

0 - OK - * @param filter The filter parameter - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public Mono requiredAndNullableGet(@Nullable String filter) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return requiredAndNullableGetRequestCreation(filter).bodyToMono(localVarReturnType); - } - - /** - * - * - *

0 - OK - * @param filter The filter parameter - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public Mono> requiredAndNullableGetWithHttpInfo(@Nullable String filter) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return requiredAndNullableGetRequestCreation(filter).toEntity(localVarReturnType); - } - - /** - * - * - *

0 - OK - * @param filter The filter parameter - * @return ResponseSpec - * @throws WebClientResponseException if an error occurs while attempting to invoke the API - */ - public ResponseSpec requiredAndNullableGetWithResponseSpec(@Nullable String filter) throws WebClientResponseException { - return requiredAndNullableGetRequestCreation(filter); - } - - /** - * - * - *

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/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/NbleApiTest.java similarity index 62% rename from samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/RequiredAndNullableApiTest.java rename to samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/NbleApiTest.java index 5adf56d29694..0870a4bbbe86 100644 --- 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/NbleApiTest.java @@ -13,6 +13,7 @@ package org.openapitools.client.api; +import org.jspecify.annotations.Nullable; import org.openapitools.client.model.RequiredAndNullable; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; @@ -25,12 +26,12 @@ import java.util.stream.Collectors; /** - * API tests for RequiredAndNullableApi + * API tests for NbleApi */ @Disabled -public class RequiredAndNullableApiTest { +public class NbleApiTest { - private final RequiredAndNullableApi api = new RequiredAndNullableApi(); + private final NbleApi api = new NbleApi(); /** @@ -39,10 +40,24 @@ public class RequiredAndNullableApiTest { * */ @Test - public void requiredAndNullablePostTest() { + public void nbleGetTest() { + // uncomment below to test the function + //String filter = null; + //api.nbleGet(filter).block(); + + // TODO: test validations + } + + /** + * + * + * + */ + @Test + public void nblePostTest() { // uncomment below to test the function //RequiredAndNullable requiredAndNullable = null; - //RequiredAndNullable response = api.requiredAndNullablePost(requiredAndNullable).block(); + //RequiredAndNullable response = api.nblePost(requiredAndNullable).block(); // TODO: test validations } 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 559ef9c95db3..d816f87fd6ee 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,7 +3,7 @@ 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/NbleApi.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 diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/Main.java b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/Main.java new file mode 100644 index 000000000000..8a997839440e --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/Main.java @@ -0,0 +1,27 @@ +package org.openapitools; + +import org.openapitools.api.RequiredAndNullableApi; +import org.openapitools.model.RequiredAndNullable; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RestController; + +@SpringBootApplication +public class Main { + public static void main(String[] args) { + new RequiredAndNullable()._list(null).addListItem("test"); + //SpringApplication.run(Main.class, args); + } + + + + @RestController + public static class MyRestController implements RequiredAndNullableApi { + @Override + public ResponseEntity requiredAndNullablePost(RequiredAndNullable requiredAndNullable) { + return RequiredAndNullableApi.super.requiredAndNullablePost(requiredAndNullable); + } + } +} 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/NbleApi.java similarity index 78% rename from samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/RequiredAndNullableApi.java rename to samples/openapi3/server/petstore/springboot-4-jspecify-openapiNullable/src/main/java/org/openapitools/api/NbleApi.java index decc24fc5304..35bce9b81b21 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/NbleApi.java @@ -36,49 +36,51 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.26.0-SNAPSHOT") @Validated -@Tag(name = "requiredAndNullable", description = "requiredAndNullable") -public interface RequiredAndNullableApi { +@Tag(name = "nble", description = "the nble API") +public interface NbleApi { default Optional getRequest() { return Optional.empty(); } - String PATH_REQUIRED_AND_NULLABLE_GET = "/requiredAndNullable"; + String PATH_NBLE_GET = "/nble"; /** - * GET /requiredAndNullable + * GET /nble * - * @param filter (optional) + * @param mandatory (required) + * @param optional (optional) * @return OK (status code 200) */ @Operation( - operationId = "requiredAndNullableGet", - tags = { "requiredAndNullable" }, + operationId = "nbleGet", + tags = { "nble" }, responses = { @ApiResponse(responseCode = "default", description = "OK") } ) @RequestMapping( method = RequestMethod.GET, - value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_GET + value = NbleApi.PATH_NBLE_GET ) - default ResponseEntity requiredAndNullableGet( - @Parameter(name = "filter", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "filter", required = false) String filter + default ResponseEntity nbleGet( + @NotNull @Parameter(name = "mandatory", description = "", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "mandatory", required = true) String mandatory, + @Parameter(name = "optional", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "optional", required = false) String optional ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } - String PATH_REQUIRED_AND_NULLABLE_POST = "/requiredAndNullable"; + String PATH_NBLE_POST = "/nble"; /** - * POST /requiredAndNullable + * POST /nble * * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) * @return response (status code 200) */ @Operation( - operationId = "requiredAndNullablePost", - tags = { "requiredAndNullable" }, + operationId = "nblePost", + tags = { "nble" }, responses = { @ApiResponse(responseCode = "default", description = "response", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = RequiredAndNullable.class)) @@ -87,11 +89,11 @@ default ResponseEntity requiredAndNullableGet( ) @RequestMapping( method = RequestMethod.POST, - value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_POST, + value = NbleApi.PATH_NBLE_POST, produces = { "application/json" }, consumes = { "application/json" } ) - default ResponseEntity requiredAndNullablePost( + default ResponseEntity nblePost( @Parameter(name = "RequiredAndNullable", description = "bodyWithRequiredAndNullableAttributes", required = true) @Valid @RequestBody RequiredAndNullable requiredAndNullable ) { getRequest().ifPresent(request -> { 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 559ef9c95db3..d816f87fd6ee 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,7 +3,7 @@ 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/NbleApi.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 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/NbleApi.java similarity index 78% rename from samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/RequiredAndNullableApi.java rename to samples/openapi3/server/petstore/springboot-4-jspecify-useOptional/src/main/java/org/openapitools/api/NbleApi.java index 1d55f60c1545..e53d704b4f65 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/NbleApi.java @@ -36,49 +36,51 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.26.0-SNAPSHOT") @Validated -@Tag(name = "requiredAndNullable", description = "requiredAndNullable") -public interface RequiredAndNullableApi { +@Tag(name = "nble", description = "the nble API") +public interface NbleApi { default Optional getRequest() { return Optional.empty(); } - String PATH_REQUIRED_AND_NULLABLE_GET = "/requiredAndNullable"; + String PATH_NBLE_GET = "/nble"; /** - * GET /requiredAndNullable + * GET /nble * - * @param filter (optional) + * @param mandatory (required) + * @param optional (optional) * @return OK (status code 200) */ @Operation( - operationId = "requiredAndNullableGet", - tags = { "requiredAndNullable" }, + operationId = "nbleGet", + tags = { "nble" }, responses = { @ApiResponse(responseCode = "default", description = "OK") } ) @RequestMapping( method = RequestMethod.GET, - value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_GET + value = NbleApi.PATH_NBLE_GET ) - default ResponseEntity requiredAndNullableGet( - @Parameter(name = "filter", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "filter", required = false) Optional filter + default ResponseEntity nbleGet( + @NotNull @Parameter(name = "mandatory", description = "", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "mandatory", required = true) String mandatory, + @Parameter(name = "optional", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "optional", required = false) Optional optional ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } - String PATH_REQUIRED_AND_NULLABLE_POST = "/requiredAndNullable"; + String PATH_NBLE_POST = "/nble"; /** - * POST /requiredAndNullable + * POST /nble * * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) * @return response (status code 200) */ @Operation( - operationId = "requiredAndNullablePost", - tags = { "requiredAndNullable" }, + operationId = "nblePost", + tags = { "nble" }, responses = { @ApiResponse(responseCode = "default", description = "response", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = RequiredAndNullable.class)) @@ -87,11 +89,11 @@ default ResponseEntity requiredAndNullableGet( ) @RequestMapping( method = RequestMethod.POST, - value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_POST, + value = NbleApi.PATH_NBLE_POST, produces = { "application/json" }, consumes = { "application/json" } ) - default ResponseEntity requiredAndNullablePost( + default ResponseEntity nblePost( @Parameter(name = "RequiredAndNullable", description = "bodyWithRequiredAndNullableAttributes", required = true) @Valid @RequestBody RequiredAndNullable requiredAndNullable ) { getRequest().ifPresent(request -> { 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 559ef9c95db3..d816f87fd6ee 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES @@ -3,7 +3,7 @@ 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/NbleApi.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 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/NbleApi.java similarity index 78% rename from samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/RequiredAndNullableApi.java rename to samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/NbleApi.java index 5961cbd5acc2..3fc50134050e 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/NbleApi.java @@ -36,49 +36,51 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.26.0-SNAPSHOT") @Validated -@Tag(name = "requiredAndNullable", description = "requiredAndNullable") -public interface RequiredAndNullableApi { +@Tag(name = "nble", description = "the nble API") +public interface NbleApi { default Optional getRequest() { return Optional.empty(); } - String PATH_REQUIRED_AND_NULLABLE_GET = "/requiredAndNullable"; + String PATH_NBLE_GET = "/nble"; /** - * GET /requiredAndNullable + * GET /nble * - * @param filter (optional) + * @param mandatory (required) + * @param optional (optional) * @return OK (status code 200) */ @Operation( - operationId = "requiredAndNullableGet", - tags = { "requiredAndNullable" }, + operationId = "nbleGet", + tags = { "nble" }, responses = { @ApiResponse(responseCode = "default", description = "OK") } ) @RequestMapping( method = RequestMethod.GET, - value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_GET + value = NbleApi.PATH_NBLE_GET ) - default ResponseEntity requiredAndNullableGet( - @Parameter(name = "filter", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "filter", required = false) @Nullable String filter + default ResponseEntity nbleGet( + @NotNull @Parameter(name = "mandatory", description = "", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "mandatory", required = true) String mandatory, + @Parameter(name = "optional", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "optional", required = false) @Nullable String optional ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } - String PATH_REQUIRED_AND_NULLABLE_POST = "/requiredAndNullable"; + String PATH_NBLE_POST = "/nble"; /** - * POST /requiredAndNullable + * POST /nble * * @param requiredAndNullable bodyWithRequiredAndNullableAttributes (required) * @return response (status code 200) */ @Operation( - operationId = "requiredAndNullablePost", - tags = { "requiredAndNullable" }, + operationId = "nblePost", + tags = { "nble" }, responses = { @ApiResponse(responseCode = "default", description = "response", content = { @Content(mediaType = "application/json", schema = @Schema(implementation = RequiredAndNullable.class)) @@ -87,11 +89,11 @@ default ResponseEntity requiredAndNullableGet( ) @RequestMapping( method = RequestMethod.POST, - value = RequiredAndNullableApi.PATH_REQUIRED_AND_NULLABLE_POST, + value = NbleApi.PATH_NBLE_POST, produces = { "application/json" }, consumes = { "application/json" } ) - default ResponseEntity requiredAndNullablePost( + default ResponseEntity nblePost( @Parameter(name = "RequiredAndNullable", description = "bodyWithRequiredAndNullableAttributes", required = true) @Valid @RequestBody RequiredAndNullable requiredAndNullable ) { getRequest().ifPresent(request -> {