From 59bd0ebfbbc38fb49ea47e80db25d38ec5feb4fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Mon, 9 Feb 2026 22:43:55 +0100 Subject: [PATCH 01/28] convert byte[] to String for operation params --- .../languages/AbstractJavaCodegen.java | 1 + .../codegen/languages/SpringCodegen.java | 21 +++++++++++++++++++ .../JavaSpring/cookieParams.mustache | 2 +- .../resources/JavaSpring/formParams.mustache | 2 +- .../JavaSpring/headerParams.mustache | 2 +- .../resources/JavaSpring/pathParams.mustache | 2 +- .../resources/JavaSpring/queryParams.mustache | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../org/openapitools/api/FakeApiDelegate.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../org/openapitools/api/FakeApiDelegate.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../org/openapitools/api/FakeApiDelegate.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../org/openapitools/api/FakeApiDelegate.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../org/openapitools/api/FakeApiDelegate.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../org/openapitools/api/FakeApiDelegate.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../org/openapitools/api/FakeApiDelegate.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../openapitools/virtualan/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- 38 files changed, 58 insertions(+), 36 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index d1b89584670b..462b7619886d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -290,6 +290,7 @@ public AbstractJavaCodegen() { typeMapping.put("date", "Date"); typeMapping.put("file", "File"); typeMapping.put("AnyType", "Object"); + typeMapping.put("ByteArray", "byte[]"); importMapping.put("BigDecimal", "java.math.BigDecimal"); importMapping.put("UUID", "java.util.UUID"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index 2c3c584e931a..90160d2dc5eb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -798,6 +798,7 @@ public void setIsVoid(boolean isVoid) { prepareVersioningParameters(ops); handleImplicitHeaders(operation); + convertByteArrayParamsToStringType(operation); } // The tag for the controller is the first tag of the first operation final CodegenOperation firstOperation = ops.get(0); @@ -813,6 +814,26 @@ public void setIsVoid(boolean isVoid) { return objs; } + /** + * Converts parameters of type {@code byte[]} (i.e., OpenAPI {@code type: string, format: byte}) to {@code String}. + *

+ * In OpenAPI, {@code type: string, format: byte} is a base64-encoded string. However, Spring does not automatically + * decode base64-encoded request parameters into {@code byte[]} for query, path, header, cookie, or form parameters. + * Therefore, these parameters are mapped to {@code String} to avoid incorrect type handling and to ensure the + * application receives the raw base64 string as provided by the client. + *

+ * + * @param operation the codegen operation whose parameters will be checked and converted if necessary + **/ + private void convertByteArrayParamsToStringType(CodegenOperation operation) { + var convertedParams = operation.allParams.stream() + .filter(CodegenParameter::getIsByteArray) + .filter(param -> param.isQueryParam || param.isPathParam || param.isHeaderParam || param.isCookieParam || param.isFormParam) + .peek(param -> param.dataType = "String") + .collect(Collectors.toList()); + LOGGER.info("Converted parameters {} from byte[] to String in operation {}", convertedParams.stream().map(param -> param.paramName), operation.operationId); + } + private interface DataTypeAssigner { void setReturnType(String returnType); diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/cookieParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/cookieParams.mustache index a255b5c7daf2..ef9ffa8efada 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}}{{>optionalDataType}} {{paramName}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{/isCookieParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache index eaa958fc42c6..db050c7830cc 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}@RequestPart{{/isArray}}{{^isArray}}{{#reactive}}@RequestPart{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{{dataType}}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}@RequestPart{{/isArray}}{{^isArray}}{{#reactive}}@RequestPart{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{{dataType}}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} \ 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..7de918c2203f 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}}{{>optionalDataType}} {{paramName}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{/isHeaderParam}} \ 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 24ebb856a153..184ff7793f2f 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}} {{>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}} {{>optionalDataType}} {{paramName}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{/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..06ce33ffc58a 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}}{{>optionalDataType}} {{paramName}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{/isQueryParam}} \ No newline at end of file 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 bea5db699e3f..3bf17985d294 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 @@ -216,7 +216,7 @@ void testEndpointParameters( @RequestParam(value = "number", required = true) BigDecimal number, @RequestParam(value = "double", required = true) Double _double, @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @RequestParam(value = "byte", required = true) byte[] _byte, + @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @RequestParam(value = "integer", required = false) Integer integer, @RequestParam(value = "int32", required = false) Integer int32, @RequestParam(value = "int64", required = false) Long int64, 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 04a9124859d4..01dadd17b2f3 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 @@ -220,7 +220,7 @@ Mono testEndpointParameters( @RequestPart(value = "number", required = true) BigDecimal number, @RequestPart(value = "double", required = true) Double _double, @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @RequestPart(value = "byte", required = true) byte[] _byte, + @RequestPart(value = "byte", required = true) String _byte /* base64 encoded binary */, @RequestPart(value = "integer", required = false) Integer integer, @RequestPart(value = "int32", required = false) Integer int32, @RequestPart(value = "int64", required = false) Long int64, 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 0fefc031ea6d..64340c50a182 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 @@ -211,7 +211,7 @@ Mono> testEndpointParameters( @RequestPart(value = "number", required = true) BigDecimal number, @RequestPart(value = "double", required = true) Double _double, @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @RequestPart(value = "byte", required = true) byte[] _byte, + @RequestPart(value = "byte", required = true) String _byte /* base64 encoded binary */, @RequestPart(value = "integer", required = false) Integer integer, @RequestPart(value = "int32", required = false) Integer int32, @RequestPart(value = "int64", required = false) Long int64, 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 fc8aa14fdf11..c5b0f02028f4 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 @@ -207,7 +207,7 @@ ResponseEntity testEndpointParameters( @RequestParam(value = "number", required = true) BigDecimal number, @RequestParam(value = "double", required = true) Double _double, @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @RequestParam(value = "byte", required = true) byte[] _byte, + @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @RequestParam(value = "integer", required = false) Integer integer, @RequestParam(value = "int32", required = false) Integer int32, @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java index 2b5414dd0e62..2440174d36c8 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java @@ -315,7 +315,7 @@ ResponseEntity testEndpointParameters( @Parameter(name = "number", description = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @Parameter(name = "double", description = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @Parameter(name = "pattern_without_delimiter", description = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @Parameter(name = "integer", description = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @Parameter(name = "int32", description = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @Parameter(name = "int64", description = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java index 565ffd66dc3f..0a173336a649 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java @@ -364,7 +364,7 @@ default ResponseEntity testEndpointParameters( @Parameter(name = "number", description = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @Parameter(name = "double", description = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @Parameter(name = "pattern_without_delimiter", description = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @Parameter(name = "integer", description = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @Parameter(name = "int32", description = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @Parameter(name = "int64", description = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java index da19eea506c4..e9843810956f 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -207,7 +207,7 @@ default ResponseEntity testClientModel(Client client) { default ResponseEntity testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, - byte[] _byte, + String _byte, Integer integer, Integer int32, Long int64, diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java index af328fa7ff70..63ff33246137 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java @@ -404,7 +404,7 @@ default ResponseEntity testEndpointParameters( @Parameter(name = "number", description = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @Parameter(name = "double", description = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @Parameter(name = "pattern_without_delimiter", description = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @Parameter(name = "integer", description = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @Parameter(name = "int32", description = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @Parameter(name = "int64", description = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/api/FakeApi.java index 458409c67391..336c11e550aa 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/api/FakeApi.java @@ -343,7 +343,7 @@ ResponseEntity testEndpointParameters( @Parameter(name = "number", description = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @Parameter(name = "double", description = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @Parameter(name = "pattern_without_delimiter", description = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @Parameter(name = "integer", description = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @Parameter(name = "int32", description = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @Parameter(name = "int64", description = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java index 0ea604f8b3a9..e7ad9c81d6c0 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java @@ -396,7 +396,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java index 0ea604f8b3a9..e7ad9c81d6c0 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java @@ -396,7 +396,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java index 6a98cfc50239..ff8f738c7dbd 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java @@ -396,7 +396,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java index f6fc153c2508..a2bc246f4aa6 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java @@ -356,7 +356,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java index da19eea506c4..e9843810956f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -207,7 +207,7 @@ default ResponseEntity testClientModel(Client client) { default ResponseEntity testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, - byte[] _byte, + String _byte, Integer integer, Integer int32, Long int64, diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java index f6fc153c2508..a2bc246f4aa6 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java @@ -356,7 +356,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java index da19eea506c4..e9843810956f 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -207,7 +207,7 @@ default ResponseEntity testClientModel(Client client) { default ResponseEntity testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, - byte[] _byte, + String _byte, Integer integer, Integer int32, Long int64, diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java index c4ff183bddcf..145f5dba11c7 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java @@ -396,7 +396,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java index e41dc080532a..3ae61fbceb5c 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java @@ -380,7 +380,7 @@ default Mono testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestPart(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestPart(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestPart(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestPart(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestPart(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestPart(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java index 2037e56a08ad..84b558fba08f 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -232,7 +232,7 @@ default Mono testClientModel(Mono client, default Mono testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, - byte[] _byte, + String _byte, Integer integer, Integer int32, Long int64, diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java index 12fca957cad2..eb7cd4606012 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java @@ -370,7 +370,7 @@ default Mono> testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestPart(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestPart(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestPart(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestPart(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestPart(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestPart(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java index 4cd2a881a8a6..5a4f62ea18b9 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -233,7 +233,7 @@ default Mono> testClientModel(Mono client, default Mono> testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, - byte[] _byte, + String _byte, Integer integer, Integer int32, Long int64, diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java index fda642c0a4e4..d8c8baf81d36 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java @@ -321,7 +321,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java index 9fe8275b290f..4258bf719ee9 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -184,7 +184,7 @@ default ResponseEntity testClientModel(Client body) { default ResponseEntity testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, - byte[] _byte, + String _byte, Integer integer, Integer int32, Long int64, diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java index fda642c0a4e4..d8c8baf81d36 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java @@ -321,7 +321,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApiDelegate.java index 9fe8275b290f..4258bf719ee9 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -184,7 +184,7 @@ default ResponseEntity testClientModel(Client body) { default ResponseEntity testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, - byte[] _byte, + String _byte, Integer integer, Integer int32, Long int64, diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java index bcde37132895..3d40e76da48a 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java @@ -351,7 +351,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java index bcde37132895..3d40e76da48a 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java @@ -351,7 +351,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java index 4020a589b44a..a83dc616fcb8 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java @@ -396,7 +396,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Valid @RequestParam(value = "integer", required = false) Optional integer, @ApiParam(value = "None") @Valid @RequestParam(value = "int32", required = false) Optional int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Optional int64, diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java index e97f35fedc01..230b6e57346f 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java @@ -417,7 +417,7 @@ default ResponseEntity testEndpointParameters( @Parameter(name = "number", description = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @Parameter(name = "double", description = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @Parameter(name = "pattern_without_delimiter", description = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @Parameter(name = "byte", description = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @Parameter(name = "integer", description = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @Parameter(name = "int32", description = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @Parameter(name = "int64", description = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/api/FakeApi.java index f7d277c5047b..ae1e007efe15 100644 --- a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/api/FakeApi.java @@ -545,7 +545,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java index 6baadd22ffc9..b6e35bd7ee45 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java @@ -396,7 +396,7 @@ default ResponseEntity testEndpointParameters( @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) byte[] _byte, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, From 78499b6e4c4955eb496ebf3b324bc9ccfd4daafd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Mon, 9 Feb 2026 23:43:04 +0100 Subject: [PATCH 02/28] add unit tests --- .../java/assertions/PropertyAssert.java | 14 ++ .../java/spring/SpringCodegenTest.java | 86 +++++++++ .../3_0/spring/byte-format-edge-cases.yaml | 171 ++++++++++++++++++ 3 files changed, 271 insertions(+) create mode 100644 modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAssert.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAssert.java index e598c210a1f6..401d87fddfca 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAssert.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/assertions/PropertyAssert.java @@ -26,6 +26,20 @@ public PropertyAssert withType(final String expectedType) { return this; } + public PropertyAssert isArray() { + Assertions.assertThat(actual.getCommonType().isArrayType()) + .withFailMessage("Expected property %s to be array, but it was NOT", actual.getVariable(0).getNameAsString()) + .isEqualTo(true); + return this; + } + + public PropertyAssert isNotArray() { + Assertions.assertThat(actual.getCommonType().isArrayType()) + .withFailMessage("Expected property %s NOT to be array, but it was", actual.getVariable(0).getNameAsString()) + .isEqualTo(false); + return this; + } + public PropertyAnnotationsAssert assertPropertyAnnotations() { return new PropertyAnnotationsAssert(this, actual.getAnnotations()); } 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 ac819033d71e..66894b8e9c44 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 @@ -864,6 +864,92 @@ public void testSchemaImplements() throws IOException { .implementsInterfaces(fooInterface, fooAnotherInterface); } + + @Test + public void shouldHandleFormatByteCorrectlyForAllApiParametersAndProperties() throws IOException { + final SpringCodegen codegen = new SpringCodegen(); + + final Map files = generateFiles(codegen, "src/test/resources/3_0/spring/byte-format-edge-cases.yaml"); + // Query parameters: both plain text and Base64-encoded fields are mapped to String + JavaFileAssert.assertThat(files.get("QueryApi.java")) + .assertMethod("queryParams") + .assertParameter("plain") + .hasType("String"); // plain query param → always String + JavaFileAssert.assertThat(files.get("QueryApi.java")) + .assertMethod("queryParams") + .assertParameter("_byte") + .hasType("String"); // Base64 query param → String (manual decoding needed) + + // Path parameters: same behavior as query params + JavaFileAssert.assertThat(files.get("PathApi.java")) + .assertMethod("pathParams") + .assertParameter("plain") + .hasType("String"); // path param → String + JavaFileAssert.assertThat(files.get("PathApi.java")) + .assertMethod("pathParams") + .assertParameter("_byte") + .hasType("String"); // Base64 path param → String + + // Header parameters: always String + JavaFileAssert.assertThat(files.get("HeaderApi.java")) + .assertMethod("headerParams") + .assertParameter("xPlain") + .hasType("String"); // header → String + JavaFileAssert.assertThat(files.get("HeaderApi.java")) + .assertMethod("headerParams") + .assertParameter("xByte") + .hasType("String"); // Base64 header → String + + // Cookie parameters: always String + JavaFileAssert.assertThat(files.get("CookieApi.java")) + .assertMethod("cookieParams") + .assertParameter("plain") + .hasType("String"); // cookie → String + JavaFileAssert.assertThat(files.get("CookieApi.java")) + .assertMethod("cookieParams") + .assertParameter("_byte") + .hasType("String"); // Base64 cookie → String + + // Form fields: text fields → String + JavaFileAssert.assertThat(files.get("FormApi.java")) + .assertMethod("formParams") + .assertParameter("plain") + .hasType("String"); // form field → String + JavaFileAssert.assertThat(files.get("FormApi.java")) + .assertMethod("formParams") + .assertParameter("_byte") + .hasType("String"); // Base64 form field → String + + // Multipart fields: text fields → String, files → MultipartFile + JavaFileAssert.assertThat(files.get("MultipartApi.java")) + .assertMethod("multipartParams") + .assertParameter("plain") + .hasType("String"); // multipart text field → String + JavaFileAssert.assertThat(files.get("MultipartApi.java")) + .assertMethod("multipartParams") + .assertParameter("_byte") + .hasType("String"); // Base64 multipart text → String + JavaFileAssert.assertThat(files.get("MultipartApi.java")) + .assertMethod("multipartParams") + .assertParameter("file") + .hasType("MultipartFile"); // binary file upload → MultipartFile + + // Form request DTO: JSON or form object mapping + JavaFileAssert.assertThat(files.get("FormParamsRequest.java")) + .assertProperty("plain") + .withType("String"); // text property → String + JavaFileAssert.assertThat(files.get("FormParamsRequest.java")) + .assertProperty("_byte") + .isArray() + .withType("byte"); // Base64 property in DTO → auto-decoded to byte[] + + // Binary request body: bound as Resource for streaming + JavaFileAssert.assertThat(files.get("BinaryBodyApi.java")) + .assertMethod("binaryBody") + .assertParameter("body") + .hasType("org.springframework.core.io.Resource"); // raw binary body → Resource (streamable) + } + @Test public void shouldAddParameterWithInHeaderWhenImplicitHeadersIsTrue_issue14418() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml new file mode 100644 index 000000000000..bf6971217ff7 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml @@ -0,0 +1,171 @@ +openapi: 3.0.3 +info: + title: Byte Format Edge Cases + version: 1.0.0 + +paths: + /queryfdsfsd: + get: + operationId: queryParamsfdsfsfdsfs + summary: Query parametersfsdaf + parameters: + - name: plain + in: query + schema: + type: string + + responses: + '204': + description: No content + + /query: + get: + operationId: queryParams + summary: Query parameters + parameters: + - name: plain + in: query + schema: + type: string + - name: byte + in: query + schema: + type: string + format: byte + responses: + '204': + description: No content + + /path/{plain}/{byte}: + get: + operationId: pathParams + summary: Path parameters + parameters: + - name: plain + in: path + required: true + schema: + type: string + - name: byte + in: path + required: true + schema: + type: string + format: byte + responses: + '204': + description: No content + + /header: + get: + operationId: headerParams + summary: Header parameters + parameters: + - name: X-Plain + in: header + schema: + type: string + - name: X-Byte + in: header + schema: + type: string + format: byte + responses: + '204': + description: No content + + /cookie: + get: + operationId: cookieParams + summary: Cookie parameters + parameters: + - name: plain + in: cookie + schema: + type: string + - name: byte + in: cookie + schema: + type: string + format: byte + responses: + '204': + description: No content + + /form: + post: + operationId: formParams + summary: application/x-www-form-urlencoded + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + plain: + type: string + byte: + type: string + format: byte + responses: + '204': + description: No content + + /multipart: + post: + operationId: multipartParams + summary: multipart/form-data + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + plain: + type: string + byte: + type: string + format: byte + file: + type: string + format: binary + responses: + '204': + description: No content + + /json-body: + post: + operationId: jsonBody + summary: JSON request body + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plain: + type: string + byte: + type: string + format: byte + responses: + '204': + description: No content + + /binary-body: + post: + operationId: binaryBody + summary: Raw binary body + requestBody: + required: true + content: + application/octet-stream: + schema: + type: string + format: binary + responses: + '204': + description: No content From 02a530a15a9acedf6cd2bbf8f8ed5b5f55535466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Mon, 9 Feb 2026 23:56:32 +0100 Subject: [PATCH 03/28] clean up open api spec --- .../3_0/spring/byte-format-edge-cases.yaml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml index bf6971217ff7..437458591083 100644 --- a/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml @@ -4,20 +4,6 @@ info: version: 1.0.0 paths: - /queryfdsfsd: - get: - operationId: queryParamsfdsfsfdsfs - summary: Query parametersfsdaf - parameters: - - name: plain - in: query - schema: - type: string - - responses: - '204': - description: No content - /query: get: operationId: queryParams From 8685cb99ab9f586c666a3a9072fe52cc4bd0eca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Tue, 10 Feb 2026 09:07:29 +0100 Subject: [PATCH 04/28] fix CR suggestions --- .../resources/JavaSpring/formParams.mustache | 2 +- .../java/spring/SpringCodegenTest.java | 27 ++- .../spring/KotlinSpringServerCodegenTest.java | 22 +++ .../3_0/kotlin/byte-format-edge-cases.yaml | 157 ++++++++++++++++++ .../3_0/spring/byte-format-edge-cases.yaml | 14 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 34 ++-- .../java/org/openapitools/api/PetApi.java | 8 +- .../java/org/openapitools/api/FakeApi.java | 34 ++-- .../java/org/openapitools/api/PetApi.java | 8 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 36 ++-- .../java/org/openapitools/api/PetApi.java | 6 +- .../java/org/openapitools/api/FakeApi.java | 36 ++-- .../java/org/openapitools/api/PetApi.java | 6 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../openapitools/virtualan/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- 33 files changed, 310 insertions(+), 120 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/kotlin/byte-format-edge-cases.yaml diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache index db050c7830cc..025005f11c3b 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}@RequestPart{{/isArray}}{{^isArray}}{{#reactive}}@RequestPart{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{{dataType}}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestParam{{/isModel}}{{^isModel}}{{#isArray}}@RequestParam{{/isArray}}{{^isArray}}{{#reactive}}@RequestParam{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{{dataType}}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} \ 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 66894b8e9c44..1f216196cf64 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 @@ -877,7 +877,7 @@ public void shouldHandleFormatByteCorrectlyForAllApiParametersAndProperties() th .hasType("String"); // plain query param → always String JavaFileAssert.assertThat(files.get("QueryApi.java")) .assertMethod("queryParams") - .assertParameter("_byte") + .assertParameter("bytes") .hasType("String"); // Base64 query param → String (manual decoding needed) // Path parameters: same behavior as query params @@ -887,7 +887,7 @@ public void shouldHandleFormatByteCorrectlyForAllApiParametersAndProperties() th .hasType("String"); // path param → String JavaFileAssert.assertThat(files.get("PathApi.java")) .assertMethod("pathParams") - .assertParameter("_byte") + .assertParameter("bytes") .hasType("String"); // Base64 path param → String // Header parameters: always String @@ -907,7 +907,7 @@ public void shouldHandleFormatByteCorrectlyForAllApiParametersAndProperties() th .hasType("String"); // cookie → String JavaFileAssert.assertThat(files.get("CookieApi.java")) .assertMethod("cookieParams") - .assertParameter("_byte") + .assertParameter("bytes") .hasType("String"); // Base64 cookie → String // Form fields: text fields → String @@ -917,29 +917,40 @@ public void shouldHandleFormatByteCorrectlyForAllApiParametersAndProperties() th .hasType("String"); // form field → String JavaFileAssert.assertThat(files.get("FormApi.java")) .assertMethod("formParams") - .assertParameter("_byte") + .assertParameter("bytes") .hasType("String"); // Base64 form field → String // Multipart fields: text fields → String, files → MultipartFile + // Verifies that a simple multipart text field is generated as a String parameter JavaFileAssert.assertThat(files.get("MultipartApi.java")) .assertMethod("multipartParams") .assertParameter("plain") .hasType("String"); // multipart text field → String + + // Verifies that a Base64-encoded multipart field is treated as text (String) + // and is bound using @RequestParam rather than @RequestPart JavaFileAssert.assertThat(files.get("MultipartApi.java")) .assertMethod("multipartParams") - .assertParameter("_byte") - .hasType("String"); // Base64 multipart text → String + .assertParameter("bytes") + .hasType("String") // Base64 multipart text → String + .assertParameterAnnotations() + .containsWithName("RequestParam"); + + // Verifies that a binary file upload is exposed as MultipartFile + // and correctly bound from a multipart section using @RequestPart JavaFileAssert.assertThat(files.get("MultipartApi.java")) .assertMethod("multipartParams") .assertParameter("file") - .hasType("MultipartFile"); // binary file upload → MultipartFile + .hasType("MultipartFile") // binary file upload → MultipartFile + .assertParameterAnnotations() + .containsWithName("RequestPart"); // Form request DTO: JSON or form object mapping JavaFileAssert.assertThat(files.get("FormParamsRequest.java")) .assertProperty("plain") .withType("String"); // text property → String JavaFileAssert.assertThat(files.get("FormParamsRequest.java")) - .assertProperty("_byte") + .assertProperty("bytes") .isArray() .withType("byte"); // Base64 property in DTO → auto-decoded to byte[] diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index 12d52f58de59..d74da75037f0 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -602,6 +602,28 @@ public void skipDefaultInterface() throws Exception { ); } + @Test(description = "test skip default interface") + public void skipDefaultIgfdgdnterface() throws Exception { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + String outputPath = output.getAbsolutePath().replace('\\', '/'); + + KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(KotlinSpringServerCodegen.INTERFACE_ONLY, true); + codegen.additionalProperties().put(KotlinSpringServerCodegen.SKIP_DEFAULT_INTERFACE, true); + + new DefaultGenerator().opts(new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/byte-format-edge-cases.yaml")) + .config(codegen)) + .generate(); + + assertFileNotContains( + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PingApi.kt"), + "return " + ); + } + @Test(description = "test cookie parameter generation on interface apis") public void cookieParameterGenerationApis() throws Exception { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/byte-format-edge-cases.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/byte-format-edge-cases.yaml new file mode 100644 index 000000000000..437458591083 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/byte-format-edge-cases.yaml @@ -0,0 +1,157 @@ +openapi: 3.0.3 +info: + title: Byte Format Edge Cases + version: 1.0.0 + +paths: + /query: + get: + operationId: queryParams + summary: Query parameters + parameters: + - name: plain + in: query + schema: + type: string + - name: byte + in: query + schema: + type: string + format: byte + responses: + '204': + description: No content + + /path/{plain}/{byte}: + get: + operationId: pathParams + summary: Path parameters + parameters: + - name: plain + in: path + required: true + schema: + type: string + - name: byte + in: path + required: true + schema: + type: string + format: byte + responses: + '204': + description: No content + + /header: + get: + operationId: headerParams + summary: Header parameters + parameters: + - name: X-Plain + in: header + schema: + type: string + - name: X-Byte + in: header + schema: + type: string + format: byte + responses: + '204': + description: No content + + /cookie: + get: + operationId: cookieParams + summary: Cookie parameters + parameters: + - name: plain + in: cookie + schema: + type: string + - name: byte + in: cookie + schema: + type: string + format: byte + responses: + '204': + description: No content + + /form: + post: + operationId: formParams + summary: application/x-www-form-urlencoded + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + plain: + type: string + byte: + type: string + format: byte + responses: + '204': + description: No content + + /multipart: + post: + operationId: multipartParams + summary: multipart/form-data + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + plain: + type: string + byte: + type: string + format: byte + file: + type: string + format: binary + responses: + '204': + description: No content + + /json-body: + post: + operationId: jsonBody + summary: JSON request body + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plain: + type: string + byte: + type: string + format: byte + responses: + '204': + description: No content + + /binary-body: + post: + operationId: binaryBody + summary: Raw binary body + requestBody: + required: true + content: + application/octet-stream: + schema: + type: string + format: binary + responses: + '204': + description: No content diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml index 437458591083..03787495f731 100644 --- a/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml @@ -13,7 +13,7 @@ paths: in: query schema: type: string - - name: byte + - name: bytes in: query schema: type: string @@ -22,7 +22,7 @@ paths: '204': description: No content - /path/{plain}/{byte}: + /path/{plain}/{bytes}: get: operationId: pathParams summary: Path parameters @@ -32,7 +32,7 @@ paths: required: true schema: type: string - - name: byte + - name: bytes in: path required: true schema: @@ -69,7 +69,7 @@ paths: in: cookie schema: type: string - - name: byte + - name: bytes in: cookie schema: type: string @@ -91,7 +91,7 @@ paths: properties: plain: type: string - byte: + bytes: type: string format: byte responses: @@ -111,7 +111,7 @@ paths: properties: plain: type: string - byte: + bytes: type: string format: byte file: @@ -134,7 +134,7 @@ paths: properties: plain: type: string - byte: + bytes: type: string format: byte responses: 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 3bf17985d294..dca9125effd6 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 @@ -259,7 +259,7 @@ void testEnumParameters( @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") 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, + @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @RequestParam(value = "enum_form_string", required = false) String enumFormString ); 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 01dadd17b2f3..f5605756718b 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 @@ -217,20 +217,20 @@ Mono testClientModel( contentType = "application/x-www-form-urlencoded" ) Mono testEndpointParameters( - @RequestPart(value = "number", required = true) BigDecimal number, - @RequestPart(value = "double", required = true) Double _double, - @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @RequestPart(value = "byte", required = true) String _byte /* base64 encoded binary */, - @RequestPart(value = "integer", required = false) Integer integer, - @RequestPart(value = "int32", required = false) Integer int32, - @RequestPart(value = "int64", required = false) Long int64, - @RequestPart(value = "float", required = false) Float _float, - @RequestPart(value = "string", required = false) String string, + @RequestParam(value = "number", required = true) BigDecimal number, + @RequestParam(value = "double", required = true) Double _double, + @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, + @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, + @RequestParam(value = "integer", required = false) Integer integer, + @RequestParam(value = "int32", required = false) Integer int32, + @RequestParam(value = "int64", required = false) Long int64, + @RequestParam(value = "float", required = false) Float _float, + @RequestParam(value = "string", required = false) String string, @RequestPart(value = "binary", required = false) Part binary, - @RequestPart(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, - @RequestPart(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, - @RequestPart(value = "password", required = false) String password, - @RequestPart(value = "callback", required = false) String paramCallback + @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, + @RequestParam(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, + @RequestParam(value = "password", required = false) String password, + @RequestParam(value = "callback", required = false) String paramCallback ); @@ -263,8 +263,8 @@ Mono testEnumParameters( @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") 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, - @RequestPart(value = "enum_form_string", required = false) String enumFormString + @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, + @RequestParam(value = "enum_form_string", required = false) String enumFormString ); @@ -331,8 +331,8 @@ Mono testInlineAdditionalProperties( contentType = "application/x-www-form-urlencoded" ) Mono testJsonFormData( - @RequestPart(value = "param", required = true) String param, - @RequestPart(value = "param2", required = true) String param2 + @RequestParam(value = "param", required = true) String param, + @RequestParam(value = "param2", required = true) String param2 ); diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java index ecd126897323..10736dc0251c 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java @@ -186,8 +186,8 @@ Mono updatePet( ) Mono updatePetWithForm( @PathVariable("petId") Long petId, - @RequestPart(value = "name", required = false) String name, - @RequestPart(value = "status", required = false) String status + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "status", required = false) String status ); @@ -209,7 +209,7 @@ Mono updatePetWithForm( ) Mono uploadFile( @PathVariable("petId") Long petId, - @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, + @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, @RequestPart(value = "file", required = false) Part file ); @@ -233,7 +233,7 @@ Mono uploadFile( Mono uploadFileWithRequiredFile( @PathVariable("petId") Long petId, @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata + @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata ); } 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 64340c50a182..ec1d768f7ac5 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 @@ -208,20 +208,20 @@ Mono> testClientModel( contentType = "application/x-www-form-urlencoded" ) Mono> testEndpointParameters( - @RequestPart(value = "number", required = true) BigDecimal number, - @RequestPart(value = "double", required = true) Double _double, - @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @RequestPart(value = "byte", required = true) String _byte /* base64 encoded binary */, - @RequestPart(value = "integer", required = false) Integer integer, - @RequestPart(value = "int32", required = false) Integer int32, - @RequestPart(value = "int64", required = false) Long int64, - @RequestPart(value = "float", required = false) Float _float, - @RequestPart(value = "string", required = false) String string, + @RequestParam(value = "number", required = true) BigDecimal number, + @RequestParam(value = "double", required = true) Double _double, + @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, + @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, + @RequestParam(value = "integer", required = false) Integer integer, + @RequestParam(value = "int32", required = false) Integer int32, + @RequestParam(value = "int64", required = false) Long int64, + @RequestParam(value = "float", required = false) Float _float, + @RequestParam(value = "string", required = false) String string, @RequestPart(value = "binary", required = false) Part binary, - @RequestPart(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, - @RequestPart(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, - @RequestPart(value = "password", required = false) String password, - @RequestPart(value = "callback", required = false) String paramCallback + @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, + @RequestParam(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, + @RequestParam(value = "password", required = false) String password, + @RequestParam(value = "callback", required = false) String paramCallback ); @@ -253,8 +253,8 @@ Mono> testEnumParameters( @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") 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, - @RequestPart(value = "enum_form_string", required = false) String enumFormString + @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, + @RequestParam(value = "enum_form_string", required = false) String enumFormString ); @@ -318,8 +318,8 @@ Mono> testInlineAdditionalProperties( contentType = "application/x-www-form-urlencoded" ) Mono> testJsonFormData( - @RequestPart(value = "param", required = true) String param, - @RequestPart(value = "param2", required = true) String param2 + @RequestParam(value = "param", required = true) String param, + @RequestParam(value = "param2", required = true) String param2 ); diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java index fd584ea831df..58245d4f73bc 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java @@ -178,8 +178,8 @@ Mono> updatePet( ) Mono> updatePetWithForm( @PathVariable("petId") Long petId, - @RequestPart(value = "name", required = false) String name, - @RequestPart(value = "status", required = false) String status + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "status", required = false) String status ); @@ -200,7 +200,7 @@ Mono> updatePetWithForm( ) Mono> uploadFile( @PathVariable("petId") Long petId, - @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, + @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, @RequestPart(value = "file", required = false) Part file ); @@ -223,7 +223,7 @@ Mono> uploadFile( Mono> uploadFileWithRequiredFile( @PathVariable("petId") Long petId, @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata + @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata ); } 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 c5b0f02028f4..94dc809581c7 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 @@ -249,7 +249,7 @@ ResponseEntity testEnumParameters( @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") 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, + @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @RequestParam(value = "enum_form_string", required = false) String enumFormString ); diff --git a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java index 2440174d36c8..132f9d70de8e 100644 --- a/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/api/FakeApi.java @@ -367,7 +367,7 @@ ResponseEntity testEnumParameters( @Parameter(name = "enum_query_string", description = "Query parameter enum test (string)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @Parameter(name = "enum_query_integer", description = "Query parameter enum test (double)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @Parameter(name = "enum_query_double", description = "Query parameter enum test (double)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @Parameter(name = "enum_form_string_array", description = "Form parameter enum test (string array)") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @Parameter(name = "enum_form_string_array", description = "Form parameter enum test (string array)") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @Parameter(name = "enum_form_string", description = "Form parameter enum test (string)") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ); diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java index 0a173336a649..9182ad4c669e 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java @@ -418,7 +418,7 @@ default ResponseEntity testEnumParameters( @Parameter(name = "enum_query_string", description = "Query parameter enum test (string)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @Parameter(name = "enum_query_integer", description = "Query parameter enum test (double)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @Parameter(name = "enum_query_double", description = "Query parameter enum test (double)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @Parameter(name = "enum_form_string_array", description = "Form parameter enum test (string array)") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @Parameter(name = "enum_form_string_array", description = "Form parameter enum test (string array)") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @Parameter(name = "enum_form_string", description = "Form parameter enum test (string)") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return getDelegate().testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java index 63ff33246137..638b2fb89783 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java @@ -459,7 +459,7 @@ default ResponseEntity testEnumParameters( @Parameter(name = "enum_query_string", description = "Query parameter enum test (string)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @Parameter(name = "enum_query_integer", description = "Query parameter enum test (double)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @Parameter(name = "enum_query_double", description = "Query parameter enum test (double)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @Parameter(name = "enum_form_string_array", description = "Form parameter enum test (string array)") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @Parameter(name = "enum_form_string_array", description = "Form parameter enum test (string array)") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @Parameter(name = "enum_form_string", description = "Form parameter enum test (string)") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/api/FakeApi.java index 336c11e550aa..64ba48c3c47f 100644 --- a/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/spring-boot-defaultInterface-unhandledExcp/src/main/java/org/openapitools/api/FakeApi.java @@ -395,7 +395,7 @@ ResponseEntity testEnumParameters( @Parameter(name = "enum_query_string", description = "Query parameter enum test (string)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @Parameter(name = "enum_query_integer", description = "Query parameter enum test (double)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @Parameter(name = "enum_query_double", description = "Query parameter enum test (double)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @Parameter(name = "enum_form_string_array", description = "Form parameter enum test (string array)") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @Parameter(name = "enum_form_string_array", description = "Form parameter enum test (string array)") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @Parameter(name = "enum_form_string", description = "Form parameter enum test (string)") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) throws Exception; diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java index e7ad9c81d6c0..7b95f6ff88ea 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/FakeApi.java @@ -451,7 +451,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java index e7ad9c81d6c0..7b95f6ff88ea 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/FakeApi.java @@ -451,7 +451,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java index ff8f738c7dbd..4a165d2c5f74 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/api/FakeApi.java @@ -451,7 +451,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java index a2bc246f4aa6..c02fa768c34c 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/FakeApi.java @@ -410,7 +410,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return getDelegate().testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java index a2bc246f4aa6..c02fa768c34c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/FakeApi.java @@ -410,7 +410,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return getDelegate().testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java index 145f5dba11c7..9db7408dc15f 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/FakeApi.java @@ -451,7 +451,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java index 3ae61fbceb5c..3b8a8f9675b2 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java @@ -377,20 +377,20 @@ default Mono testClientModel( ) @ResponseStatus(HttpStatus.BAD_REQUEST) default Mono testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestPart(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestPart(value = "double", required = true) Double _double, - @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestPart(value = "byte", required = true) String _byte /* base64 encoded binary */, - @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestPart(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestPart(value = "int32", required = false) Integer int32, - @ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestPart(value = "float", required = false) Float _float, - @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestPart(value = "string", required = false) String string, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) Part binary, - @ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, - @ApiParam(value = "None") @Valid @RequestPart(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, - @ApiParam(value = "None") @Size(min = 10, max = 64) @Valid @RequestPart(value = "password", required = false) String password, - @ApiParam(value = "None") @Valid @RequestPart(value = "callback", required = false) String paramCallback, + @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, + @ApiParam(value = "None") @Valid @RequestParam(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, + @ApiParam(value = "None") @Size(min = 10, max = 64) @Valid @RequestParam(value = "password", required = false) String password, + @ApiParam(value = "None") @Valid @RequestParam(value = "callback", required = false) String paramCallback, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, exchange); @@ -436,8 +436,8 @@ default Mono testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, - @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestPart(value = "enum_form_string", required = false) String enumFormString, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, exchange); @@ -540,8 +540,8 @@ default Mono testInlineAdditionalProperties( ) @ResponseStatus(HttpStatus.OK) default Mono testJsonFormData( - @ApiParam(value = "field1", required = true) @Valid @RequestPart(value = "param", required = true) String param, - @ApiParam(value = "field2", required = true) @Valid @RequestPart(value = "param2", required = true) String param2, + @ApiParam(value = "field1", required = true) @Valid @RequestParam(value = "param", required = true) String param, + @ApiParam(value = "field2", required = true) @Valid @RequestParam(value = "param2", required = true) String param2, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().testJsonFormData(param, param2, exchange); @@ -681,7 +681,7 @@ default Mono testWithResultExample( default Mono uploadFileWithRequiredFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, exchange); diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java index 52c7a008228c..0cff979098ca 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java @@ -313,8 +313,8 @@ default Mono updatePet( @ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED) default Mono updatePetWithForm( @NotNull @ApiParam(value = "ID of pet that needs to be updated", required = true) @PathVariable("petId") Long petId, - @ApiParam(value = "Updated name of the pet") @Valid @RequestPart(value = "name", required = false) String name, - @ApiParam(value = "Updated status of the pet") @Valid @RequestPart(value = "status", required = false) String status, + @ApiParam(value = "Updated name of the pet") @Valid @RequestParam(value = "name", required = false) String name, + @ApiParam(value = "Updated status of the pet") @Valid @RequestParam(value = "status", required = false) String status, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().updatePetWithForm(petId, name, status, exchange); @@ -356,7 +356,7 @@ default Mono updatePetWithForm( @ResponseStatus(HttpStatus.OK) default Mono uploadFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, @ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) Part file, @ApiIgnore final ServerWebExchange exchange ) { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java index eb7cd4606012..379db00347b2 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java @@ -367,20 +367,20 @@ default Mono> testClientModel( consumes = { "application/x-www-form-urlencoded" } ) default Mono> testEndpointParameters( - @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestPart(value = "number", required = true) BigDecimal number, - @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestPart(value = "double", required = true) Double _double, - @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, - @ApiParam(value = "None", required = true) @Valid @RequestPart(value = "byte", required = true) String _byte /* base64 encoded binary */, - @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestPart(value = "integer", required = false) Integer integer, - @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestPart(value = "int32", required = false) Integer int32, - @ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64, - @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestPart(value = "float", required = false) Float _float, - @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestPart(value = "string", required = false) String string, + @ApiParam(value = "None", required = true) @DecimalMin(value = "32.1") @DecimalMax(value = "543.2") @Valid @RequestParam(value = "number", required = true) BigDecimal number, + @ApiParam(value = "None", required = true) @DecimalMin(value = "67.8") @DecimalMax(value = "123.4") @Valid @RequestParam(value = "double", required = true) Double _double, + @ApiParam(value = "None", required = true) @Pattern(regexp = "^[A-Z].*") @Valid @RequestParam(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter, + @ApiParam(value = "None", required = true) @Valid @RequestParam(value = "byte", required = true) String _byte /* base64 encoded binary */, + @ApiParam(value = "None") @Min(value = 10) @Max(value = 100) @Valid @RequestParam(value = "integer", required = false) Integer integer, + @ApiParam(value = "None") @Min(value = 20) @Max(value = 200) @Valid @RequestParam(value = "int32", required = false) Integer int32, + @ApiParam(value = "None") @Valid @RequestParam(value = "int64", required = false) Long int64, + @ApiParam(value = "None") @DecimalMax(value = "987.6") @Valid @RequestParam(value = "float", required = false) Float _float, + @ApiParam(value = "None") @Pattern(regexp = "/[a-z]/i") @Valid @RequestParam(value = "string", required = false) String string, @ApiParam(value = "None") @RequestPart(value = "binary", required = false) Part binary, - @ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, - @ApiParam(value = "None") @Valid @RequestPart(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, - @ApiParam(value = "None") @Size(min = 10, max = 64) @Valid @RequestPart(value = "password", required = false) String password, - @ApiParam(value = "None") @Valid @RequestPart(value = "callback", required = false) String paramCallback, + @ApiParam(value = "None") @Valid @RequestParam(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, + @ApiParam(value = "None") @Valid @RequestParam(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, + @ApiParam(value = "None") @Size(min = 10, max = 64) @Valid @RequestParam(value = "password", required = false) String password, + @ApiParam(value = "None") @Valid @RequestParam(value = "callback", required = false) String paramCallback, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, exchange); @@ -425,8 +425,8 @@ default Mono> testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, - @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestPart(value = "enum_form_string", required = false) String enumFormString, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, exchange); @@ -526,8 +526,8 @@ default Mono> testInlineAdditionalProperties( consumes = { "application/x-www-form-urlencoded" } ) default Mono> testJsonFormData( - @ApiParam(value = "field1", required = true) @Valid @RequestPart(value = "param", required = true) String param, - @ApiParam(value = "field2", required = true) @Valid @RequestPart(value = "param2", required = true) String param2, + @ApiParam(value = "field1", required = true) @Valid @RequestParam(value = "param", required = true) String param, + @ApiParam(value = "field2", required = true) @Valid @RequestParam(value = "param2", required = true) String param2, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().testJsonFormData(param, param2, exchange); @@ -663,7 +663,7 @@ default Mono> testWithResultExample( default Mono> uploadFileWithRequiredFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, exchange); diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java index e35ec3e59ee1..e49d8d126483 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java @@ -306,8 +306,8 @@ default Mono> updatePet( ) default Mono> updatePetWithForm( @NotNull @ApiParam(value = "ID of pet that needs to be updated", required = true) @PathVariable("petId") Long petId, - @ApiParam(value = "Updated name of the pet") @Valid @RequestPart(value = "name", required = false) String name, - @ApiParam(value = "Updated status of the pet") @Valid @RequestPart(value = "status", required = false) String status, + @ApiParam(value = "Updated name of the pet") @Valid @RequestParam(value = "name", required = false) String name, + @ApiParam(value = "Updated status of the pet") @Valid @RequestParam(value = "status", required = false) String status, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().updatePetWithForm(petId, name, status, exchange); @@ -348,7 +348,7 @@ default Mono> updatePetWithForm( ) default Mono> uploadFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, @ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) Part file, @ApiIgnore final ServerWebExchange exchange ) { diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java index d8c8baf81d36..a0b036bd55b8 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/FakeApi.java @@ -375,7 +375,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return getDelegate().testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java index d8c8baf81d36..a0b036bd55b8 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/FakeApi.java @@ -375,7 +375,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return getDelegate().testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java index 3d40e76da48a..cb63dc4ea9d2 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/FakeApi.java @@ -406,7 +406,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java index 3d40e76da48a..cb63dc4ea9d2 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/FakeApi.java @@ -406,7 +406,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java index a83dc616fcb8..a31b015f10e8 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/FakeApi.java @@ -451,7 +451,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") Optional enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Optional enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Optional enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) Optional> enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) Optional> enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) Optional enumFormString ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java index 230b6e57346f..d1a899d9c079 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java @@ -473,7 +473,7 @@ default ResponseEntity testEnumParameters( @Parameter(name = "enum_query_string", description = "Query parameter enum test (string)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @Parameter(name = "enum_query_integer", description = "Query parameter enum test (double)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @Parameter(name = "enum_query_double", description = "Query parameter enum test (double)", in = ParameterIn.QUERY) @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @Parameter(name = "enum_form_string_array", description = "Form parameter enum test (string array)") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @Parameter(name = "enum_form_string_array", description = "Form parameter enum test (string array)") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @Parameter(name = "enum_form_string", description = "Form parameter enum test (string)") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/api/FakeApi.java index ae1e007efe15..1c8f167cc04d 100644 --- a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/api/FakeApi.java @@ -602,7 +602,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, @ApiParam(value = "") @Valid @RequestParam(value = "enum_query_model_array", required = false) @Nullable List enumQueryModelArray, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java index b6e35bd7ee45..801a0a064c74 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApi.java @@ -451,7 +451,7 @@ default ResponseEntity testEnumParameters( @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) @Nullable Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) @Nullable Double enumQueryDouble, - @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List enumFormStringArray, + @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List enumFormStringArray, @ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString ) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); From e78800b672535d492409943a94b681b095f83f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Tue, 10 Feb 2026 09:26:37 +0100 Subject: [PATCH 05/28] add sample --- .../.openapi-generator-ignore | 23 +++ .../.openapi-generator/FILES | 28 +++ .../.openapi-generator/VERSION | 1 + .../README.md | 21 ++ .../springboot-byte-format-edge-cases/pom.xml | 82 ++++++++ .../OpenApiGeneratorApplication.java | 30 +++ .../org/openapitools/RFC3339DateFormat.java | 38 ++++ .../java/org/openapitools/api/ApiUtil.java | 21 ++ .../org/openapitools/api/BinaryBodyApi.java | 70 +++++++ .../api/BinaryBodyApiController.java | 45 ++++ .../java/org/openapitools/api/CookieApi.java | 72 +++++++ .../openapitools/api/CookieApiController.java | 46 +++++ .../java/org/openapitools/api/FormApi.java | 73 +++++++ .../openapitools/api/FormApiController.java | 46 +++++ .../java/org/openapitools/api/HeaderApi.java | 72 +++++++ .../openapitools/api/HeaderApiController.java | 46 +++++ .../org/openapitools/api/JsonBodyApi.java | 71 +++++++ .../api/JsonBodyApiController.java | 46 +++++ .../org/openapitools/api/MultipartApi.java | 75 +++++++ .../api/MultipartApiController.java | 46 +++++ .../java/org/openapitools/api/PathApi.java | 71 +++++++ .../openapitools/api/PathApiController.java | 45 ++++ .../java/org/openapitools/api/QueryApi.java | 72 +++++++ .../openapitools/api/QueryApiController.java | 46 +++++ .../configuration/HomeController.java | 20 ++ .../configuration/SpringDocConfiguration.java | 27 +++ .../openapitools/model/FormParamsRequest.java | 111 ++++++++++ .../src/main/resources/application.properties | 3 + .../src/main/resources/openapi.yaml | 193 ++++++++++++++++++ .../OpenApiGeneratorApplicationTests.java | 13 ++ 30 files changed, 1553 insertions(+) create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/README.md create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/pom.xml create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApi.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApiController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApi.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApiController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApi.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApiController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApi.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApiController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApi.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApiController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApi.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApiController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApi.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApiController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApi.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApiController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES new file mode 100644 index 000000000000..6901defe40b3 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES @@ -0,0 +1,28 @@ +.openapi-generator-ignore +README.md +pom.xml +src/main/java/org/openapitools/OpenApiGeneratorApplication.java +src/main/java/org/openapitools/RFC3339DateFormat.java +src/main/java/org/openapitools/api/ApiUtil.java +src/main/java/org/openapitools/api/BinaryBodyApi.java +src/main/java/org/openapitools/api/BinaryBodyApiController.java +src/main/java/org/openapitools/api/CookieApi.java +src/main/java/org/openapitools/api/CookieApiController.java +src/main/java/org/openapitools/api/FormApi.java +src/main/java/org/openapitools/api/FormApiController.java +src/main/java/org/openapitools/api/HeaderApi.java +src/main/java/org/openapitools/api/HeaderApiController.java +src/main/java/org/openapitools/api/JsonBodyApi.java +src/main/java/org/openapitools/api/JsonBodyApiController.java +src/main/java/org/openapitools/api/MultipartApi.java +src/main/java/org/openapitools/api/MultipartApiController.java +src/main/java/org/openapitools/api/PathApi.java +src/main/java/org/openapitools/api/PathApiController.java +src/main/java/org/openapitools/api/QueryApi.java +src/main/java/org/openapitools/api/QueryApiController.java +src/main/java/org/openapitools/configuration/HomeController.java +src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +src/main/java/org/openapitools/model/FormParamsRequest.java +src/main/resources/application.properties +src/main/resources/openapi.yaml +src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION new file mode 100644 index 000000000000..193a12d6e891 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.20.0-SNAPSHOT diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/README.md b/samples/server/petstore/springboot-byte-format-edge-cases/README.md new file mode 100644 index 000000000000..5cd22b6081a2 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/README.md @@ -0,0 +1,21 @@ +# OpenAPI generated server + +Spring Boot Server + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework. + + +The underlying library integrating OpenAPI to Spring Boot is [springdoc](https://springdoc.org). +Springdoc will generate an OpenAPI v3 specification based on the generated Controller and Model classes. +The specification is available to download using the following url: +http://localhost:8080/v3/api-docs/ + +Start your server as a simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/swagger-ui.html + +Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml b/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml new file mode 100644 index 000000000000..b3ab46e3b81f --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml @@ -0,0 +1,82 @@ + + 4.0.0 + org.openapitools + springboot + jar + springboot + 1.0.0-SNAPSHOT + + 1.8 + ${java.version} + ${java.version} + UTF-8 + 1.6.14 + 5.3.1 + + + org.springframework.boot + spring-boot-starter-parent + 2.7.15 + + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.data + spring-data-commons + + + + org.springdoc + springdoc-openapi-ui + ${springdoc.version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + org.openapitools + jackson-databind-nullable + 0.2.8 + + + + org.springframework.boot + spring-boot-starter-validation + + + com.fasterxml.jackson.core + jackson-databind + + + org.springframework.boot + spring-boot-starter-test + test + + + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java new file mode 100644 index 000000000000..97252a8a9402 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java @@ -0,0 +1,30 @@ +package org.openapitools; + +import com.fasterxml.jackson.databind.Module; +import org.openapitools.jackson.nullable.JsonNullableModule; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator; + +@SpringBootApplication( + nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class +) +@ComponentScan( + basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}, + nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class +) +public class OpenApiGeneratorApplication { + + public static void main(String[] args) { + SpringApplication.run(OpenApiGeneratorApplication.class, args); + } + + @Bean(name = "org.openapitools.OpenApiGeneratorApplication.jsonNullableModule") + public Module jsonNullableModule() { + return new JsonNullableModule(); + } + +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java new file mode 100644 index 000000000000..bcd3936d8b34 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -0,0 +1,38 @@ +package org.openapitools; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return this; + } +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java new file mode 100644 index 000000000000..c03486e4081d --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java @@ -0,0 +1,21 @@ +package org.openapitools.api; + +import org.springframework.web.context.request.NativeWebRequest; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiUtil { + public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { + try { + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + if (res != null) { + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApi.java new file mode 100644 index 000000000000..81b2701789ca --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApi.java @@ -0,0 +1,70 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Validated +@Tag(name = "binary-body", description = "the binary-body API") +public interface BinaryBodyApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_BINARY_BODY = "/binary-body"; + /** + * POST /binary-body : Raw binary body + * + * @param body (required) + * @return No content (status code 204) + */ + @Operation( + operationId = "binaryBody", + summary = "Raw binary body", + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = BinaryBodyApi.PATH_BINARY_BODY, + consumes = { "application/octet-stream" } + ) + default ResponseEntity binaryBody( + @Parameter(name = "body", description = "", required = true) @Valid @RequestBody org.springframework.core.io.Resource body + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApiController.java new file mode 100644 index 000000000000..9f7925332248 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApiController.java @@ -0,0 +1,45 @@ +package org.openapitools.api; + + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") +public class BinaryBodyApiController implements BinaryBodyApi { + + private final NativeWebRequest request; + + @Autowired + public BinaryBodyApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApi.java new file mode 100644 index 000000000000..055c4198e6c3 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApi.java @@ -0,0 +1,72 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.springframework.lang.Nullable; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Validated +@Tag(name = "cookie", description = "the cookie API") +public interface CookieApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_COOKIE_PARAMS = "/cookie"; + /** + * GET /cookie : Cookie parameters + * + * @param plain (optional) + * @param bytes (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "cookieParams", + summary = "Cookie parameters", + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = CookieApi.PATH_COOKIE_PARAMS + ) + default ResponseEntity cookieParams( + @Parameter(name = "plain", description = "", in = ParameterIn.COOKIE) @CookieValue(name = "plain", required = false) @Nullable String plain, + @Parameter(name = "bytes", description = "", in = ParameterIn.COOKIE) @CookieValue(name = "bytes", required = false) @Nullable String bytes /* base64 encoded binary */ + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApiController.java new file mode 100644 index 000000000000..3bdf313d4f24 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApiController.java @@ -0,0 +1,46 @@ +package org.openapitools.api; + +import org.springframework.lang.Nullable; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") +public class CookieApiController implements CookieApi { + + private final NativeWebRequest request; + + @Autowired + public CookieApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApi.java new file mode 100644 index 000000000000..a03c9992b73b --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApi.java @@ -0,0 +1,73 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.springframework.lang.Nullable; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Validated +@Tag(name = "form", description = "the form API") +public interface FormApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_FORM_PARAMS = "/form"; + /** + * POST /form : application/x-www-form-urlencoded + * + * @param plain (optional) + * @param bytes (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "formParams", + summary = "application/x-www-form-urlencoded", + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = FormApi.PATH_FORM_PARAMS, + consumes = { "application/x-www-form-urlencoded" } + ) + default ResponseEntity formParams( + @Parameter(name = "plain", description = "") @Valid @RequestParam(value = "plain", required = false) String plain, + @Parameter(name = "bytes", description = "") @Valid @RequestParam(value = "bytes", required = false) String bytes /* base64 encoded binary */ + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApiController.java new file mode 100644 index 000000000000..648b978ccfb8 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApiController.java @@ -0,0 +1,46 @@ +package org.openapitools.api; + +import org.springframework.lang.Nullable; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") +public class FormApiController implements FormApi { + + private final NativeWebRequest request; + + @Autowired + public FormApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApi.java new file mode 100644 index 000000000000..ecbfa0f23b5b --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApi.java @@ -0,0 +1,72 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.springframework.lang.Nullable; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Validated +@Tag(name = "header", description = "the header API") +public interface HeaderApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_HEADER_PARAMS = "/header"; + /** + * GET /header : Header parameters + * + * @param xPlain (optional) + * @param xByte (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "headerParams", + summary = "Header parameters", + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = HeaderApi.PATH_HEADER_PARAMS + ) + default ResponseEntity headerParams( + @Parameter(name = "X-Plain", description = "", in = ParameterIn.HEADER) @RequestHeader(value = "X-Plain", required = false) @Nullable String xPlain, + @Parameter(name = "X-Byte", description = "", in = ParameterIn.HEADER) @RequestHeader(value = "X-Byte", required = false) @Nullable String xByte /* base64 encoded binary */ + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApiController.java new file mode 100644 index 000000000000..c477c791bb45 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApiController.java @@ -0,0 +1,46 @@ +package org.openapitools.api; + +import org.springframework.lang.Nullable; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") +public class HeaderApiController implements HeaderApi { + + private final NativeWebRequest request; + + @Autowired + public HeaderApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApi.java new file mode 100644 index 000000000000..4107748ab91b --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApi.java @@ -0,0 +1,71 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.FormParamsRequest; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Validated +@Tag(name = "json-body", description = "the json-body API") +public interface JsonBodyApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_JSON_BODY = "/json-body"; + /** + * POST /json-body : JSON request body + * + * @param formParamsRequest (required) + * @return No content (status code 204) + */ + @Operation( + operationId = "jsonBody", + summary = "JSON request body", + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = JsonBodyApi.PATH_JSON_BODY, + consumes = { "application/json" } + ) + default ResponseEntity jsonBody( + @Parameter(name = "FormParamsRequest", description = "", required = true) @Valid @RequestBody FormParamsRequest formParamsRequest + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApiController.java new file mode 100644 index 000000000000..1f3ab311ceb8 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApiController.java @@ -0,0 +1,46 @@ +package org.openapitools.api; + +import org.openapitools.model.FormParamsRequest; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") +public class JsonBodyApiController implements JsonBodyApi { + + private final NativeWebRequest request; + + @Autowired + public JsonBodyApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApi.java new file mode 100644 index 000000000000..07203b6e7b24 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApi.java @@ -0,0 +1,75 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.springframework.lang.Nullable; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Validated +@Tag(name = "multipart", description = "the multipart API") +public interface MultipartApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_MULTIPART_PARAMS = "/multipart"; + /** + * POST /multipart : multipart/form-data + * + * @param plain (optional) + * @param bytes (optional) + * @param file (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "multipartParams", + summary = "multipart/form-data", + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = MultipartApi.PATH_MULTIPART_PARAMS, + consumes = { "multipart/form-data" } + ) + default ResponseEntity multipartParams( + @Parameter(name = "plain", description = "") @Valid @RequestParam(value = "plain", required = false) String plain, + @Parameter(name = "bytes", description = "") @Valid @RequestParam(value = "bytes", required = false) String bytes /* base64 encoded binary */, + @Parameter(name = "file", description = "") @RequestPart(value = "file", required = false) MultipartFile file + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApiController.java new file mode 100644 index 000000000000..d8dfa5d15b31 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApiController.java @@ -0,0 +1,46 @@ +package org.openapitools.api; + +import org.springframework.lang.Nullable; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") +public class MultipartApiController implements MultipartApi { + + private final NativeWebRequest request; + + @Autowired + public MultipartApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApi.java new file mode 100644 index 000000000000..d0ef52b999fb --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApi.java @@ -0,0 +1,71 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Validated +@Tag(name = "path", description = "the path API") +public interface PathApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_PATH_PARAMS = "/path/{plain}/{bytes}"; + /** + * GET /path/{plain}/{bytes} : Path parameters + * + * @param plain (required) + * @param bytes (required) + * @return No content (status code 204) + */ + @Operation( + operationId = "pathParams", + summary = "Path parameters", + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = PathApi.PATH_PATH_PARAMS + ) + default ResponseEntity pathParams( + @NotNull @Parameter(name = "plain", description = "", required = true, in = ParameterIn.PATH) @PathVariable("plain") String plain, + @NotNull @Parameter(name = "bytes", description = "", required = true, in = ParameterIn.PATH) @PathVariable("bytes") String bytes /* base64 encoded binary */ + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApiController.java new file mode 100644 index 000000000000..79cb69cd10e1 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApiController.java @@ -0,0 +1,45 @@ +package org.openapitools.api; + + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") +public class PathApiController implements PathApi { + + private final NativeWebRequest request; + + @Autowired + public PathApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApi.java new file mode 100644 index 000000000000..10d8c19779ac --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApi.java @@ -0,0 +1,72 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.springframework.lang.Nullable; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Validated +@Tag(name = "query", description = "the query API") +public interface QueryApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_QUERY_PARAMS = "/query"; + /** + * GET /query : Query parameters + * + * @param plain (optional) + * @param bytes (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "queryParams", + summary = "Query parameters", + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = QueryApi.PATH_QUERY_PARAMS + ) + default ResponseEntity queryParams( + @Parameter(name = "plain", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "plain", required = false) @Nullable String plain, + @Parameter(name = "bytes", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "bytes", required = false) @Nullable String bytes /* base64 encoded binary */ + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApiController.java new file mode 100644 index 000000000000..12a46e2f67e0 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApiController.java @@ -0,0 +1,46 @@ +package org.openapitools.api; + +import org.springframework.lang.Nullable; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") +public class QueryApiController implements QueryApi { + + private final NativeWebRequest request; + + @Autowired + public QueryApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java new file mode 100644 index 000000000000..9aa29284ab5f --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java @@ -0,0 +1,20 @@ +package org.openapitools.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.GetMapping; + +/** + * Home redirection to OpenAPI api documentation + */ +@Controller +public class HomeController { + + @RequestMapping("/") + public String index() { + return "redirect:swagger-ui.html"; + } + +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java new file mode 100644 index 000000000000..4262ec5c96a3 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java @@ -0,0 +1,27 @@ +package org.openapitools.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.Contact; +import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.security.SecurityScheme; + +@Configuration +public class SpringDocConfiguration { + + @Bean(name = "org.openapitools.configuration.SpringDocConfiguration.apiInfo") + OpenAPI apiInfo() { + return new OpenAPI() + .info( + new Info() + .title("Byte Format Edge Cases") + .description("No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)") + .version("1.0.0") + ) + ; + } +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java new file mode 100644 index 000000000000..45a6712a7e0f --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java @@ -0,0 +1,111 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Arrays; +import org.springframework.lang.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * FormParamsRequest + */ + +@JsonTypeName("formParams_request") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +public class FormParamsRequest { + + private @Nullable String plain; + + private @Nullable byte[] bytes; + + public FormParamsRequest plain(@Nullable String plain) { + this.plain = plain; + return this; + } + + /** + * Get plain + * @return plain + */ + + @Schema(name = "plain", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("plain") + public @Nullable String getPlain() { + return plain; + } + + public void setPlain(@Nullable String plain) { + this.plain = plain; + } + + public FormParamsRequest bytes(@Nullable byte[] bytes) { + this.bytes = bytes; + return this; + } + + /** + * Get bytes + * @return bytes + */ + + @Schema(name = "bytes", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("bytes") + public @Nullable byte[] getBytes() { + return bytes; + } + + public void setBytes(@Nullable byte[] bytes) { + this.bytes = bytes; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormParamsRequest formParamsRequest = (FormParamsRequest) o; + return Objects.equals(this.plain, formParamsRequest.plain) && + Arrays.equals(this.bytes, formParamsRequest.bytes); + } + + @Override + public int hashCode() { + return Objects.hash(plain, Arrays.hashCode(bytes)); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormParamsRequest {\n"); + sb.append(" plain: ").append(toIndentedString(plain)).append("\n"); + sb.append(" bytes: ").append(toIndentedString(bytes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties new file mode 100644 index 000000000000..7e90813e59b2 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties @@ -0,0 +1,3 @@ +server.port=8080 +spring.jackson.date-format=org.openapitools.RFC3339DateFormat +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml new file mode 100644 index 000000000000..70d0f20340b3 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml @@ -0,0 +1,193 @@ +openapi: 3.0.3 +info: + title: Byte Format Edge Cases + version: 1.0.0 +servers: +- url: / +paths: + /query: + get: + operationId: queryParams + parameters: + - explode: true + in: query + name: plain + required: false + schema: + type: string + style: form + - explode: true + in: query + name: bytes + required: false + schema: + format: byte + type: string + style: form + responses: + "204": + description: No content + summary: Query parameters + x-accepts: + - application/json + /path/{plain}/{bytes}: + get: + operationId: pathParams + parameters: + - explode: false + in: path + name: plain + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: bytes + required: true + schema: + format: byte + type: string + style: simple + responses: + "204": + description: No content + summary: Path parameters + x-accepts: + - application/json + /header: + get: + operationId: headerParams + parameters: + - explode: false + in: header + name: X-Plain + required: false + schema: + type: string + style: simple + - explode: false + in: header + name: X-Byte + required: false + schema: + format: byte + type: string + style: simple + responses: + "204": + description: No content + summary: Header parameters + x-accepts: + - application/json + /cookie: + get: + operationId: cookieParams + parameters: + - explode: true + in: cookie + name: plain + required: false + schema: + type: string + style: form + - explode: true + in: cookie + name: bytes + required: false + schema: + format: byte + type: string + style: form + responses: + "204": + description: No content + summary: Cookie parameters + x-accepts: + - application/json + /form: + post: + operationId: formParams + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/formParams_request" + required: true + responses: + "204": + description: No content + summary: application/x-www-form-urlencoded + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /multipart: + post: + operationId: multipartParams + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartParams_request" + required: true + responses: + "204": + description: No content + summary: multipart/form-data + x-content-type: multipart/form-data + x-accepts: + - application/json + /json-body: + post: + operationId: jsonBody + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/formParams_request" + required: true + responses: + "204": + description: No content + summary: JSON request body + x-content-type: application/json + x-accepts: + - application/json + /binary-body: + post: + operationId: binaryBody + requestBody: + content: + application/octet-stream: + schema: + format: binary + type: string + required: true + responses: + "204": + description: No content + summary: Raw binary body + x-content-type: application/octet-stream + x-accepts: + - application/json +components: + schemas: + multipartParams_request: + properties: + plain: + type: string + bytes: + format: byte + type: string + file: + format: binary + type: string + type: object + formParams_request: + properties: + plain: + type: string + bytes: + format: byte + type: string + type: object diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java new file mode 100644 index 000000000000..3681f67e7705 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java @@ -0,0 +1,13 @@ +package org.openapitools; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class OpenApiGeneratorApplicationTests { + + @Test + void contextLoads() { + } + +} \ No newline at end of file From 6e37d4eb470cb817790494575a0d25d676f63c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Tue, 10 Feb 2026 09:27:04 +0100 Subject: [PATCH 06/28] add sample and fix log --- .github/workflows/samples-spring.yaml | 1 + bin/configs/spring-boot-byte-format-edge-cases.yaml | 8 ++++++++ .../org/openapitools/codegen/languages/SpringCodegen.java | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 bin/configs/spring-boot-byte-format-edge-cases.yaml diff --git a/.github/workflows/samples-spring.yaml b/.github/workflows/samples-spring.yaml index 7f0a903ace3d..1af84356149e 100644 --- a/.github/workflows/samples-spring.yaml +++ b/.github/workflows/samples-spring.yaml @@ -44,6 +44,7 @@ jobs: - samples/server/petstore/spring-boot-nullable-set - samples/server/petstore/spring-boot-defaultInterface-unhandledExcp - samples/server/petstore/springboot + - samples/server/petstore/springboot-byte-format-edge-cases - samples/server/petstore/springboot-beanvalidation - samples/server/petstore/springboot-builtin-validation - samples/server/petstore/springboot-delegate diff --git a/bin/configs/spring-boot-byte-format-edge-cases.yaml b/bin/configs/spring-boot-byte-format-edge-cases.yaml new file mode 100644 index 000000000000..21bbbc44b39c --- /dev/null +++ b/bin/configs/spring-boot-byte-format-edge-cases.yaml @@ -0,0 +1,8 @@ +generatorName: spring +outputDir: samples/server/petstore/springboot-byte-format-edge-cases +inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml +templateDir: modules/openapi-generator/src/main/resources/JavaSpring +additionalProperties: + artifactId: springboot + snapshotVersion: "true" + hideGenerationTimestamp: "true" diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index 90160d2dc5eb..ace31fc723cf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -831,7 +831,7 @@ private void convertByteArrayParamsToStringType(CodegenOperation operation) { .filter(param -> param.isQueryParam || param.isPathParam || param.isHeaderParam || param.isCookieParam || param.isFormParam) .peek(param -> param.dataType = "String") .collect(Collectors.toList()); - LOGGER.info("Converted parameters {} from byte[] to String in operation {}", convertedParams.stream().map(param -> param.paramName), operation.operationId); + LOGGER.info("Converted parameters [{}] from byte[] to String in operation [{}]", convertedParams.stream().map(param -> param.paramName).collect(Collectors.toList()), operation.operationId); } private interface DataTypeAssigner { From e0d2d566db4b869cca38ad11784d602a5b8ee7cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Tue, 10 Feb 2026 09:41:43 +0100 Subject: [PATCH 07/28] up-to-date --- .../.openapi-generator/FILES | 9 --------- 1 file changed, 9 deletions(-) diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES index 6901defe40b3..4659ab4c61b2 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES @@ -1,25 +1,16 @@ -.openapi-generator-ignore README.md pom.xml src/main/java/org/openapitools/OpenApiGeneratorApplication.java src/main/java/org/openapitools/RFC3339DateFormat.java src/main/java/org/openapitools/api/ApiUtil.java src/main/java/org/openapitools/api/BinaryBodyApi.java -src/main/java/org/openapitools/api/BinaryBodyApiController.java src/main/java/org/openapitools/api/CookieApi.java -src/main/java/org/openapitools/api/CookieApiController.java src/main/java/org/openapitools/api/FormApi.java -src/main/java/org/openapitools/api/FormApiController.java src/main/java/org/openapitools/api/HeaderApi.java -src/main/java/org/openapitools/api/HeaderApiController.java src/main/java/org/openapitools/api/JsonBodyApi.java -src/main/java/org/openapitools/api/JsonBodyApiController.java src/main/java/org/openapitools/api/MultipartApi.java -src/main/java/org/openapitools/api/MultipartApiController.java src/main/java/org/openapitools/api/PathApi.java -src/main/java/org/openapitools/api/PathApiController.java src/main/java/org/openapitools/api/QueryApi.java -src/main/java/org/openapitools/api/QueryApiController.java src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/SpringDocConfiguration.java src/main/java/org/openapitools/model/FormParamsRequest.java From 431100780482060c22500625a6e49393019a296d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Tue, 10 Feb 2026 10:09:11 +0100 Subject: [PATCH 08/28] remove typeMappping --- .../org/openapitools/codegen/languages/AbstractJavaCodegen.java | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 462b7619886d..d1b89584670b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -290,7 +290,6 @@ public AbstractJavaCodegen() { typeMapping.put("date", "Date"); typeMapping.put("file", "File"); typeMapping.put("AnyType", "Object"); - typeMapping.put("ByteArray", "byte[]"); importMapping.put("BigDecimal", "java.math.BigDecimal"); importMapping.put("UUID", "java.util.UUID"); From 2e92477d81ebedb0f7ed45aa869dcfaf345a50da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Wed, 11 Feb 2026 09:13:13 +0100 Subject: [PATCH 09/28] fix implementation and tests --- .../resources/JavaSpring/formParams.mustache | 2 +- .../java/spring/SpringCodegenTest.java | 26 +++++++++++++------ .../3_0/form-multipart-binary-array.yaml | 24 +++++++++++++++++ 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache index 025005f11c3b..5608bc2bcf29 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestParam{{/isModel}}{{^isModel}}{{#isArray}}@RequestParam{{/isArray}}{{^isArray}}{{#reactive}}@RequestParam{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{{dataType}}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}{{#items.isModel}}@RequestPart{{/items.isModel}}{{^items.isModel}}@RequestParam{{/items.isModel}}{{/isArray}}{{^isArray}}{{#reactive}}@RequestParam{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{{dataType}}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} \ 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 1f216196cf64..1cb700581d6a 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 @@ -714,7 +714,7 @@ public void testMultipartBoot() throws IOException { // Check that api validates mixed multipart request JavaFileAssert.assertThat(files.get("MultipartMixedApi.java")) - .assertMethod("multipartMixed", "MultipartMixedStatus", "MultipartFile", "MultipartMixedRequestMarker", "List") + .assertMethod("multipartMixed", "MultipartMixedStatus", "MultipartFile", "MultipartMixedRequestMarker", "List", "List") .assertParameter("status").hasType("MultipartMixedStatus") .assertParameterAnnotations() .containsWithName("Valid") @@ -728,10 +728,15 @@ public void testMultipartBoot() throws IOException { .assertParameter("marker").hasType("MultipartMixedRequestMarker") .assertParameterAnnotations() .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"marker\"", "required", "false")) + // markerArray (array of objects — IMPORTANT) + .toParameter().toMethod() + .assertParameter("markerArray").hasType("List") + .assertParameterAnnotations() + .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"markerArray\"", "required", "false")) .toParameter().toMethod() .assertParameter("statusArray").hasType("List") .assertParameterAnnotations() - .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"statusArray\"", "required", "false")); + .containsWithNameAndAttributes("RequestParam", ImmutableMap.of("value", "\"statusArray\"", "required", "false")); } @Test @@ -774,12 +779,12 @@ public void testReactiveMultipartBoot() throws IOException { // Check that api validates mixed multipart request JavaFileAssert.assertThat(files.get("MultipartMixedApi.java")) - .assertMethod("multipartMixed", "MultipartMixedStatus", "Part", "MultipartMixedRequestMarker", "List", "ServerWebExchange") + .assertMethod("multipartMixed", "MultipartMixedStatus", "Part", "MultipartMixedRequestMarker", "List", "List", "ServerWebExchange") .assertParameter("status").hasType("MultipartMixedStatus") .assertParameterAnnotations() .containsWithName("Valid") .containsWithNameAndAttributes("ApiParam", ImmutableMap.of("value", "\"\"")) - .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"status\"", "required", "true")) + .containsWithNameAndAttributes("RequestParam", ImmutableMap.of("value", "\"status\"", "required", "true")) .toParameter().toMethod() .assertParameter("file").hasType("Part") .assertParameterAnnotations() @@ -789,9 +794,14 @@ public void testReactiveMultipartBoot() throws IOException { .assertParameterAnnotations() .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"marker\"", "required", "false")) .toParameter().toMethod() + // markerArray (array of objects — IMPORTANT) + .assertParameter("markerArray").hasType("List") + .assertParameterAnnotations() + .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"markerArray\"", "required", "false")) + .toParameter().toMethod() .assertParameter("statusArray").hasType("List") .assertParameterAnnotations() - .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"statusArray\"", "required", "false")); + .containsWithNameAndAttributes("RequestParam", ImmutableMap.of("value", "\"statusArray\"", "required", "false")); } @Test @@ -4890,7 +4900,7 @@ public void testSSEOperationSupport() throws Exception { } @Test - public void givenMultipartForm_whenGenerateReactiveServer_thenParameterAreCreatedAsRequestPart() throws IOException { + public void givenMultipartForm_whenGenerateReactiveServer_thenParameterAreCreatedAsRequestParam() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); output.deleteOnExit(); String outputPath = output.getAbsolutePath().replace('\\', '/'); @@ -4913,9 +4923,9 @@ public void givenMultipartForm_whenGenerateReactiveServer_thenParameterAreCreate generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true"); generator.opts(input).generate(); - + // Only file or object types would use @RequestPart assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/api/PetApi.java"), - "@Valid @RequestPart(value = \"additionalMetadata\", required = false) String additionalMetadata"); + "@Valid @RequestParam(value = \"additionalMetadata\", required = false) String additionalMetadata"); } @Test diff --git a/modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml b/modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml index 96432202560e..ec9d52977eb6 100644 --- a/modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yaml @@ -66,6 +66,11 @@ paths: properties: name: type: string + markerArray: + description: "array of objects" + type: array + items: + $ref: '#/components/schemas/MultipartMixedRequestMarker' file: description: "a file" type: string @@ -87,3 +92,22 @@ components: - IN_PROGRESS - REJECTED example: REJECTED + MultipartMixedRequestMarker: + type: object + description: Marker metadata sent as JSON part in multipart request + required: + - name + properties: + name: + type: string + description: Marker name + example: example-marker + priority: + type: integer + format: int32 + description: Optional priority + example: 10 + active: + type: boolean + description: Whether the marker is active + example: true \ No newline at end of file From 49a986900615c3cbb91298cbd5f533d2d46b6fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Wed, 11 Feb 2026 09:46:29 +0100 Subject: [PATCH 10/28] implement CR feedback --- .../spring-boot/RFC3339DateFormat.mustache | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- .../org/openapitools/RFC3339DateFormat.java | 19 ++++++++++++------- 35 files changed, 420 insertions(+), 245 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/RFC3339DateFormat.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/RFC3339DateFormat.mustache index b1a5cb59e550..b522c9723d20 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/RFC3339DateFormat.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/RFC3339DateFormat.mustache @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-interface/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/spring-boot-oneof-interface/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof-interface/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof-interface/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-file-delegate-optional/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-file-delegate-optional/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-file-delegate-optional/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-file-delegate-optional/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-spring-provide-args/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-spring-provide-args/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-spring-provide-args/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-spring-provide-args/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file From 1dc3a5c075f9ce26e8ac96339e798b3f2266639e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Wed, 11 Feb 2026 09:52:07 +0100 Subject: [PATCH 11/28] fix test --- .../org/openapitools/codegen/java/JavaClientCodegenTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index 94a0a6f4535e..53027796e41e 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -2690,7 +2690,7 @@ public void testRestClientFormMultipart() { + " files.stream().map(FileSystemResource::new).collect(Collectors.toList()));", // mixed - "multipartMixed(@jakarta.annotation.Nonnull MultipartMixedStatus status, @jakarta.annotation.Nonnull File _file, @jakarta.annotation.Nullable MultipartMixedRequestMarker marker, @jakarta.annotation.Nullable List statusArray)", + "multipartMixed(@jakarta.annotation.Nonnull MultipartMixedStatus status, @jakarta.annotation.Nonnull File _file, @jakarta.annotation.Nullable MultipartMixedRequestMarker marker, @jakarta.annotation.Nullable List markerArray, @jakarta.annotation.Nullable List statusArray)", "formParams.add(\"file\", new FileSystemResource(_file));", // single file @@ -2720,7 +2720,7 @@ public void testRestClientWithUseAbstractionForFiles() { "formParams.addAll(\"files\", files.stream().collect(Collectors.toList()));", // mixed - "multipartMixed(@jakarta.annotation.Nonnull MultipartMixedStatus status, org.springframework.core.io.AbstractResource _file, @jakarta.annotation.Nullable MultipartMixedRequestMarker marker, @jakarta.annotation.Nullable List statusArray)", + "multipartMixed(@jakarta.annotation.Nonnull MultipartMixedStatus status, org.springframework.core.io.AbstractResource _file, @jakarta.annotation.Nullable MultipartMixedRequestMarker marker, @jakarta.annotation.Nullable List markerArray, @jakarta.annotation.Nullable List statusArray)", "formParams.add(\"file\", _file);", // single file From a80c79096ebeb305d544eb5d6a09cce250ba0375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Wed, 11 Feb 2026 09:57:53 +0100 Subject: [PATCH 12/28] remove accidental change in kotlin tests --- .../spring/KotlinSpringServerCodegenTest.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index d74da75037f0..12d52f58de59 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -602,28 +602,6 @@ public void skipDefaultInterface() throws Exception { ); } - @Test(description = "test skip default interface") - public void skipDefaultIgfdgdnterface() throws Exception { - File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); - output.deleteOnExit(); - String outputPath = output.getAbsolutePath().replace('\\', '/'); - - KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); - codegen.setOutputDir(output.getAbsolutePath()); - codegen.additionalProperties().put(KotlinSpringServerCodegen.INTERFACE_ONLY, true); - codegen.additionalProperties().put(KotlinSpringServerCodegen.SKIP_DEFAULT_INTERFACE, true); - - new DefaultGenerator().opts(new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/byte-format-edge-cases.yaml")) - .config(codegen)) - .generate(); - - assertFileNotContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PingApi.kt"), - "return " - ); - } - @Test(description = "test cookie parameter generation on interface apis") public void cookieParameterGenerationApis() throws Exception { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); From e1a47cbdb9ff082641077668e6a5129d91043ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Wed, 11 Feb 2026 10:06:27 +0100 Subject: [PATCH 13/28] remove extraneous file from kotlin open api specs --- .../3_0/kotlin/byte-format-edge-cases.yaml | 157 ------------------ 1 file changed, 157 deletions(-) delete mode 100644 modules/openapi-generator/src/test/resources/3_0/kotlin/byte-format-edge-cases.yaml diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/byte-format-edge-cases.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/byte-format-edge-cases.yaml deleted file mode 100644 index 437458591083..000000000000 --- a/modules/openapi-generator/src/test/resources/3_0/kotlin/byte-format-edge-cases.yaml +++ /dev/null @@ -1,157 +0,0 @@ -openapi: 3.0.3 -info: - title: Byte Format Edge Cases - version: 1.0.0 - -paths: - /query: - get: - operationId: queryParams - summary: Query parameters - parameters: - - name: plain - in: query - schema: - type: string - - name: byte - in: query - schema: - type: string - format: byte - responses: - '204': - description: No content - - /path/{plain}/{byte}: - get: - operationId: pathParams - summary: Path parameters - parameters: - - name: plain - in: path - required: true - schema: - type: string - - name: byte - in: path - required: true - schema: - type: string - format: byte - responses: - '204': - description: No content - - /header: - get: - operationId: headerParams - summary: Header parameters - parameters: - - name: X-Plain - in: header - schema: - type: string - - name: X-Byte - in: header - schema: - type: string - format: byte - responses: - '204': - description: No content - - /cookie: - get: - operationId: cookieParams - summary: Cookie parameters - parameters: - - name: plain - in: cookie - schema: - type: string - - name: byte - in: cookie - schema: - type: string - format: byte - responses: - '204': - description: No content - - /form: - post: - operationId: formParams - summary: application/x-www-form-urlencoded - requestBody: - required: true - content: - application/x-www-form-urlencoded: - schema: - type: object - properties: - plain: - type: string - byte: - type: string - format: byte - responses: - '204': - description: No content - - /multipart: - post: - operationId: multipartParams - summary: multipart/form-data - requestBody: - required: true - content: - multipart/form-data: - schema: - type: object - properties: - plain: - type: string - byte: - type: string - format: byte - file: - type: string - format: binary - responses: - '204': - description: No content - - /json-body: - post: - operationId: jsonBody - summary: JSON request body - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - plain: - type: string - byte: - type: string - format: byte - responses: - '204': - description: No content - - /binary-body: - post: - operationId: binaryBody - summary: Raw binary body - requestBody: - required: true - content: - application/octet-stream: - schema: - type: string - format: binary - responses: - '204': - description: No content From 8abc255512790a6a814b597b138f0912ce970c62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Wed, 11 Feb 2026 10:23:33 +0100 Subject: [PATCH 14/28] update samples --- .../csharp-complex-files/api/openapi.yaml | 24 +++++++++++++ .../csharp-complex-files/docs/MultipartApi.md | 8 +++-- .../docs/MultipartMixedRequest.md | 1 + .../src/Org.OpenAPITools/Api/MultipartApi.cs | 36 +++++++++++++------ .../Model/MultipartMixedRequest.cs | 16 ++++++++- 5 files changed, 71 insertions(+), 14 deletions(-) diff --git a/samples/client/others/csharp-complex-files/api/openapi.yaml b/samples/client/others/csharp-complex-files/api/openapi.yaml index 7cb9e35505e7..bc671ba54e4e 100644 --- a/samples/client/others/csharp-complex-files/api/openapi.yaml +++ b/samples/client/others/csharp-complex-files/api/openapi.yaml @@ -57,6 +57,25 @@ components: - REJECTED example: REJECTED type: string + MultipartMixedRequestMarker: + description: Marker metadata sent as JSON part in multipart request + properties: + name: + description: Marker name + example: example-marker + type: string + priority: + description: Optional priority + example: 10 + format: int32 + type: integer + active: + description: Whether the marker is active + example: true + type: boolean + required: + - name + type: object multipartArray_request: properties: files: @@ -85,6 +104,11 @@ components: $ref: "#/components/schemas/MultipartMixedStatus" marker: $ref: "#/components/schemas/multipartMixed_request_marker" + markerArray: + description: array of objects + items: + $ref: "#/components/schemas/MultipartMixedRequestMarker" + type: array file: description: a file format: binary diff --git a/samples/client/others/csharp-complex-files/docs/MultipartApi.md b/samples/client/others/csharp-complex-files/docs/MultipartApi.md index 23628f526032..294c2b9fcab1 100644 --- a/samples/client/others/csharp-complex-files/docs/MultipartApi.md +++ b/samples/client/others/csharp-complex-files/docs/MultipartApi.md @@ -95,7 +95,7 @@ No authorization required # **MultipartMixed** -> void MultipartMixed (MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = null, List statusArray = null) +> void MultipartMixed (MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = null, List markerArray = null, List statusArray = null) @@ -121,11 +121,12 @@ namespace Example var status = (MultipartMixedStatus) "ALLOWED"; // MultipartMixedStatus | var file = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | a file var marker = new MultipartMixedRequestMarker(); // MultipartMixedRequestMarker | (optional) + var markerArray = new List(); // List | array of objects (optional) var statusArray = new List(); // List | (optional) try { - apiInstance.MultipartMixed(status, file, marker, statusArray); + apiInstance.MultipartMixed(status, file, marker, markerArray, statusArray); } catch (ApiException e) { @@ -144,7 +145,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.MultipartMixedWithHttpInfo(status, file, marker, statusArray); + apiInstance.MultipartMixedWithHttpInfo(status, file, marker, markerArray, statusArray); } catch (ApiException e) { @@ -161,6 +162,7 @@ catch (ApiException e) | **status** | **MultipartMixedStatus** | | | | **file** | **System.IO.Stream****System.IO.Stream** | a file | | | **marker** | [**MultipartMixedRequestMarker**](MultipartMixedRequestMarker.md) | | [optional] | +| **markerArray** | [**List<MultipartMixedRequestMarker>**](MultipartMixedRequestMarker.md) | array of objects | [optional] | | **statusArray** | [**List<MultipartMixedStatus>**](MultipartMixedStatus.md) | | [optional] | ### Return type diff --git a/samples/client/others/csharp-complex-files/docs/MultipartMixedRequest.md b/samples/client/others/csharp-complex-files/docs/MultipartMixedRequest.md index d00f722a3542..8f6da65c6bb4 100644 --- a/samples/client/others/csharp-complex-files/docs/MultipartMixedRequest.md +++ b/samples/client/others/csharp-complex-files/docs/MultipartMixedRequest.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Status** | **MultipartMixedStatus** | | **Marker** | [**MultipartMixedRequestMarker**](MultipartMixedRequestMarker.md) | | [optional] +**MarkerArray** | [**List<MultipartMixedRequestMarker>**](MultipartMixedRequestMarker.md) | array of objects | [optional] **File** | **System.IO.Stream** | a file | **StatusArray** | [**List<MultipartMixedStatus>**](MultipartMixedStatus.md) | | [optional] diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs index 5e305e7c4bc6..7c57e0d4cb4d 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs @@ -59,10 +59,11 @@ public interface IMultipartApiSync : IApiAccessor /// /// a file /// (optional) + /// array of objects (optional) /// (optional) /// Index associated with the operation. /// - void MultipartMixed(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List statusArray = default, int operationIndex = 0); + void MultipartMixed(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List markerArray = default, List statusArray = default, int operationIndex = 0); /// /// @@ -74,10 +75,11 @@ public interface IMultipartApiSync : IApiAccessor /// /// a file /// (optional) + /// array of objects (optional) /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - ApiResponse MultipartMixedWithHttpInfo(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List statusArray = default, int operationIndex = 0); + ApiResponse MultipartMixedWithHttpInfo(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List markerArray = default, List statusArray = default, int operationIndex = 0); /// /// /// @@ -145,11 +147,12 @@ public interface IMultipartApiAsync : IApiAccessor /// /// a file /// (optional) + /// array of objects (optional) /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - System.Threading.Tasks.Task MultipartMixedAsync(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List statusArray = default, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default); + System.Threading.Tasks.Task MultipartMixedAsync(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List markerArray = default, List statusArray = default, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -161,11 +164,12 @@ public interface IMultipartApiAsync : IApiAccessor /// /// a file /// (optional) + /// array of objects (optional) /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - System.Threading.Tasks.Task> MultipartMixedWithHttpInfoAsync(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List statusArray = default, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default); + System.Threading.Tasks.Task> MultipartMixedWithHttpInfoAsync(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List markerArray = default, List statusArray = default, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default); /// /// /// @@ -461,12 +465,13 @@ public async System.Threading.Tasks.Task MultipartArrayAsync(List /// a file /// (optional) + /// array of objects (optional) /// (optional) /// Index associated with the operation. /// - public void MultipartMixed(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List statusArray = default, int operationIndex = 0) + public void MultipartMixed(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List markerArray = default, List statusArray = default, int operationIndex = 0) { - MultipartMixedWithHttpInfo(status, file, marker, statusArray); + MultipartMixedWithHttpInfo(status, file, marker, markerArray, statusArray); } /// @@ -476,10 +481,11 @@ public void MultipartMixed(MultipartMixedStatus status, System.IO.Stream file, M /// /// a file /// (optional) + /// array of objects (optional) /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse MultipartMixedWithHttpInfo(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List statusArray = default, int operationIndex = 0) + public Org.OpenAPITools.Client.ApiResponse MultipartMixedWithHttpInfo(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List markerArray = default, List statusArray = default, int operationIndex = 0) { // verify the required parameter 'file' is set if (file == null) @@ -515,6 +521,10 @@ public Org.OpenAPITools.Client.ApiResponse MultipartMixedWithHttpInfo(Mu { localVarRequestOptions.FormParameters.Add("marker", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(marker) : Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter } + if (markerArray != null) + { + localVarRequestOptions.FormParameters.Add("markerArray", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(markerArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(markerArray)); // form parameter + } localVarRequestOptions.FileParameters.Add("file", file); if (statusArray != null) { @@ -546,13 +556,14 @@ public Org.OpenAPITools.Client.ApiResponse MultipartMixedWithHttpInfo(Mu /// /// a file /// (optional) + /// array of objects (optional) /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - public async System.Threading.Tasks.Task MultipartMixedAsync(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List statusArray = default, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default) + public async System.Threading.Tasks.Task MultipartMixedAsync(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List markerArray = default, List statusArray = default, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default) { - await MultipartMixedWithHttpInfoAsync(status, file, marker, statusArray, operationIndex, cancellationToken).ConfigureAwait(false); + await MultipartMixedWithHttpInfoAsync(status, file, marker, markerArray, statusArray, operationIndex, cancellationToken).ConfigureAwait(false); } /// @@ -562,11 +573,12 @@ public async System.Threading.Tasks.Task MultipartMixedAsync(MultipartMixedStatu /// /// a file /// (optional) + /// array of objects (optional) /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - public async System.Threading.Tasks.Task> MultipartMixedWithHttpInfoAsync(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List statusArray = default, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default) + public async System.Threading.Tasks.Task> MultipartMixedWithHttpInfoAsync(MultipartMixedStatus status, System.IO.Stream file, MultipartMixedRequestMarker marker = default, List markerArray = default, List statusArray = default, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default) { // verify the required parameter 'file' is set if (file == null) @@ -602,6 +614,10 @@ public async System.Threading.Tasks.Task MultipartMixedAsync(MultipartMixedStatu { localVarRequestOptions.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter } + if (markerArray != null) + { + localVarRequestOptions.FormParameters.Add("markerArray", Org.OpenAPITools.Client.ClientUtils.Serialize(markerArray)); // form parameter + } localVarRequestOptions.FileParameters.Add("file", file); if (statusArray != null) { diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs index 17a5fc53f5ef..9d2dcd9a1627 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs @@ -48,9 +48,10 @@ protected MultipartMixedRequest() { } /// /// status (required). /// marker. + /// array of objects. /// a file (required). /// statusArray. - public MultipartMixedRequest(MultipartMixedStatus status = default, MultipartMixedRequestMarker marker = default, System.IO.Stream file = default, List statusArray = default) + public MultipartMixedRequest(MultipartMixedStatus status = default, MultipartMixedRequestMarker marker = default, List markerArray = default, System.IO.Stream file = default, List statusArray = default) { this.Status = status; // to ensure "file" is required (not null) @@ -60,6 +61,7 @@ public MultipartMixedRequest(MultipartMixedStatus status = default, MultipartMix } this.File = file; this.Marker = marker; + this.MarkerArray = markerArray; this.StatusArray = statusArray; } @@ -69,6 +71,13 @@ public MultipartMixedRequest(MultipartMixedStatus status = default, MultipartMix [DataMember(Name = "marker", EmitDefaultValue = false)] public MultipartMixedRequestMarker Marker { get; set; } + /// + /// array of objects + /// + /// array of objects + [DataMember(Name = "markerArray", EmitDefaultValue = false)] + public List MarkerArray { get; set; } + /// /// a file /// @@ -92,6 +101,7 @@ public override string ToString() sb.Append("class MultipartMixedRequest {\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Marker: ").Append(Marker).Append("\n"); + sb.Append(" MarkerArray: ").Append(MarkerArray).Append("\n"); sb.Append(" File: ").Append(File).Append("\n"); sb.Append(" StatusArray: ").Append(StatusArray).Append("\n"); sb.Append("}\n"); @@ -141,6 +151,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.Marker.GetHashCode(); } + if (this.MarkerArray != null) + { + hashCode = (hashCode * 59) + this.MarkerArray.GetHashCode(); + } if (this.File != null) { hashCode = (hashCode * 59) + this.File.GetHashCode(); From 08eee7fb89d1dabfa91d60bde42fa88df95fd1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Wed, 11 Feb 2026 10:58:01 +0100 Subject: [PATCH 15/28] update samples --- .../src/test/java/org/openapitools/api/PetApiTest.java | 4 ++-- .../src/test/java/org/openapitools/api/StoreApiTest.java | 4 ++-- .../src/test/java/org/openapitools/api/UserApiTest.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/PetApiTest.java b/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/PetApiTest.java index db242ade0a0a..e55f136c415e 100644 --- a/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/PetApiTest.java +++ b/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/PetApiTest.java @@ -1,5 +1,5 @@ -/** -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.11.0-SNAPSHOT). +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/StoreApiTest.java b/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/StoreApiTest.java index 2316853508bc..249efd225573 100644 --- a/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/StoreApiTest.java +++ b/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/StoreApiTest.java @@ -1,5 +1,5 @@ -/** -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.11.0-SNAPSHOT). +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/UserApiTest.java b/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/UserApiTest.java index 9d71548a6d7f..199e78ab9152 100644 --- a/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/UserApiTest.java +++ b/samples/server/petstore/java-camel/src/test/java/org/openapitools/api/UserApiTest.java @@ -1,5 +1,5 @@ -/** -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.11.0-SNAPSHOT). +/* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). * https://openapi-generator.tech * Do not edit the class manually. */ From 2a4b8f2f84283e881d8a468d809582a0e8574a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Wed, 11 Feb 2026 11:44:29 +0100 Subject: [PATCH 16/28] update samples after merge of master --- .../typescript-axios/build/package.json | 2 +- .../client/ApiResponseDecoder.java | 76 ++----------------- .../builds/es6-target/package.json | 2 +- .../builds/test-petstore/api.ts | 2 +- .../builds/with-complex-headers/package.json | 2 +- .../api.ts | 2 +- .../package.json | 2 +- .../builds/with-npm-version/package.json | 2 +- .../builds/default-v3.0/models/MapTest.ts | 4 +- .../snakecase-discriminator/models/MapTest.ts | 4 +- .../builds/explode-query/models/MapTest.ts | 4 +- 11 files changed, 18 insertions(+), 84 deletions(-) diff --git a/samples/client/echo_api/typescript-axios/build/package.json b/samples/client/echo_api/typescript-axios/build/package.json index 559eff6543a0..e5d6921f72aa 100644 --- a/samples/client/echo_api/typescript-axios/build/package.json +++ b/samples/client/echo_api/typescript-axios/build/package.json @@ -22,7 +22,7 @@ "prepare": "npm run build" }, "dependencies": { - "axios": "^1.13.5" + "axios": "^1.6.1" }, "devDependencies": { "@types/node": "12.11.5 - 12.20.42", diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiResponseDecoder.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiResponseDecoder.java index ed75d1731f3d..52ca0850b144 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiResponseDecoder.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiResponseDecoder.java @@ -18,99 +18,33 @@ import feign.Types; import feign.jackson.JacksonDecoder; -import java.io.File; import java.io.IOException; -import java.io.InputStream; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; import java.util.Collection; import java.util.Collections; import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import org.openapitools.client.model.ApiResponse; public class ApiResponseDecoder extends JacksonDecoder { - private static final Pattern FILENAME_PATTERN = - Pattern.compile("filename=\"([^\"]+)\"|filename=([^\\s;]+)"); - public ApiResponseDecoder(ObjectMapper mapper) { super(mapper); } @Override public Object decode(Response response, Type type) throws IOException { + //Detects if the type is an instance of the parameterized class ApiResponse if (type instanceof ParameterizedType && Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { + //The ApiResponse class has a single type parameter, the Dto class itself Type responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; - Object body = isBinaryType(responseBodyType) - ? decodeBinary(response, responseBodyType) - : super.decode(response, responseBodyType); + Object body = super.decode(response, responseBodyType); Map> responseHeaders = Collections.unmodifiableMap(response.headers()); return new ApiResponse<>(response.status(), responseHeaders, body); - } - - if (isBinaryType(type)) { - return decodeBinary(response, type); - } - - return super.decode(response, type); - } - - private boolean isBinaryType(Type type) { - Class raw = Types.getRawType(type); - return File.class.isAssignableFrom(raw) - || byte[].class.isAssignableFrom(raw) - || InputStream.class.isAssignableFrom(raw); - } - - private Object decodeBinary(Response response, Type type) throws IOException { - Class raw = Types.getRawType(type); - if (response.body() == null) { - return null; - } - if (byte[].class.isAssignableFrom(raw)) { - return response.body().asInputStream().readAllBytes(); - } - if (InputStream.class.isAssignableFrom(raw)) { - return response.body().asInputStream(); - } - return downloadToTempFile(response); - } - - private File downloadToTempFile(Response response) throws IOException { - String filename = extractFilename(response); - File file; - if (filename != null) { - // Sanitize: strip path components to prevent path traversal - String safeName = Paths.get(filename).getFileName().toString(); - java.nio.file.Path tempDir = Files.createTempDirectory("feign-download"); - file = Files.createFile(tempDir.resolve(safeName)).toFile(); - tempDir.toFile().deleteOnExit(); } else { - file = Files.createTempFile("download-", "").toFile(); - } - file.deleteOnExit(); - try (InputStream is = response.body().asInputStream()) { - Files.copy(is, file.toPath(), StandardCopyOption.REPLACE_EXISTING); - } - return file; - } - - private String extractFilename(Response response) { - Collection dispositions = response.headers().get("Content-Disposition"); - if (dispositions == null) return null; - for (String disposition : dispositions) { - Matcher m = FILENAME_PATTERN.matcher(disposition); - if (m.find()) { - // Group 1: quoted filename (may contain spaces), Group 2: unquoted token - return m.group(1) != null ? m.group(1) : m.group(2); - } + //The response is not encapsulated in the ApiResponse, decode the Dto as normal + return super.decode(response, type); } - return null; } } diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/package.json b/samples/client/petstore/typescript-axios/builds/es6-target/package.json index ac7c88e9bf29..2c6217f2d80a 100644 --- a/samples/client/petstore/typescript-axios/builds/es6-target/package.json +++ b/samples/client/petstore/typescript-axios/builds/es6-target/package.json @@ -24,7 +24,7 @@ "prepare": "npm run build" }, "dependencies": { - "axios": "^1.13.5" + "axios": "^1.6.1" }, "devDependencies": { "@types/node": "12.11.5 - 12.20.42", diff --git a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts index ec42b08ab36f..aefaae4e861c 100644 --- a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts +++ b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts @@ -329,7 +329,7 @@ export type MammalAnyofTypeEnum = typeof MammalAnyofTypeEnum[keyof typeof Mammal export interface MapTest { 'map_map_of_string'?: { [key: string]: { [key: string]: string; }; }; - 'map_of_enum_string'?: { [key: string]: MapTestMapOfEnumStringEnum; }; + 'map_of_enum_string'?: { [key: string]: string; }; 'direct_map'?: { [key: string]: boolean; }; 'indirect_map'?: { [key: string]: boolean; }; } diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json b/samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json index 9a7603f0affc..aa938d8bf659 100644 --- a/samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json @@ -22,7 +22,7 @@ "prepare": "npm run build" }, "dependencies": { - "axios": "^1.13.5" + "axios": "^1.6.1" }, "devDependencies": { "@types/node": "12.11.5 - 12.20.42", diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts index 5eed4da6f370..5e5e3763acec 100644 --- a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts @@ -227,7 +227,7 @@ export type Mammal = { className: 'whale' } & Whale | { className: 'zebra' } & Z export interface MapTest { 'map_map_of_string'?: { [key: string]: { [key: string]: string; }; }; - 'map_of_enum_string'?: { [key: string]: MapTestMapOfEnumStringEnum; }; + 'map_of_enum_string'?: { [key: string]: string; }; 'direct_map'?: { [key: string]: boolean; }; 'indirect_map'?: { [key: string]: boolean; }; } diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json index 9a7603f0affc..aa938d8bf659 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json @@ -22,7 +22,7 @@ "prepare": "npm run build" }, "dependencies": { - "axios": "^1.13.5" + "axios": "^1.6.1" }, "devDependencies": { "@types/node": "12.11.5 - 12.20.42", diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json b/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json index 9a7603f0affc..aa938d8bf659 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json @@ -22,7 +22,7 @@ "prepare": "npm run build" }, "dependencies": { - "axios": "^1.13.5" + "axios": "^1.6.1" }, "devDependencies": { "@types/node": "12.11.5 - 12.20.42", diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts index c968578beb33..753c30a6cf93 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts @@ -27,10 +27,10 @@ export interface MapTest { mapMapOfString?: { [key: string]: { [key: string]: string; }; }; /** * - * @type {{ [key: string]: MapTestMapOfEnumStringEnum; }} + * @type {{ [key: string]: string; }} * @memberof MapTest */ - mapOfEnumString?: { [key: string]: MapTestMapOfEnumStringEnum; }; + mapOfEnumString?: { [key: string]: string; }; /** * * @type {{ [key: string]: boolean; }} diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts index c968578beb33..753c30a6cf93 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts @@ -27,10 +27,10 @@ export interface MapTest { mapMapOfString?: { [key: string]: { [key: string]: string; }; }; /** * - * @type {{ [key: string]: MapTestMapOfEnumStringEnum; }} + * @type {{ [key: string]: string; }} * @memberof MapTest */ - mapOfEnumString?: { [key: string]: MapTestMapOfEnumStringEnum; }; + mapOfEnumString?: { [key: string]: string; }; /** * * @type {{ [key: string]: boolean; }} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts index d48fa6f05cca..512fae304c86 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts @@ -14,7 +14,7 @@ import { HttpFile } from '../http/http'; export class MapTest { 'mapMapOfString'?: { [key: string]: { [key: string]: string; }; }; - 'mapOfEnumString'?: { [key: string]: MapTestMapOfEnumStringEnum; }; + 'mapOfEnumString'?: { [key: string]: string; }; 'directMap'?: { [key: string]: boolean; }; 'indirectMap'?: { [key: string]: boolean; }; @@ -32,7 +32,7 @@ export class MapTest { { "name": "mapOfEnumString", "baseName": "map_of_enum_string", - "type": "{ [key: string]: MapTestMapOfEnumStringEnum; }", + "type": "{ [key: string]: string; }", "format": "" }, { From fd81045a2070ee08c5684a84d7bd44dbc076c896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Wed, 11 Feb 2026 15:56:53 +0100 Subject: [PATCH 17/28] update samples after merge of master --- .../typescript-axios/build/package.json | 2 +- .../client/ApiResponseDecoder.java | 76 +++++++++++++++++-- .../builds/es6-target/package.json | 2 +- .../builds/test-petstore/api.ts | 2 +- .../builds/with-complex-headers/package.json | 2 +- .../api.ts | 2 +- .../package.json | 2 +- .../builds/with-npm-version/package.json | 2 +- .../builds/default-v3.0/models/MapTest.ts | 4 +- .../snakecase-discriminator/models/MapTest.ts | 4 +- .../builds/explode-query/models/MapTest.ts | 4 +- .../org/openapitools/RFC3339DateFormat.java | 19 +++-- 12 files changed, 96 insertions(+), 25 deletions(-) diff --git a/samples/client/echo_api/typescript-axios/build/package.json b/samples/client/echo_api/typescript-axios/build/package.json index e5d6921f72aa..559eff6543a0 100644 --- a/samples/client/echo_api/typescript-axios/build/package.json +++ b/samples/client/echo_api/typescript-axios/build/package.json @@ -22,7 +22,7 @@ "prepare": "npm run build" }, "dependencies": { - "axios": "^1.6.1" + "axios": "^1.13.5" }, "devDependencies": { "@types/node": "12.11.5 - 12.20.42", diff --git a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiResponseDecoder.java b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiResponseDecoder.java index 52ca0850b144..ed75d1731f3d 100644 --- a/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiResponseDecoder.java +++ b/samples/client/petstore/java/feign-hc5/src/main/java/org/openapitools/client/ApiResponseDecoder.java @@ -18,33 +18,99 @@ import feign.Types; import feign.jackson.JacksonDecoder; +import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.util.Collection; import java.util.Collections; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.openapitools.client.model.ApiResponse; public class ApiResponseDecoder extends JacksonDecoder { + private static final Pattern FILENAME_PATTERN = + Pattern.compile("filename=\"([^\"]+)\"|filename=([^\\s;]+)"); + public ApiResponseDecoder(ObjectMapper mapper) { super(mapper); } @Override public Object decode(Response response, Type type) throws IOException { - //Detects if the type is an instance of the parameterized class ApiResponse if (type instanceof ParameterizedType && Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { - //The ApiResponse class has a single type parameter, the Dto class itself Type responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; - Object body = super.decode(response, responseBodyType); + Object body = isBinaryType(responseBodyType) + ? decodeBinary(response, responseBodyType) + : super.decode(response, responseBodyType); Map> responseHeaders = Collections.unmodifiableMap(response.headers()); return new ApiResponse<>(response.status(), responseHeaders, body); + } + + if (isBinaryType(type)) { + return decodeBinary(response, type); + } + + return super.decode(response, type); + } + + private boolean isBinaryType(Type type) { + Class raw = Types.getRawType(type); + return File.class.isAssignableFrom(raw) + || byte[].class.isAssignableFrom(raw) + || InputStream.class.isAssignableFrom(raw); + } + + private Object decodeBinary(Response response, Type type) throws IOException { + Class raw = Types.getRawType(type); + if (response.body() == null) { + return null; + } + if (byte[].class.isAssignableFrom(raw)) { + return response.body().asInputStream().readAllBytes(); + } + if (InputStream.class.isAssignableFrom(raw)) { + return response.body().asInputStream(); + } + return downloadToTempFile(response); + } + + private File downloadToTempFile(Response response) throws IOException { + String filename = extractFilename(response); + File file; + if (filename != null) { + // Sanitize: strip path components to prevent path traversal + String safeName = Paths.get(filename).getFileName().toString(); + java.nio.file.Path tempDir = Files.createTempDirectory("feign-download"); + file = Files.createFile(tempDir.resolve(safeName)).toFile(); + tempDir.toFile().deleteOnExit(); } else { - //The response is not encapsulated in the ApiResponse, decode the Dto as normal - return super.decode(response, type); + file = Files.createTempFile("download-", "").toFile(); + } + file.deleteOnExit(); + try (InputStream is = response.body().asInputStream()) { + Files.copy(is, file.toPath(), StandardCopyOption.REPLACE_EXISTING); + } + return file; + } + + private String extractFilename(Response response) { + Collection dispositions = response.headers().get("Content-Disposition"); + if (dispositions == null) return null; + for (String disposition : dispositions) { + Matcher m = FILENAME_PATTERN.matcher(disposition); + if (m.find()) { + // Group 1: quoted filename (may contain spaces), Group 2: unquoted token + return m.group(1) != null ? m.group(1) : m.group(2); + } } + return null; } } diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/package.json b/samples/client/petstore/typescript-axios/builds/es6-target/package.json index 2c6217f2d80a..ac7c88e9bf29 100644 --- a/samples/client/petstore/typescript-axios/builds/es6-target/package.json +++ b/samples/client/petstore/typescript-axios/builds/es6-target/package.json @@ -24,7 +24,7 @@ "prepare": "npm run build" }, "dependencies": { - "axios": "^1.6.1" + "axios": "^1.13.5" }, "devDependencies": { "@types/node": "12.11.5 - 12.20.42", diff --git a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts index aefaae4e861c..ec42b08ab36f 100644 --- a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts +++ b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts @@ -329,7 +329,7 @@ export type MammalAnyofTypeEnum = typeof MammalAnyofTypeEnum[keyof typeof Mammal export interface MapTest { 'map_map_of_string'?: { [key: string]: { [key: string]: string; }; }; - 'map_of_enum_string'?: { [key: string]: string; }; + 'map_of_enum_string'?: { [key: string]: MapTestMapOfEnumStringEnum; }; 'direct_map'?: { [key: string]: boolean; }; 'indirect_map'?: { [key: string]: boolean; }; } diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json b/samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json index aa938d8bf659..9a7603f0affc 100644 --- a/samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json @@ -22,7 +22,7 @@ "prepare": "npm run build" }, "dependencies": { - "axios": "^1.6.1" + "axios": "^1.13.5" }, "devDependencies": { "@types/node": "12.11.5 - 12.20.42", diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts index 5e5e3763acec..5eed4da6f370 100644 --- a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts @@ -227,7 +227,7 @@ export type Mammal = { className: 'whale' } & Whale | { className: 'zebra' } & Z export interface MapTest { 'map_map_of_string'?: { [key: string]: { [key: string]: string; }; }; - 'map_of_enum_string'?: { [key: string]: string; }; + 'map_of_enum_string'?: { [key: string]: MapTestMapOfEnumStringEnum; }; 'direct_map'?: { [key: string]: boolean; }; 'indirect_map'?: { [key: string]: boolean; }; } diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json index aa938d8bf659..9a7603f0affc 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json @@ -22,7 +22,7 @@ "prepare": "npm run build" }, "dependencies": { - "axios": "^1.6.1" + "axios": "^1.13.5" }, "devDependencies": { "@types/node": "12.11.5 - 12.20.42", diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json b/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json index aa938d8bf659..9a7603f0affc 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json @@ -22,7 +22,7 @@ "prepare": "npm run build" }, "dependencies": { - "axios": "^1.6.1" + "axios": "^1.13.5" }, "devDependencies": { "@types/node": "12.11.5 - 12.20.42", diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts index 753c30a6cf93..c968578beb33 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts @@ -27,10 +27,10 @@ export interface MapTest { mapMapOfString?: { [key: string]: { [key: string]: string; }; }; /** * - * @type {{ [key: string]: string; }} + * @type {{ [key: string]: MapTestMapOfEnumStringEnum; }} * @memberof MapTest */ - mapOfEnumString?: { [key: string]: string; }; + mapOfEnumString?: { [key: string]: MapTestMapOfEnumStringEnum; }; /** * * @type {{ [key: string]: boolean; }} diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts index 753c30a6cf93..c968578beb33 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts @@ -27,10 +27,10 @@ export interface MapTest { mapMapOfString?: { [key: string]: { [key: string]: string; }; }; /** * - * @type {{ [key: string]: string; }} + * @type {{ [key: string]: MapTestMapOfEnumStringEnum; }} * @memberof MapTest */ - mapOfEnumString?: { [key: string]: string; }; + mapOfEnumString?: { [key: string]: MapTestMapOfEnumStringEnum; }; /** * * @type {{ [key: string]: boolean; }} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts index 512fae304c86..d48fa6f05cca 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts @@ -14,7 +14,7 @@ import { HttpFile } from '../http/http'; export class MapTest { 'mapMapOfString'?: { [key: string]: { [key: string]: string; }; }; - 'mapOfEnumString'?: { [key: string]: string; }; + 'mapOfEnumString'?: { [key: string]: MapTestMapOfEnumStringEnum; }; 'directMap'?: { [key: string]: boolean; }; 'indirectMap'?: { [key: string]: boolean; }; @@ -32,7 +32,7 @@ export class MapTest { { "name": "mapOfEnumString", "baseName": "map_of_enum_string", - "type": "{ [key: string]: string; }", + "type": "{ [key: string]: MapTestMapOfEnumStringEnum; }", "format": "" }, { diff --git a/samples/server/petstore/java-camel/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/java-camel/src/main/java/org/openapitools/RFC3339DateFormat.java index bcd3936d8b34..aae6822c3b13 100644 --- a/samples/server/petstore/java-camel/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/java-camel/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,26 +13,31 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); + this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); + return createFormatter().parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); + return createFormatter().format(date, toAppendTo, fieldPosition); + } + + private StdDateFormat createFormatter() { + return new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); } @Override public Object clone() { - return this; + RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); + clone.calendar = (GregorianCalendar) this.calendar.clone(); + return clone; } } \ No newline at end of file From e6faab79aee2bb16da6688ecf6a2010165864989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Wed, 11 Feb 2026 16:32:00 +0100 Subject: [PATCH 18/28] revert unrelated changes --- .../spring-boot/RFC3339DateFormat.mustache | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ 35 files changed, 245 insertions(+), 420 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/RFC3339DateFormat.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/RFC3339DateFormat.mustache index b522c9723d20..b1a5cb59e550 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/RFC3339DateFormat.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/RFC3339DateFormat.mustache @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-interface/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/spring-boot-oneof-interface/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof-interface/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof-interface/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-delegate-no-response-entity/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-file-delegate-optional/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-file-delegate-optional/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-file-delegate-optional/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-file-delegate-optional/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-lombok-data/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-lombok-tostring/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-petstore-with-api-response-examples/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-spring-provide-args/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-spring-provide-args/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-spring-provide-args/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-spring-provide-args/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot-x-implements-skip/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file From c899cb498fc2c680295ec99c75846b35cab1ba90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 12 Feb 2026 01:58:55 +0100 Subject: [PATCH 19/28] fix reactive multipart --- .../codegen/languages/SpringCodegen.java | 39 +++++++++++++++++++ .../resources/JavaSpring/formParams.mustache | 2 +- .../java/spring/SpringCodegenTest.java | 13 +++---- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index ace31fc723cf..e28f7462652d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -799,6 +799,7 @@ public void setIsVoid(boolean isVoid) { prepareVersioningParameters(ops); handleImplicitHeaders(operation); convertByteArrayParamsToStringType(operation); + markMultipartFormDataParameters(operation); } // The tag for the controller is the first tag of the first operation final CodegenOperation firstOperation = ops.get(0); @@ -834,6 +835,44 @@ private void convertByteArrayParamsToStringType(CodegenOperation operation) { LOGGER.info("Converted parameters [{}] from byte[] to String in operation [{}]", convertedParams.stream().map(param -> param.paramName).collect(Collectors.toList()), operation.operationId); } + /** + * Marks form parameters that are in multipart/form-data operations for special handling in reactive mode. + *

+ * In reactive Spring WebFlux, multipart/form-data parameters must use @RequestPart instead of @RequestParam, + * and non-model parameters (primitives, enums, strings) must be received as String or Flux<String> and + * converted manually in the implementation. + *

+ * + * @param operation the codegen operation whose parameters will be marked if necessary + **/ + private void markMultipartFormDataParameters(CodegenOperation operation) { + if (!reactive) { + return; // Only applies to reactive mode + } + + // Check if this operation consumes multipart/form-data + boolean isMultipartFormData = false; + if (operation.hasConsumes) { + for (Map consume : operation.consumes) { + if ("multipart/form-data".equals(consume.get("mediaType"))) { + isMultipartFormData = true; + break; + } + } + } + + if (!isMultipartFormData) { + return; + } + + // Mark all form parameters as multipart form data + for (CodegenParameter param : operation.allParams) { + if (param.isFormParam) { + param.vendorExtensions.put("x-isMultipartFormData", true); + } + } + } + private interface DataTypeAssigner { void setReturnType(String returnType); diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache index 5608bc2bcf29..9892a9f81306 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}{{#items.isModel}}@RequestPart{{/items.isModel}}{{^items.isModel}}@RequestParam{{/items.isModel}}{{/isArray}}{{^isArray}}{{#reactive}}@RequestParam{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{{dataType}}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}{{#items.isModel}}@RequestPart{{/items.isModel}}{{^items.isModel}}{{#reactive}}{{#vendorExtensions.x-isMultipartFormData}}@RequestPart{{/vendorExtensions.x-isMultipartFormData}}{{^vendorExtensions.x-isMultipartFormData}}@RequestParam{{/vendorExtensions.x-isMultipartFormData}}{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/items.isModel}}{{/isArray}}{{^isArray}}{{#reactive}}{{#vendorExtensions.x-isMultipartFormData}}@RequestPart{{/vendorExtensions.x-isMultipartFormData}}{{^vendorExtensions.x-isMultipartFormData}}@RequestParam{{/vendorExtensions.x-isMultipartFormData}}{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{#reactive}}{{#vendorExtensions.x-isMultipartFormData}}{{#isModel}}{{{dataType}}}{{/isModel}}{{^isModel}}{{#isArray}}{{#items.isModel}}{{{dataType}}}{{/items.isModel}}{{^items.isModel}}Flux /* Flux<{{{dataType}}}> */{{/items.isModel}}{{/isArray}}{{^isArray}}String /* {{{dataType}}} */{{/isArray}}{{/isModel}}{{/vendorExtensions.x-isMultipartFormData}}{{^vendorExtensions.x-isMultipartFormData}}{{{dataType}}}{{/vendorExtensions.x-isMultipartFormData}}{{/reactive}}{{^reactive}}{{{dataType}}}{{/reactive}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} \ 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 1cb700581d6a..ac1e890cd9db 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 @@ -779,12 +779,12 @@ public void testReactiveMultipartBoot() throws IOException { // Check that api validates mixed multipart request JavaFileAssert.assertThat(files.get("MultipartMixedApi.java")) - .assertMethod("multipartMixed", "MultipartMixedStatus", "Part", "MultipartMixedRequestMarker", "List", "List", "ServerWebExchange") - .assertParameter("status").hasType("MultipartMixedStatus") + .assertMethod("multipartMixed", "String", "Part", "MultipartMixedRequestMarker", "List", "Flux", "ServerWebExchange") + .assertParameter("status").hasType("String") .assertParameterAnnotations() .containsWithName("Valid") .containsWithNameAndAttributes("ApiParam", ImmutableMap.of("value", "\"\"")) - .containsWithNameAndAttributes("RequestParam", ImmutableMap.of("value", "\"status\"", "required", "true")) + .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"status\"", "required", "true")) .toParameter().toMethod() .assertParameter("file").hasType("Part") .assertParameterAnnotations() @@ -799,9 +799,9 @@ public void testReactiveMultipartBoot() throws IOException { .assertParameterAnnotations() .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"markerArray\"", "required", "false")) .toParameter().toMethod() - .assertParameter("statusArray").hasType("List") + .assertParameter("statusArray").hasType("Flux") .assertParameterAnnotations() - .containsWithNameAndAttributes("RequestParam", ImmutableMap.of("value", "\"statusArray\"", "required", "false")); + .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"statusArray\"", "required", "false")); } @Test @@ -4923,9 +4923,8 @@ public void givenMultipartForm_whenGenerateReactiveServer_thenParameterAreCreate generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true"); generator.opts(input).generate(); - // Only file or object types would use @RequestPart assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/api/PetApi.java"), - "@Valid @RequestParam(value = \"additionalMetadata\", required = false) String additionalMetadata"); + "@Valid @RequestPart(value = \"additionalMetadata\", required = false) String /* String */ additionalMetadata"); } @Test From 6edb518933d0049d60b64d62d5e7f1984bcf0c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 12 Feb 2026 02:03:11 +0100 Subject: [PATCH 20/28] update samples --- .../java/org/openapitools/api/PetApi.java | 4 ++-- .../java/org/openapitools/api/PetApi.java | 4 ++-- .../org/openapitools/RFC3339DateFormat.java | 19 +++++++------------ .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/PetApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/PetApi.java | 2 +- 7 files changed, 15 insertions(+), 20 deletions(-) diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java index 10736dc0251c..760bc9e447e5 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java @@ -209,7 +209,7 @@ Mono updatePetWithForm( ) Mono uploadFile( @PathVariable("petId") Long petId, - @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, + @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, @RequestPart(value = "file", required = false) Part file ); @@ -233,7 +233,7 @@ Mono uploadFile( Mono uploadFileWithRequiredFile( @PathVariable("petId") Long petId, @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata + @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata ); } diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java index 58245d4f73bc..1b7311de5009 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java @@ -200,7 +200,7 @@ Mono> updatePetWithForm( ) Mono> uploadFile( @PathVariable("petId") Long petId, - @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, + @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, @RequestPart(value = "file", required = false) Part file ); @@ -223,7 +223,7 @@ Mono> uploadFile( Mono> uploadFileWithRequiredFile( @PathVariable("petId") Long petId, @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata + @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata ); } diff --git a/samples/server/petstore/java-camel/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/java-camel/src/main/java/org/openapitools/RFC3339DateFormat.java index aae6822c3b13..bcd3936d8b34 100644 --- a/samples/server/petstore/java-camel/src/main/java/org/openapitools/RFC3339DateFormat.java +++ b/samples/server/petstore/java-camel/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -13,31 +13,26 @@ public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + public RFC3339DateFormat() { this.calendar = new GregorianCalendar(); - this.calendar.setTimeZone(TIMEZONE_Z); } @Override public Date parse(String source, ParsePosition pos) { - return createFormatter().parse(source, pos); + return fmt.parse(source, pos); } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return createFormatter().format(date, toAppendTo, fieldPosition); - } - - private StdDateFormat createFormatter() { - return new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); + return fmt.format(date, toAppendTo, fieldPosition); } @Override public Object clone() { - RFC3339DateFormat clone = (RFC3339DateFormat) super.clone(); - clone.calendar = (GregorianCalendar) this.calendar.clone(); - return clone; + return this; } } \ No newline at end of file diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java index 3b8a8f9675b2..da8920abed3f 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java @@ -681,7 +681,7 @@ default Mono testWithResultExample( default Mono uploadFileWithRequiredFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, exchange); diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java index 0cff979098ca..487856d9b51b 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java @@ -356,7 +356,7 @@ default Mono updatePetWithForm( @ResponseStatus(HttpStatus.OK) default Mono uploadFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, @ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) Part file, @ApiIgnore final ServerWebExchange exchange ) { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java index 379db00347b2..0671451465dc 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java @@ -663,7 +663,7 @@ default Mono> testWithResultExample( default Mono> uploadFileWithRequiredFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, exchange); diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java index e49d8d126483..56da3d54cfd1 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java @@ -348,7 +348,7 @@ default Mono> updatePetWithForm( ) default Mono> uploadFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, @ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) Part file, @ApiIgnore final ServerWebExchange exchange ) { From ef4435960b3ea11ef5c04499c3dff6ca5be59394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 12 Feb 2026 02:26:57 +0100 Subject: [PATCH 21/28] add lambda to add the type comment conditionally. --- .../codegen/languages/SpringCodegen.java | 21 +++++++++++++++++++ .../resources/JavaSpring/formParams.mustache | 2 +- .../java/org/openapitools/api/PetApi.java | 4 ++-- .../java/org/openapitools/api/PetApi.java | 4 ++-- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/PetApi.java | 2 +- .../java/org/openapitools/api/FakeApi.java | 2 +- .../java/org/openapitools/api/PetApi.java | 2 +- 8 files changed, 30 insertions(+), 9 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index e28f7462652d..4b4073da1c32 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -647,6 +647,27 @@ public void processOpts() { additionalProperties.put("lambdaSplitString", new SplitStringLambda()); + // Lambda to add type comment only if actual type differs from implemented type + // Format: "implementedType|actualType" -> " /* actualType */" or "" + additionalProperties.put("lambdaTypeComment", (Mustache.Lambda) (fragment, writer) -> { + String input = fragment.execute().trim(); + String[] parts = input.split("\\|", 2); + if (parts.length == 2) { + String implementedType = parts[0].trim(); + String actualType = parts[1].trim(); + + // Only add comment if types differ + if (!implementedType.equals(actualType)) { + // Also check if implementedType is a collection of actualType (e.g., List vs String) + String expectedCollection = "List<" + actualType + ">"; + String expectedFlux = "Flux<" + actualType + ">"; + if (!implementedType.equals(expectedCollection) && !implementedType.equals(expectedFlux)) { + writer.write(" /* " + actualType + " */"); + } + } + } + }); + // apiController: hide implementation behind undocumented flag to temporarily preserve code additionalProperties.put("_api_controller_impl_", false); // HEADS-UP: Do not add more template file after this block diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache index 9892a9f81306..043f19a46fb8 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}{{#items.isModel}}@RequestPart{{/items.isModel}}{{^items.isModel}}{{#reactive}}{{#vendorExtensions.x-isMultipartFormData}}@RequestPart{{/vendorExtensions.x-isMultipartFormData}}{{^vendorExtensions.x-isMultipartFormData}}@RequestParam{{/vendorExtensions.x-isMultipartFormData}}{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/items.isModel}}{{/isArray}}{{^isArray}}{{#reactive}}{{#vendorExtensions.x-isMultipartFormData}}@RequestPart{{/vendorExtensions.x-isMultipartFormData}}{{^vendorExtensions.x-isMultipartFormData}}@RequestParam{{/vendorExtensions.x-isMultipartFormData}}{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{#reactive}}{{#vendorExtensions.x-isMultipartFormData}}{{#isModel}}{{{dataType}}}{{/isModel}}{{^isModel}}{{#isArray}}{{#items.isModel}}{{{dataType}}}{{/items.isModel}}{{^items.isModel}}Flux /* Flux<{{{dataType}}}> */{{/items.isModel}}{{/isArray}}{{^isArray}}String /* {{{dataType}}} */{{/isArray}}{{/isModel}}{{/vendorExtensions.x-isMultipartFormData}}{{^vendorExtensions.x-isMultipartFormData}}{{{dataType}}}{{/vendorExtensions.x-isMultipartFormData}}{{/reactive}}{{^reactive}}{{{dataType}}}{{/reactive}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} {{>beanValidationBodyParams}}@Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}{{#items.isModel}}@RequestPart{{/items.isModel}}{{^items.isModel}}{{#reactive}}{{#vendorExtensions.x-isMultipartFormData}}@RequestPart{{/vendorExtensions.x-isMultipartFormData}}{{^vendorExtensions.x-isMultipartFormData}}@RequestParam{{/vendorExtensions.x-isMultipartFormData}}{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/items.isModel}}{{/isArray}}{{^isArray}}{{#reactive}}{{#vendorExtensions.x-isMultipartFormData}}@RequestPart{{/vendorExtensions.x-isMultipartFormData}}{{^vendorExtensions.x-isMultipartFormData}}@RequestParam{{/vendorExtensions.x-isMultipartFormData}}{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{#reactive}}{{#vendorExtensions.x-isMultipartFormData}}{{#isModel}}{{{dataType}}}{{/isModel}}{{^isModel}}{{#isArray}}{{#items.isModel}}{{{dataType}}}{{/items.isModel}}{{^items.isModel}}Flux{{#lambdaTypeComment}}Flux|{{{dataType}}}{{/lambdaTypeComment}}{{/items.isModel}}{{/isArray}}{{^isArray}}String{{#lambdaTypeComment}}String|{{{dataType}}}{{/lambdaTypeComment}}{{/isArray}}{{/isModel}}{{/vendorExtensions.x-isMultipartFormData}}{{^vendorExtensions.x-isMultipartFormData}}{{{dataType}}}{{/vendorExtensions.x-isMultipartFormData}}{{/reactive}}{{^reactive}}{{{dataType}}}{{/reactive}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isByteArray}} /* base64 encoded binary */{{/isByteArray}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java index 760bc9e447e5..179164b1ac10 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java @@ -209,7 +209,7 @@ Mono updatePetWithForm( ) Mono uploadFile( @PathVariable("petId") Long petId, - @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, + @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, @RequestPart(value = "file", required = false) Part file ); @@ -233,7 +233,7 @@ Mono uploadFile( Mono uploadFileWithRequiredFile( @PathVariable("petId") Long petId, @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata + @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata ); } diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java index 1b7311de5009..30dc9521db32 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java @@ -200,7 +200,7 @@ Mono> updatePetWithForm( ) Mono> uploadFile( @PathVariable("petId") Long petId, - @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, + @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, @RequestPart(value = "file", required = false) Part file ); @@ -223,7 +223,7 @@ Mono> uploadFile( Mono> uploadFileWithRequiredFile( @PathVariable("petId") Long petId, @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata + @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata ); } diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java index da8920abed3f..2b8a72c75cbe 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java @@ -681,7 +681,7 @@ default Mono testWithResultExample( default Mono uploadFileWithRequiredFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, exchange); diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java index 487856d9b51b..ca9e1b4b1b43 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java @@ -356,7 +356,7 @@ default Mono updatePetWithForm( @ResponseStatus(HttpStatus.OK) default Mono uploadFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, @ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) Part file, @ApiIgnore final ServerWebExchange exchange ) { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java index 0671451465dc..c8bb11864ee5 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java @@ -663,7 +663,7 @@ default Mono> testWithResultExample( default Mono> uploadFileWithRequiredFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) Part requiredFile, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, exchange); diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java index 56da3d54cfd1..72b72c92686d 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java @@ -348,7 +348,7 @@ default Mono> updatePetWithForm( ) default Mono> uploadFile( @NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, - @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String /* String */ additionalMetadata, + @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, @ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) Part file, @ApiIgnore final ServerWebExchange exchange ) { From 72337a544fe71140164efc67a90229f60adaba77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 12 Feb 2026 02:36:33 +0100 Subject: [PATCH 22/28] delete old sample files --- .github/workflows/samples-spring.yaml | 1 + ...-boot-byte-format-edge-cases-reactive.yaml | 9 + .../java/spring/SpringCodegenTest.java | 2 +- .../3_0/spring/byte-format-baseline.yaml | 157 ++++++++++ .../3_0/spring/byte-format-edge-cases.yaml | 293 +++++++++++++----- .../.openapi-generator-ignore | 23 -- .../.openapi-generator/FILES | 19 -- .../.openapi-generator/VERSION | 1 - .../README.md | 21 -- .../springboot-byte-format-edge-cases/pom.xml | 82 ----- .../OpenApiGeneratorApplication.java | 30 -- .../org/openapitools/RFC3339DateFormat.java | 38 --- .../java/org/openapitools/api/ApiUtil.java | 21 -- .../org/openapitools/api/BinaryBodyApi.java | 70 ----- .../api/BinaryBodyApiController.java | 45 --- .../java/org/openapitools/api/CookieApi.java | 72 ----- .../openapitools/api/CookieApiController.java | 46 --- .../java/org/openapitools/api/FormApi.java | 73 ----- .../openapitools/api/FormApiController.java | 46 --- .../java/org/openapitools/api/HeaderApi.java | 72 ----- .../openapitools/api/HeaderApiController.java | 46 --- .../org/openapitools/api/JsonBodyApi.java | 71 ----- .../api/JsonBodyApiController.java | 46 --- .../org/openapitools/api/MultipartApi.java | 75 ----- .../api/MultipartApiController.java | 46 --- .../java/org/openapitools/api/PathApi.java | 71 ----- .../openapitools/api/PathApiController.java | 45 --- .../java/org/openapitools/api/QueryApi.java | 72 ----- .../openapitools/api/QueryApiController.java | 46 --- .../configuration/HomeController.java | 20 -- .../configuration/SpringDocConfiguration.java | 27 -- .../openapitools/model/FormParamsRequest.java | 111 ------- .../src/main/resources/application.properties | 3 - .../src/main/resources/openapi.yaml | 193 ------------ .../OpenApiGeneratorApplicationTests.java | 13 - 35 files changed, 387 insertions(+), 1619 deletions(-) create mode 100644 bin/configs/spring-boot-byte-format-edge-cases-reactive.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_0/spring/byte-format-baseline.yaml delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/README.md delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/pom.xml delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApi.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApiController.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApi.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApiController.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApi.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApiController.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApi.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApiController.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApi.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApiController.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApi.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApiController.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApi.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApiController.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApi.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApiController.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/.github/workflows/samples-spring.yaml b/.github/workflows/samples-spring.yaml index 1af84356149e..b8d0397e13fc 100644 --- a/.github/workflows/samples-spring.yaml +++ b/.github/workflows/samples-spring.yaml @@ -45,6 +45,7 @@ jobs: - samples/server/petstore/spring-boot-defaultInterface-unhandledExcp - samples/server/petstore/springboot - samples/server/petstore/springboot-byte-format-edge-cases + - samples/server/petstore/springboot-byte-format-edge-cases-reactive - samples/server/petstore/springboot-beanvalidation - samples/server/petstore/springboot-builtin-validation - samples/server/petstore/springboot-delegate diff --git a/bin/configs/spring-boot-byte-format-edge-cases-reactive.yaml b/bin/configs/spring-boot-byte-format-edge-cases-reactive.yaml new file mode 100644 index 000000000000..9ec8439832a0 --- /dev/null +++ b/bin/configs/spring-boot-byte-format-edge-cases-reactive.yaml @@ -0,0 +1,9 @@ +generatorName: spring +outputDir: samples/server/petstore/springboot-byte-format-edge-cases-reactive +inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml +templateDir: modules/openapi-generator/src/main/resources/JavaSpring +additionalProperties: + artifactId: springboot + snapshotVersion: "true" + hideGenerationTimestamp: "true" + reactive: true 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 ac1e890cd9db..bd3d8c838806 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 @@ -879,7 +879,7 @@ public void testSchemaImplements() throws IOException { public void shouldHandleFormatByteCorrectlyForAllApiParametersAndProperties() throws IOException { final SpringCodegen codegen = new SpringCodegen(); - final Map files = generateFiles(codegen, "src/test/resources/3_0/spring/byte-format-edge-cases.yaml"); + final Map files = generateFiles(codegen, "src/test/resources/3_0/spring/byte-format-baseline.yaml"); // Query parameters: both plain text and Base64-encoded fields are mapped to String JavaFileAssert.assertThat(files.get("QueryApi.java")) .assertMethod("queryParams") diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-baseline.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-baseline.yaml new file mode 100644 index 000000000000..03787495f731 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-baseline.yaml @@ -0,0 +1,157 @@ +openapi: 3.0.3 +info: + title: Byte Format Edge Cases + version: 1.0.0 + +paths: + /query: + get: + operationId: queryParams + summary: Query parameters + parameters: + - name: plain + in: query + schema: + type: string + - name: bytes + in: query + schema: + type: string + format: byte + responses: + '204': + description: No content + + /path/{plain}/{bytes}: + get: + operationId: pathParams + summary: Path parameters + parameters: + - name: plain + in: path + required: true + schema: + type: string + - name: bytes + in: path + required: true + schema: + type: string + format: byte + responses: + '204': + description: No content + + /header: + get: + operationId: headerParams + summary: Header parameters + parameters: + - name: X-Plain + in: header + schema: + type: string + - name: X-Byte + in: header + schema: + type: string + format: byte + responses: + '204': + description: No content + + /cookie: + get: + operationId: cookieParams + summary: Cookie parameters + parameters: + - name: plain + in: cookie + schema: + type: string + - name: bytes + in: cookie + schema: + type: string + format: byte + responses: + '204': + description: No content + + /form: + post: + operationId: formParams + summary: application/x-www-form-urlencoded + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + plain: + type: string + bytes: + type: string + format: byte + responses: + '204': + description: No content + + /multipart: + post: + operationId: multipartParams + summary: multipart/form-data + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + plain: + type: string + bytes: + type: string + format: byte + file: + type: string + format: binary + responses: + '204': + description: No content + + /json-body: + post: + operationId: jsonBody + summary: JSON request body + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + plain: + type: string + bytes: + type: string + format: byte + responses: + '204': + description: No content + + /binary-body: + post: + operationId: binaryBody + summary: Raw binary body + requestBody: + required: true + content: + application/octet-stream: + schema: + type: string + format: binary + responses: + '204': + description: No content diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml index 03787495f731..b8a197a2c481 100644 --- a/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml @@ -1,157 +1,302 @@ openapi: 3.0.3 info: - title: Byte Format Edge Cases + title: Multipart & Byte Edge Case Coverage version: 1.0.0 - +servers: + - url: / +tags: + - name: coverage paths: - /query: + /coverage/query: get: operationId: queryParams - summary: Query parameters parameters: - - name: plain + - explode: true in: query + name: plain + required: false schema: type: string - - name: bytes + style: form + - explode: true in: query + name: bytes + required: false schema: - type: string format: byte + type: string + style: form responses: - '204': + "204": description: No content - - /path/{plain}/{bytes}: + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/path/{plain}/{bytes}: get: operationId: pathParams - summary: Path parameters parameters: - - name: plain + - explode: false in: path + name: plain required: true schema: type: string - - name: bytes + style: simple + - explode: false in: path + name: bytes required: true schema: - type: string format: byte + type: string + style: simple responses: - '204': + "204": description: No content - - /header: + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/header: get: operationId: headerParams - summary: Header parameters parameters: - - name: X-Plain + - explode: false in: header + name: X-Plain + required: false schema: type: string - - name: X-Byte + style: simple + - explode: false in: header + name: X-Byte + required: false schema: - type: string format: byte + type: string + style: simple responses: - '204': + "204": description: No content - - /cookie: + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/cookie: get: operationId: cookieParams - summary: Cookie parameters parameters: - - name: plain + - explode: true in: cookie + name: plain + required: false schema: type: string - - name: bytes + style: form + - explode: true in: cookie + name: bytes + required: false schema: - type: string format: byte + type: string + style: form responses: - '204': + "204": description: No content - - /form: + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/form: post: operationId: formParams - summary: application/x-www-form-urlencoded requestBody: - required: true content: application/x-www-form-urlencoded: schema: - type: object - properties: - plain: - type: string - bytes: - type: string - format: byte + $ref: "#/components/schemas/formParams_request" + required: true responses: - '204': + "204": description: No content - - /multipart: + tags: + - coverage + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/multipart/simple: post: - operationId: multipartParams - summary: multipart/form-data + operationId: multipartSimple requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartSimple_request" required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/multipart/files: + post: + operationId: multipartFileArray + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartFileArray_request" + responses: + "204": + description: No content + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/multipart/mixed: + post: + operationId: multipartMixed + requestBody: content: multipart/form-data: schema: - type: object - properties: - plain: - type: string - bytes: - type: string - format: byte - file: - type: string - format: binary + $ref: "#/components/schemas/multipartMixed_request" responses: - '204': + "204": description: No content - - /json-body: + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/json: post: operationId: jsonBody - summary: JSON request body requestBody: - required: true content: application/json: schema: - type: object - properties: - plain: - type: string - bytes: - type: string - format: byte + $ref: "#/components/schemas/formParams_request" + required: true responses: - '204': + "204": description: No content - - /binary-body: + tags: + - coverage + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/binary: post: operationId: binaryBody - summary: Raw binary body requestBody: - required: true content: application/octet-stream: schema: - type: string format: binary + type: string + required: true responses: - '204': + "204": description: No content + tags: + - coverage + x-content-type: application/octet-stream + x-accepts: + - application/json + x-tags: + - tag: coverage +components: + schemas: + MultipartMixedStatus: + enum: + - ALLOWED + - IN_PROGRESS + - REJECTED + type: string + MultipartMixedRequestMarker: + properties: + name: + type: string + priority: + format: int32 + type: integer + active: + type: boolean + required: + - name + type: object + formParams_request: + properties: + plain: + type: string + bytes: + format: byte + type: string + type: object + multipartSimple_request: + properties: + plain: + type: string + bytes: + format: byte + type: string + file: + format: binary + type: string + type: object + multipartFileArray_request: + properties: + files: + items: + format: binary + type: string + type: array + type: object + multipartMixed_request: + properties: + status: + $ref: "#/components/schemas/MultipartMixedStatus" + statusArray: + items: + $ref: "#/components/schemas/MultipartMixedStatus" + type: array + marker: + $ref: "#/components/schemas/MultipartMixedRequestMarker" + markerArray: + items: + $ref: "#/components/schemas/MultipartMixedRequestMarker" + type: array + file: + format: binary + type: string + required: + - file + - status + type: object diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a38..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES deleted file mode 100644 index 4659ab4c61b2..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES +++ /dev/null @@ -1,19 +0,0 @@ -README.md -pom.xml -src/main/java/org/openapitools/OpenApiGeneratorApplication.java -src/main/java/org/openapitools/RFC3339DateFormat.java -src/main/java/org/openapitools/api/ApiUtil.java -src/main/java/org/openapitools/api/BinaryBodyApi.java -src/main/java/org/openapitools/api/CookieApi.java -src/main/java/org/openapitools/api/FormApi.java -src/main/java/org/openapitools/api/HeaderApi.java -src/main/java/org/openapitools/api/JsonBodyApi.java -src/main/java/org/openapitools/api/MultipartApi.java -src/main/java/org/openapitools/api/PathApi.java -src/main/java/org/openapitools/api/QueryApi.java -src/main/java/org/openapitools/configuration/HomeController.java -src/main/java/org/openapitools/configuration/SpringDocConfiguration.java -src/main/java/org/openapitools/model/FormParamsRequest.java -src/main/resources/application.properties -src/main/resources/openapi.yaml -src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION deleted file mode 100644 index 193a12d6e891..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.20.0-SNAPSHOT diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/README.md b/samples/server/petstore/springboot-byte-format-edge-cases/README.md deleted file mode 100644 index 5cd22b6081a2..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# OpenAPI generated server - -Spring Boot Server - -## Overview -This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. -By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. -This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework. - - -The underlying library integrating OpenAPI to Spring Boot is [springdoc](https://springdoc.org). -Springdoc will generate an OpenAPI v3 specification based on the generated Controller and Model classes. -The specification is available to download using the following url: -http://localhost:8080/v3/api-docs/ - -Start your server as a simple java application - -You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/swagger-ui.html - -Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml b/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml deleted file mode 100644 index b3ab46e3b81f..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - 4.0.0 - org.openapitools - springboot - jar - springboot - 1.0.0-SNAPSHOT - - 1.8 - ${java.version} - ${java.version} - UTF-8 - 1.6.14 - 5.3.1 - - - org.springframework.boot - spring-boot-starter-parent - 2.7.15 - - - - src/main/java - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.data - spring-data-commons - - - - org.springdoc - springdoc-openapi-ui - ${springdoc.version} - - - - com.google.code.findbugs - jsr305 - 3.0.2 - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - - org.openapitools - jackson-databind-nullable - 0.2.8 - - - - org.springframework.boot - spring-boot-starter-validation - - - com.fasterxml.jackson.core - jackson-databind - - - org.springframework.boot - spring-boot-starter-test - test - - - diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java deleted file mode 100644 index 97252a8a9402..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.openapitools; - -import com.fasterxml.jackson.databind.Module; -import org.openapitools.jackson.nullable.JsonNullableModule; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.FilterType; -import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator; - -@SpringBootApplication( - nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class -) -@ComponentScan( - basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}, - nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class -) -public class OpenApiGeneratorApplication { - - public static void main(String[] args) { - SpringApplication.run(OpenApiGeneratorApplication.class, args); - } - - @Bean(name = "org.openapitools.OpenApiGeneratorApplication.jsonNullableModule") - public Module jsonNullableModule() { - return new JsonNullableModule(); - } - -} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java deleted file mode 100644 index bcd3936d8b34..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.openapitools; - -import com.fasterxml.jackson.databind.util.StdDateFormat; - -import java.text.DateFormat; -import java.text.FieldPosition; -import java.text.ParsePosition; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -public class RFC3339DateFormat extends DateFormat { - private static final long serialVersionUID = 1L; - private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - - public RFC3339DateFormat() { - this.calendar = new GregorianCalendar(); - } - - @Override - public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); - } - - @Override - public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - return fmt.format(date, toAppendTo, fieldPosition); - } - - @Override - public Object clone() { - return this; - } -} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java deleted file mode 100644 index c03486e4081d..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.api; - -import org.springframework.web.context.request.NativeWebRequest; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -public class ApiUtil { - public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { - try { - HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); - if (res != null) { - res.setCharacterEncoding("UTF-8"); - res.addHeader("Content-Type", contentType); - res.getWriter().print(example); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApi.java deleted file mode 100644 index 81b2701789ca..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApi.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import io.swagger.v3.oas.annotations.ExternalDocumentation; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Validated -@Tag(name = "binary-body", description = "the binary-body API") -public interface BinaryBodyApi { - - default Optional getRequest() { - return Optional.empty(); - } - - String PATH_BINARY_BODY = "/binary-body"; - /** - * POST /binary-body : Raw binary body - * - * @param body (required) - * @return No content (status code 204) - */ - @Operation( - operationId = "binaryBody", - summary = "Raw binary body", - responses = { - @ApiResponse(responseCode = "204", description = "No content") - } - ) - @RequestMapping( - method = RequestMethod.POST, - value = BinaryBodyApi.PATH_BINARY_BODY, - consumes = { "application/octet-stream" } - ) - default ResponseEntity binaryBody( - @Parameter(name = "body", description = "", required = true) @Valid @RequestBody org.springframework.core.io.Resource body - ) { - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApiController.java deleted file mode 100644 index 9f7925332248..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/BinaryBodyApiController.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapitools.api; - - - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.context.request.NativeWebRequest; - -import javax.validation.constraints.*; -import javax.validation.Valid; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Controller -@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") -public class BinaryBodyApiController implements BinaryBodyApi { - - private final NativeWebRequest request; - - @Autowired - public BinaryBodyApiController(NativeWebRequest request) { - this.request = request; - } - - @Override - public Optional getRequest() { - return Optional.ofNullable(request); - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApi.java deleted file mode 100644 index 055c4198e6c3..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApi.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import org.springframework.lang.Nullable; -import io.swagger.v3.oas.annotations.ExternalDocumentation; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Validated -@Tag(name = "cookie", description = "the cookie API") -public interface CookieApi { - - default Optional getRequest() { - return Optional.empty(); - } - - String PATH_COOKIE_PARAMS = "/cookie"; - /** - * GET /cookie : Cookie parameters - * - * @param plain (optional) - * @param bytes (optional) - * @return No content (status code 204) - */ - @Operation( - operationId = "cookieParams", - summary = "Cookie parameters", - responses = { - @ApiResponse(responseCode = "204", description = "No content") - } - ) - @RequestMapping( - method = RequestMethod.GET, - value = CookieApi.PATH_COOKIE_PARAMS - ) - default ResponseEntity cookieParams( - @Parameter(name = "plain", description = "", in = ParameterIn.COOKIE) @CookieValue(name = "plain", required = false) @Nullable String plain, - @Parameter(name = "bytes", description = "", in = ParameterIn.COOKIE) @CookieValue(name = "bytes", required = false) @Nullable String bytes /* base64 encoded binary */ - ) { - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApiController.java deleted file mode 100644 index 3bdf313d4f24..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CookieApiController.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.openapitools.api; - -import org.springframework.lang.Nullable; - - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.context.request.NativeWebRequest; - -import javax.validation.constraints.*; -import javax.validation.Valid; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Controller -@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") -public class CookieApiController implements CookieApi { - - private final NativeWebRequest request; - - @Autowired - public CookieApiController(NativeWebRequest request) { - this.request = request; - } - - @Override - public Optional getRequest() { - return Optional.ofNullable(request); - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApi.java deleted file mode 100644 index a03c9992b73b..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApi.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import org.springframework.lang.Nullable; -import io.swagger.v3.oas.annotations.ExternalDocumentation; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Validated -@Tag(name = "form", description = "the form API") -public interface FormApi { - - default Optional getRequest() { - return Optional.empty(); - } - - String PATH_FORM_PARAMS = "/form"; - /** - * POST /form : application/x-www-form-urlencoded - * - * @param plain (optional) - * @param bytes (optional) - * @return No content (status code 204) - */ - @Operation( - operationId = "formParams", - summary = "application/x-www-form-urlencoded", - responses = { - @ApiResponse(responseCode = "204", description = "No content") - } - ) - @RequestMapping( - method = RequestMethod.POST, - value = FormApi.PATH_FORM_PARAMS, - consumes = { "application/x-www-form-urlencoded" } - ) - default ResponseEntity formParams( - @Parameter(name = "plain", description = "") @Valid @RequestParam(value = "plain", required = false) String plain, - @Parameter(name = "bytes", description = "") @Valid @RequestParam(value = "bytes", required = false) String bytes /* base64 encoded binary */ - ) { - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApiController.java deleted file mode 100644 index 648b978ccfb8..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/FormApiController.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.openapitools.api; - -import org.springframework.lang.Nullable; - - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.context.request.NativeWebRequest; - -import javax.validation.constraints.*; -import javax.validation.Valid; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Controller -@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") -public class FormApiController implements FormApi { - - private final NativeWebRequest request; - - @Autowired - public FormApiController(NativeWebRequest request) { - this.request = request; - } - - @Override - public Optional getRequest() { - return Optional.ofNullable(request); - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApi.java deleted file mode 100644 index ecbfa0f23b5b..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApi.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import org.springframework.lang.Nullable; -import io.swagger.v3.oas.annotations.ExternalDocumentation; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Validated -@Tag(name = "header", description = "the header API") -public interface HeaderApi { - - default Optional getRequest() { - return Optional.empty(); - } - - String PATH_HEADER_PARAMS = "/header"; - /** - * GET /header : Header parameters - * - * @param xPlain (optional) - * @param xByte (optional) - * @return No content (status code 204) - */ - @Operation( - operationId = "headerParams", - summary = "Header parameters", - responses = { - @ApiResponse(responseCode = "204", description = "No content") - } - ) - @RequestMapping( - method = RequestMethod.GET, - value = HeaderApi.PATH_HEADER_PARAMS - ) - default ResponseEntity headerParams( - @Parameter(name = "X-Plain", description = "", in = ParameterIn.HEADER) @RequestHeader(value = "X-Plain", required = false) @Nullable String xPlain, - @Parameter(name = "X-Byte", description = "", in = ParameterIn.HEADER) @RequestHeader(value = "X-Byte", required = false) @Nullable String xByte /* base64 encoded binary */ - ) { - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApiController.java deleted file mode 100644 index c477c791bb45..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/HeaderApiController.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.openapitools.api; - -import org.springframework.lang.Nullable; - - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.context.request.NativeWebRequest; - -import javax.validation.constraints.*; -import javax.validation.Valid; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Controller -@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") -public class HeaderApiController implements HeaderApi { - - private final NativeWebRequest request; - - @Autowired - public HeaderApiController(NativeWebRequest request) { - this.request = request; - } - - @Override - public Optional getRequest() { - return Optional.ofNullable(request); - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApi.java deleted file mode 100644 index 4107748ab91b..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApi.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import org.openapitools.model.FormParamsRequest; -import io.swagger.v3.oas.annotations.ExternalDocumentation; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Validated -@Tag(name = "json-body", description = "the json-body API") -public interface JsonBodyApi { - - default Optional getRequest() { - return Optional.empty(); - } - - String PATH_JSON_BODY = "/json-body"; - /** - * POST /json-body : JSON request body - * - * @param formParamsRequest (required) - * @return No content (status code 204) - */ - @Operation( - operationId = "jsonBody", - summary = "JSON request body", - responses = { - @ApiResponse(responseCode = "204", description = "No content") - } - ) - @RequestMapping( - method = RequestMethod.POST, - value = JsonBodyApi.PATH_JSON_BODY, - consumes = { "application/json" } - ) - default ResponseEntity jsonBody( - @Parameter(name = "FormParamsRequest", description = "", required = true) @Valid @RequestBody FormParamsRequest formParamsRequest - ) { - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApiController.java deleted file mode 100644 index 1f3ab311ceb8..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/JsonBodyApiController.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.openapitools.api; - -import org.openapitools.model.FormParamsRequest; - - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.context.request.NativeWebRequest; - -import javax.validation.constraints.*; -import javax.validation.Valid; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Controller -@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") -public class JsonBodyApiController implements JsonBodyApi { - - private final NativeWebRequest request; - - @Autowired - public JsonBodyApiController(NativeWebRequest request) { - this.request = request; - } - - @Override - public Optional getRequest() { - return Optional.ofNullable(request); - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApi.java deleted file mode 100644 index 07203b6e7b24..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApi.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import org.springframework.lang.Nullable; -import io.swagger.v3.oas.annotations.ExternalDocumentation; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Validated -@Tag(name = "multipart", description = "the multipart API") -public interface MultipartApi { - - default Optional getRequest() { - return Optional.empty(); - } - - String PATH_MULTIPART_PARAMS = "/multipart"; - /** - * POST /multipart : multipart/form-data - * - * @param plain (optional) - * @param bytes (optional) - * @param file (optional) - * @return No content (status code 204) - */ - @Operation( - operationId = "multipartParams", - summary = "multipart/form-data", - responses = { - @ApiResponse(responseCode = "204", description = "No content") - } - ) - @RequestMapping( - method = RequestMethod.POST, - value = MultipartApi.PATH_MULTIPART_PARAMS, - consumes = { "multipart/form-data" } - ) - default ResponseEntity multipartParams( - @Parameter(name = "plain", description = "") @Valid @RequestParam(value = "plain", required = false) String plain, - @Parameter(name = "bytes", description = "") @Valid @RequestParam(value = "bytes", required = false) String bytes /* base64 encoded binary */, - @Parameter(name = "file", description = "") @RequestPart(value = "file", required = false) MultipartFile file - ) { - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApiController.java deleted file mode 100644 index d8dfa5d15b31..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/MultipartApiController.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.openapitools.api; - -import org.springframework.lang.Nullable; - - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.context.request.NativeWebRequest; - -import javax.validation.constraints.*; -import javax.validation.Valid; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Controller -@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") -public class MultipartApiController implements MultipartApi { - - private final NativeWebRequest request; - - @Autowired - public MultipartApiController(NativeWebRequest request) { - this.request = request; - } - - @Override - public Optional getRequest() { - return Optional.ofNullable(request); - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApi.java deleted file mode 100644 index d0ef52b999fb..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApi.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import io.swagger.v3.oas.annotations.ExternalDocumentation; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Validated -@Tag(name = "path", description = "the path API") -public interface PathApi { - - default Optional getRequest() { - return Optional.empty(); - } - - String PATH_PATH_PARAMS = "/path/{plain}/{bytes}"; - /** - * GET /path/{plain}/{bytes} : Path parameters - * - * @param plain (required) - * @param bytes (required) - * @return No content (status code 204) - */ - @Operation( - operationId = "pathParams", - summary = "Path parameters", - responses = { - @ApiResponse(responseCode = "204", description = "No content") - } - ) - @RequestMapping( - method = RequestMethod.GET, - value = PathApi.PATH_PATH_PARAMS - ) - default ResponseEntity pathParams( - @NotNull @Parameter(name = "plain", description = "", required = true, in = ParameterIn.PATH) @PathVariable("plain") String plain, - @NotNull @Parameter(name = "bytes", description = "", required = true, in = ParameterIn.PATH) @PathVariable("bytes") String bytes /* base64 encoded binary */ - ) { - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApiController.java deleted file mode 100644 index 79cb69cd10e1..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApiController.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.openapitools.api; - - - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.context.request.NativeWebRequest; - -import javax.validation.constraints.*; -import javax.validation.Valid; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Controller -@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") -public class PathApiController implements PathApi { - - private final NativeWebRequest request; - - @Autowired - public PathApiController(NativeWebRequest request) { - this.request = request; - } - - @Override - public Optional getRequest() { - return Optional.ofNullable(request); - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApi.java deleted file mode 100644 index 10d8c19779ac..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApi.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -package org.openapitools.api; - -import org.springframework.lang.Nullable; -import io.swagger.v3.oas.annotations.ExternalDocumentation; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Validated -@Tag(name = "query", description = "the query API") -public interface QueryApi { - - default Optional getRequest() { - return Optional.empty(); - } - - String PATH_QUERY_PARAMS = "/query"; - /** - * GET /query : Query parameters - * - * @param plain (optional) - * @param bytes (optional) - * @return No content (status code 204) - */ - @Operation( - operationId = "queryParams", - summary = "Query parameters", - responses = { - @ApiResponse(responseCode = "204", description = "No content") - } - ) - @RequestMapping( - method = RequestMethod.GET, - value = QueryApi.PATH_QUERY_PARAMS - ) - default ResponseEntity queryParams( - @Parameter(name = "plain", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "plain", required = false) @Nullable String plain, - @Parameter(name = "bytes", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "bytes", required = false) @Nullable String bytes /* base64 encoded binary */ - ) { - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApiController.java deleted file mode 100644 index 12a46e2f67e0..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/QueryApiController.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.openapitools.api; - -import org.springframework.lang.Nullable; - - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.context.request.NativeWebRequest; - -import javax.validation.constraints.*; -import javax.validation.Valid; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Controller -@RequestMapping("${openapi.byteFormatEdgeCases.base-path:}") -public class QueryApiController implements QueryApi { - - private final NativeWebRequest request; - - @Autowired - public QueryApiController(NativeWebRequest request) { - this.request = request; - } - - @Override - public Optional getRequest() { - return Optional.ofNullable(request); - } - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java deleted file mode 100644 index 9aa29284ab5f..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.openapitools.configuration; - -import org.springframework.context.annotation.Bean; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.GetMapping; - -/** - * Home redirection to OpenAPI api documentation - */ -@Controller -public class HomeController { - - @RequestMapping("/") - public String index() { - return "redirect:swagger-ui.html"; - } - -} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java deleted file mode 100644 index 4262ec5c96a3..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openapitools.configuration; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.info.Contact; -import io.swagger.v3.oas.models.info.License; -import io.swagger.v3.oas.models.Components; -import io.swagger.v3.oas.models.security.SecurityScheme; - -@Configuration -public class SpringDocConfiguration { - - @Bean(name = "org.openapitools.configuration.SpringDocConfiguration.apiInfo") - OpenAPI apiInfo() { - return new OpenAPI() - .info( - new Info() - .title("Byte Format Edge Cases") - .description("No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)") - .version("1.0.0") - ) - ; - } -} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java deleted file mode 100644 index 45a6712a7e0f..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.openapitools.model; - -import java.net.URI; -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonTypeName; -import java.util.Arrays; -import org.springframework.lang.Nullable; -import org.openapitools.jackson.nullable.JsonNullable; -import java.time.OffsetDateTime; -import javax.validation.Valid; -import javax.validation.constraints.*; -import io.swagger.v3.oas.annotations.media.Schema; - - -import java.util.*; -import javax.annotation.Generated; - -/** - * FormParamsRequest - */ - -@JsonTypeName("formParams_request") -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -public class FormParamsRequest { - - private @Nullable String plain; - - private @Nullable byte[] bytes; - - public FormParamsRequest plain(@Nullable String plain) { - this.plain = plain; - return this; - } - - /** - * Get plain - * @return plain - */ - - @Schema(name = "plain", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JsonProperty("plain") - public @Nullable String getPlain() { - return plain; - } - - public void setPlain(@Nullable String plain) { - this.plain = plain; - } - - public FormParamsRequest bytes(@Nullable byte[] bytes) { - this.bytes = bytes; - return this; - } - - /** - * Get bytes - * @return bytes - */ - - @Schema(name = "bytes", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - @JsonProperty("bytes") - public @Nullable byte[] getBytes() { - return bytes; - } - - public void setBytes(@Nullable byte[] bytes) { - this.bytes = bytes; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - FormParamsRequest formParamsRequest = (FormParamsRequest) o; - return Objects.equals(this.plain, formParamsRequest.plain) && - Arrays.equals(this.bytes, formParamsRequest.bytes); - } - - @Override - public int hashCode() { - return Objects.hash(plain, Arrays.hashCode(bytes)); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FormParamsRequest {\n"); - sb.append(" plain: ").append(toIndentedString(plain)).append("\n"); - sb.append(" bytes: ").append(toIndentedString(bytes)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(@Nullable Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} - diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties deleted file mode 100644 index 7e90813e59b2..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties +++ /dev/null @@ -1,3 +0,0 @@ -server.port=8080 -spring.jackson.date-format=org.openapitools.RFC3339DateFormat -spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml deleted file mode 100644 index 70d0f20340b3..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml +++ /dev/null @@ -1,193 +0,0 @@ -openapi: 3.0.3 -info: - title: Byte Format Edge Cases - version: 1.0.0 -servers: -- url: / -paths: - /query: - get: - operationId: queryParams - parameters: - - explode: true - in: query - name: plain - required: false - schema: - type: string - style: form - - explode: true - in: query - name: bytes - required: false - schema: - format: byte - type: string - style: form - responses: - "204": - description: No content - summary: Query parameters - x-accepts: - - application/json - /path/{plain}/{bytes}: - get: - operationId: pathParams - parameters: - - explode: false - in: path - name: plain - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: bytes - required: true - schema: - format: byte - type: string - style: simple - responses: - "204": - description: No content - summary: Path parameters - x-accepts: - - application/json - /header: - get: - operationId: headerParams - parameters: - - explode: false - in: header - name: X-Plain - required: false - schema: - type: string - style: simple - - explode: false - in: header - name: X-Byte - required: false - schema: - format: byte - type: string - style: simple - responses: - "204": - description: No content - summary: Header parameters - x-accepts: - - application/json - /cookie: - get: - operationId: cookieParams - parameters: - - explode: true - in: cookie - name: plain - required: false - schema: - type: string - style: form - - explode: true - in: cookie - name: bytes - required: false - schema: - format: byte - type: string - style: form - responses: - "204": - description: No content - summary: Cookie parameters - x-accepts: - - application/json - /form: - post: - operationId: formParams - requestBody: - content: - application/x-www-form-urlencoded: - schema: - $ref: "#/components/schemas/formParams_request" - required: true - responses: - "204": - description: No content - summary: application/x-www-form-urlencoded - x-content-type: application/x-www-form-urlencoded - x-accepts: - - application/json - /multipart: - post: - operationId: multipartParams - requestBody: - content: - multipart/form-data: - schema: - $ref: "#/components/schemas/multipartParams_request" - required: true - responses: - "204": - description: No content - summary: multipart/form-data - x-content-type: multipart/form-data - x-accepts: - - application/json - /json-body: - post: - operationId: jsonBody - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/formParams_request" - required: true - responses: - "204": - description: No content - summary: JSON request body - x-content-type: application/json - x-accepts: - - application/json - /binary-body: - post: - operationId: binaryBody - requestBody: - content: - application/octet-stream: - schema: - format: binary - type: string - required: true - responses: - "204": - description: No content - summary: Raw binary body - x-content-type: application/octet-stream - x-accepts: - - application/json -components: - schemas: - multipartParams_request: - properties: - plain: - type: string - bytes: - format: byte - type: string - file: - format: binary - type: string - type: object - formParams_request: - properties: - plain: - type: string - bytes: - format: byte - type: string - type: object diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java deleted file mode 100644 index 3681f67e7705..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class OpenApiGeneratorApplicationTests { - - @Test - void contextLoads() { - } - -} \ No newline at end of file From 281fa2abc50a81f004a06d312b3e7e67f8937dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 12 Feb 2026 02:39:07 +0100 Subject: [PATCH 23/28] fix test --- .../org/openapitools/codegen/java/spring/SpringCodegenTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 bd3d8c838806..a5768399b825 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 @@ -4924,7 +4924,7 @@ public void givenMultipartForm_whenGenerateReactiveServer_thenParameterAreCreate generator.opts(input).generate(); assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/api/PetApi.java"), - "@Valid @RequestPart(value = \"additionalMetadata\", required = false) String /* String */ additionalMetadata"); + "@Valid @RequestPart(value = \"additionalMetadata\", required = false) String additionalMetadata"); } @Test From 09bb69c423e8bf465de2bdfb721a925240460894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 12 Feb 2026 02:41:52 +0100 Subject: [PATCH 24/28] update samples --- .../.openapi-generator-ignore | 23 ++ .../.openapi-generator/FILES | 14 + .../.openapi-generator/VERSION | 1 + .../README.md | 21 + .../pom.xml | 82 ++++ .../OpenApiGeneratorApplication.java | 30 ++ .../org/openapitools/RFC3339DateFormat.java | 38 ++ .../java/org/openapitools/api/ApiUtil.java | 20 + .../org/openapitools/api/CoverageApi.java | 364 ++++++++++++++++++ .../api/CoverageApiController.java | 37 ++ .../EnumConverterConfiguration.java | 29 ++ .../configuration/HomeController.java | 29 ++ .../openapitools/model/FormParamsRequest.java | 111 ++++++ .../model/MultipartMixedRequestMarker.java | 143 +++++++ .../model/MultipartMixedStatus.java | 58 +++ .../src/main/resources/application.properties | 3 + .../src/main/resources/openapi.yaml | 302 +++++++++++++++ .../OpenApiGeneratorApplicationTests.java | 13 + .../.openapi-generator-ignore | 23 ++ .../.openapi-generator/FILES | 15 + .../.openapi-generator/VERSION | 1 + .../README.md | 21 + .../springboot-byte-format-edge-cases/pom.xml | 82 ++++ .../OpenApiGeneratorApplication.java | 30 ++ .../org/openapitools/RFC3339DateFormat.java | 38 ++ .../java/org/openapitools/api/ApiUtil.java | 21 + .../org/openapitools/api/CoverageApi.java | 335 ++++++++++++++++ .../api/CoverageApiController.java | 49 +++ .../EnumConverterConfiguration.java | 29 ++ .../configuration/HomeController.java | 20 + .../configuration/SpringDocConfiguration.java | 27 ++ .../openapitools/model/FormParamsRequest.java | 111 ++++++ .../model/MultipartMixedRequestMarker.java | 143 +++++++ .../model/MultipartMixedStatus.java | 58 +++ .../src/main/resources/application.properties | 3 + .../src/main/resources/openapi.yaml | 302 +++++++++++++++ .../OpenApiGeneratorApplicationTests.java | 13 + 37 files changed, 2639 insertions(+) create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator-ignore create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/FILES create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/VERSION create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/README.md create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/pom.xml create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/OpenApiGeneratorApplication.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/ApiUtil.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApi.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/configuration/HomeController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/FormParamsRequest.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/MultipartMixedStatus.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/application.properties create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/openapi.yaml create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/README.md create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/pom.xml create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApi.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/MultipartMixedStatus.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator-ignore b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/FILES b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/FILES new file mode 100644 index 000000000000..c8cfed159154 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/FILES @@ -0,0 +1,14 @@ +README.md +pom.xml +src/main/java/org/openapitools/OpenApiGeneratorApplication.java +src/main/java/org/openapitools/RFC3339DateFormat.java +src/main/java/org/openapitools/api/ApiUtil.java +src/main/java/org/openapitools/api/CoverageApi.java +src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java +src/main/java/org/openapitools/configuration/HomeController.java +src/main/java/org/openapitools/model/FormParamsRequest.java +src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java +src/main/java/org/openapitools/model/MultipartMixedStatus.java +src/main/resources/application.properties +src/main/resources/openapi.yaml +src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/VERSION b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/VERSION new file mode 100644 index 000000000000..193a12d6e891 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.20.0-SNAPSHOT diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/README.md b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/README.md new file mode 100644 index 000000000000..5cd22b6081a2 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/README.md @@ -0,0 +1,21 @@ +# OpenAPI generated server + +Spring Boot Server + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework. + + +The underlying library integrating OpenAPI to Spring Boot is [springdoc](https://springdoc.org). +Springdoc will generate an OpenAPI v3 specification based on the generated Controller and Model classes. +The specification is available to download using the following url: +http://localhost:8080/v3/api-docs/ + +Start your server as a simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/swagger-ui.html + +Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/pom.xml b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/pom.xml new file mode 100644 index 000000000000..699d3685ba27 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/pom.xml @@ -0,0 +1,82 @@ + + 4.0.0 + org.openapitools + springboot + jar + springboot + 1.0.0-SNAPSHOT + + 1.8 + ${java.version} + ${java.version} + UTF-8 + 1.6.14 + 5.3.1 + + + org.springframework.boot + spring-boot-starter-parent + 2.7.15 + + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + + org.springframework.boot + spring-boot-starter-webflux + + + org.springframework.data + spring-data-commons + + + + org.springdoc + springdoc-openapi-webflux-ui + ${springdoc.version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + org.openapitools + jackson-databind-nullable + 0.2.8 + + + + org.springframework.boot + spring-boot-starter-validation + + + com.fasterxml.jackson.core + jackson-databind + + + org.springframework.boot + spring-boot-starter-test + test + + + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/OpenApiGeneratorApplication.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/OpenApiGeneratorApplication.java new file mode 100644 index 000000000000..97252a8a9402 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/OpenApiGeneratorApplication.java @@ -0,0 +1,30 @@ +package org.openapitools; + +import com.fasterxml.jackson.databind.Module; +import org.openapitools.jackson.nullable.JsonNullableModule; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator; + +@SpringBootApplication( + nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class +) +@ComponentScan( + basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}, + nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class +) +public class OpenApiGeneratorApplication { + + public static void main(String[] args) { + SpringApplication.run(OpenApiGeneratorApplication.class, args); + } + + @Bean(name = "org.openapitools.OpenApiGeneratorApplication.jsonNullableModule") + public Module jsonNullableModule() { + return new JsonNullableModule(); + } + +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java new file mode 100644 index 000000000000..bcd3936d8b34 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -0,0 +1,38 @@ +package org.openapitools; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return this; + } +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/ApiUtil.java new file mode 100644 index 000000000000..7ed3b0ab28d9 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/ApiUtil.java @@ -0,0 +1,20 @@ +package org.openapitools.api; + +import java.nio.charset.StandardCharsets; +import org.springframework.core.io.buffer.DefaultDataBuffer; +import org.springframework.core.io.buffer.DefaultDataBufferFactory; +import org.springframework.http.MediaType; +import org.springframework.http.server.reactive.ServerHttpResponse; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +public class ApiUtil { + public static Mono getExampleResponse(ServerWebExchange exchange, MediaType mediaType, String example) { + ServerHttpResponse response = exchange.getResponse(); + response.getHeaders().setContentType(mediaType); + + byte[] exampleBytes = example.getBytes(StandardCharsets.UTF_8); + DefaultDataBuffer data = new DefaultDataBufferFactory().wrap(exampleBytes); + return response.writeWith(Mono.just(data)); + } +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApi.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApi.java new file mode 100644 index 000000000000..dfe00df5faf8 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApi.java @@ -0,0 +1,364 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.FormParamsRequest; +import org.openapitools.model.MultipartMixedRequestMarker; +import org.openapitools.model.MultipartMixedStatus; +import org.springframework.lang.Nullable; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import org.springframework.http.codec.multipart.Part; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Validated +@Tag(name = "coverage", description = "the coverage API") +public interface CoverageApi { + + String PATH_BINARY_BODY = "/coverage/binary"; + /** + * POST /coverage/binary + * + * @param body (required) + * @return No content (status code 204) + */ + @Operation( + operationId = "binaryBody", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_BINARY_BODY, + consumes = { "application/octet-stream" } + ) + default Mono> binaryBody( + @Parameter(name = "body", description = "", required = true) @Valid @RequestBody Mono body, + @Parameter(hidden = true) final ServerWebExchange exchange + ) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(body).then(Mono.empty()); + + } + + + String PATH_COOKIE_PARAMS = "/coverage/cookie"; + /** + * GET /coverage/cookie + * + * @param plain (optional) + * @param bytes (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "cookieParams", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = CoverageApi.PATH_COOKIE_PARAMS + ) + default Mono> cookieParams( + @Parameter(name = "plain", description = "", in = ParameterIn.COOKIE) @CookieValue(name = "plain", required = false) @Nullable String plain, + @Parameter(name = "bytes", description = "", in = ParameterIn.COOKIE) @CookieValue(name = "bytes", required = false) @Nullable String bytes /* base64 encoded binary */, + @Parameter(hidden = true) final ServerWebExchange exchange + ) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(Mono.empty()); + + } + + + String PATH_FORM_PARAMS = "/coverage/form"; + /** + * POST /coverage/form + * + * @param plain (optional) + * @param bytes (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "formParams", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_FORM_PARAMS, + consumes = { "application/x-www-form-urlencoded" } + ) + default Mono> formParams( + @Parameter(name = "plain", description = "") @Valid @RequestParam(value = "plain", required = false) String plain, + @Parameter(name = "bytes", description = "") @Valid @RequestParam(value = "bytes", required = false) String bytes /* base64 encoded binary */, + @Parameter(hidden = true) final ServerWebExchange exchange + ) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(Mono.empty()); + + } + + + String PATH_HEADER_PARAMS = "/coverage/header"; + /** + * GET /coverage/header + * + * @param xPlain (optional) + * @param xByte (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "headerParams", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = CoverageApi.PATH_HEADER_PARAMS + ) + default Mono> headerParams( + @Parameter(name = "X-Plain", description = "", in = ParameterIn.HEADER) @RequestHeader(value = "X-Plain", required = false) @Nullable String xPlain, + @Parameter(name = "X-Byte", description = "", in = ParameterIn.HEADER) @RequestHeader(value = "X-Byte", required = false) @Nullable String xByte /* base64 encoded binary */, + @Parameter(hidden = true) final ServerWebExchange exchange + ) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(Mono.empty()); + + } + + + String PATH_JSON_BODY = "/coverage/json"; + /** + * POST /coverage/json + * + * @param formParamsRequest (required) + * @return No content (status code 204) + */ + @Operation( + operationId = "jsonBody", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_JSON_BODY, + consumes = { "application/json" } + ) + default Mono> jsonBody( + @Parameter(name = "FormParamsRequest", description = "", required = true) @Valid @RequestBody Mono formParamsRequest, + @Parameter(hidden = true) final ServerWebExchange exchange + ) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(formParamsRequest).then(Mono.empty()); + + } + + + String PATH_MULTIPART_FILE_ARRAY = "/coverage/multipart/files"; + /** + * POST /coverage/multipart/files + * + * @param files (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "multipartFileArray", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_MULTIPART_FILE_ARRAY, + consumes = { "multipart/form-data" } + ) + default Mono> multipartFileArray( + @Parameter(name = "files", description = "") @RequestPart(value = "files", required = false) Flux files, + @Parameter(hidden = true) final ServerWebExchange exchange + ) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(Mono.empty()); + + } + + + String PATH_MULTIPART_MIXED = "/coverage/multipart/mixed"; + /** + * POST /coverage/multipart/mixed + * + * @param status (required) + * @param file (required) + * @param statusArray (optional) + * @param marker (optional) + * @param markerArray (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "multipartMixed", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_MULTIPART_MIXED, + consumes = { "multipart/form-data" } + ) + default Mono> multipartMixed( + @Parameter(name = "status", description = "", required = true) @Valid @RequestPart(value = "status", required = true) String /* MultipartMixedStatus */ status, + @Parameter(name = "file", description = "", required = true) @RequestPart(value = "file", required = true) Part file, + @Parameter(name = "statusArray", description = "") @Valid @RequestPart(value = "statusArray", required = false) Flux /* List */ statusArray, + @Parameter(name = "marker", description = "") @Valid @RequestPart(value = "marker", required = false) MultipartMixedRequestMarker marker, + @Parameter(name = "markerArray", description = "") @Valid @RequestPart(value = "markerArray", required = false) List<@Valid MultipartMixedRequestMarker> markerArray, + @Parameter(hidden = true) final ServerWebExchange exchange + ) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(Mono.empty()); + + } + + + String PATH_MULTIPART_SIMPLE = "/coverage/multipart/simple"; + /** + * POST /coverage/multipart/simple + * + * @param plain (optional) + * @param bytes (optional) + * @param file (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "multipartSimple", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_MULTIPART_SIMPLE, + consumes = { "multipart/form-data" } + ) + default Mono> multipartSimple( + @Parameter(name = "plain", description = "") @Valid @RequestPart(value = "plain", required = false) String plain, + @Parameter(name = "bytes", description = "") @Valid @RequestPart(value = "bytes", required = false) String bytes /* base64 encoded binary */, + @Parameter(name = "file", description = "") @RequestPart(value = "file", required = false) Part file, + @Parameter(hidden = true) final ServerWebExchange exchange + ) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(Mono.empty()); + + } + + + String PATH_PATH_PARAMS = "/coverage/path/{plain}/{bytes}"; + /** + * GET /coverage/path/{plain}/{bytes} + * + * @param plain (required) + * @param bytes (required) + * @return No content (status code 204) + */ + @Operation( + operationId = "pathParams", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = CoverageApi.PATH_PATH_PARAMS + ) + default Mono> pathParams( + @NotNull @Parameter(name = "plain", description = "", required = true, in = ParameterIn.PATH) @PathVariable("plain") String plain, + @NotNull @Parameter(name = "bytes", description = "", required = true, in = ParameterIn.PATH) @PathVariable("bytes") String bytes /* base64 encoded binary */, + @Parameter(hidden = true) final ServerWebExchange exchange + ) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(Mono.empty()); + + } + + + String PATH_QUERY_PARAMS = "/coverage/query"; + /** + * GET /coverage/query + * + * @param plain (optional) + * @param bytes (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "queryParams", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = CoverageApi.PATH_QUERY_PARAMS + ) + default Mono> queryParams( + @Parameter(name = "plain", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "plain", required = false) @Nullable String plain, + @Parameter(name = "bytes", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "bytes", required = false) @Nullable String bytes /* base64 encoded binary */, + @Parameter(hidden = true) final ServerWebExchange exchange + ) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(Mono.empty()); + + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiController.java new file mode 100644 index 000000000000..94468328668a --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiController.java @@ -0,0 +1,37 @@ +package org.openapitools.api; + +import org.openapitools.model.FormParamsRequest; +import org.openapitools.model.MultipartMixedRequestMarker; +import org.openapitools.model.MultipartMixedStatus; +import org.springframework.lang.Nullable; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.multipartByteEdgeCaseCoverage.base-path:}") +public class CoverageApiController implements CoverageApi { + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java new file mode 100644 index 000000000000..7c174fb2fd4d --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java @@ -0,0 +1,29 @@ +package org.openapitools.configuration; + +import org.openapitools.model.MultipartMixedStatus; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.converter.Converter; + +/** + * This class provides Spring Converter beans for the enum models in the OpenAPI specification. + * + * By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent + * correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than + * `original` or the specification has an integer enum. + */ +@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration") +public class EnumConverterConfiguration { + + @Bean(name = "org.openapitools.configuration.EnumConverterConfiguration.multipartMixedStatusConverter") + Converter multipartMixedStatusConverter() { + return new Converter() { + @Override + public MultipartMixedStatus convert(String source) { + return MultipartMixedStatus.fromValue(source); + } + }; + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/configuration/HomeController.java new file mode 100644 index 000000000000..cf658246a9de --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/configuration/HomeController.java @@ -0,0 +1,29 @@ +package org.openapitools.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.ServerResponse; +import java.net.URI; + +import static org.springframework.web.reactive.function.server.RequestPredicates.GET; +import static org.springframework.web.reactive.function.server.RouterFunctions.route; + +/** + * Home redirection to OpenAPI api documentation + */ +@Controller +public class HomeController { + + @Bean + RouterFunction index() { + return route( + GET("/"), + req -> ServerResponse.temporaryRedirect(URI.create("swagger-ui.html")).build() + ); + } + +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/FormParamsRequest.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/FormParamsRequest.java new file mode 100644 index 000000000000..45a6712a7e0f --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/FormParamsRequest.java @@ -0,0 +1,111 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Arrays; +import org.springframework.lang.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * FormParamsRequest + */ + +@JsonTypeName("formParams_request") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +public class FormParamsRequest { + + private @Nullable String plain; + + private @Nullable byte[] bytes; + + public FormParamsRequest plain(@Nullable String plain) { + this.plain = plain; + return this; + } + + /** + * Get plain + * @return plain + */ + + @Schema(name = "plain", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("plain") + public @Nullable String getPlain() { + return plain; + } + + public void setPlain(@Nullable String plain) { + this.plain = plain; + } + + public FormParamsRequest bytes(@Nullable byte[] bytes) { + this.bytes = bytes; + return this; + } + + /** + * Get bytes + * @return bytes + */ + + @Schema(name = "bytes", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("bytes") + public @Nullable byte[] getBytes() { + return bytes; + } + + public void setBytes(@Nullable byte[] bytes) { + this.bytes = bytes; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormParamsRequest formParamsRequest = (FormParamsRequest) o; + return Objects.equals(this.plain, formParamsRequest.plain) && + Arrays.equals(this.bytes, formParamsRequest.bytes); + } + + @Override + public int hashCode() { + return Objects.hash(plain, Arrays.hashCode(bytes)); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormParamsRequest {\n"); + sb.append(" plain: ").append(toIndentedString(plain)).append("\n"); + sb.append(" bytes: ").append(toIndentedString(bytes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java new file mode 100644 index 000000000000..6f25fa78d166 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java @@ -0,0 +1,143 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * MultipartMixedRequestMarker + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +public class MultipartMixedRequestMarker { + + private String name; + + private @Nullable Integer priority; + + private @Nullable Boolean active; + + public MultipartMixedRequestMarker() { + super(); + } + + /** + * Constructor with only required parameters + */ + public MultipartMixedRequestMarker(String name) { + this.name = name; + } + + public MultipartMixedRequestMarker name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @NotNull + @Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public MultipartMixedRequestMarker priority(@Nullable Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + */ + + @Schema(name = "priority", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("priority") + public @Nullable Integer getPriority() { + return priority; + } + + public void setPriority(@Nullable Integer priority) { + this.priority = priority; + } + + public MultipartMixedRequestMarker active(@Nullable Boolean active) { + this.active = active; + return this; + } + + /** + * Get active + * @return active + */ + + @Schema(name = "active", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("active") + public @Nullable Boolean getActive() { + return active; + } + + public void setActive(@Nullable Boolean active) { + this.active = active; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MultipartMixedRequestMarker multipartMixedRequestMarker = (MultipartMixedRequestMarker) o; + return Objects.equals(this.name, multipartMixedRequestMarker.name) && + Objects.equals(this.priority, multipartMixedRequestMarker.priority) && + Objects.equals(this.active, multipartMixedRequestMarker.active); + } + + @Override + public int hashCode() { + return Objects.hash(name, priority, active); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MultipartMixedRequestMarker {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" active: ").append(toIndentedString(active)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/MultipartMixedStatus.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/MultipartMixedStatus.java new file mode 100644 index 000000000000..dfddf2abaaf3 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/model/MultipartMixedStatus.java @@ -0,0 +1,58 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets MultipartMixedStatus + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +public enum MultipartMixedStatus { + + ALLOWED("ALLOWED"), + + IN_PROGRESS("IN_PROGRESS"), + + REJECTED("REJECTED"); + + private final String value; + + MultipartMixedStatus(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static MultipartMixedStatus fromValue(String value) { + for (MultipartMixedStatus b : MultipartMixedStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/application.properties b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/application.properties new file mode 100644 index 000000000000..7e90813e59b2 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/application.properties @@ -0,0 +1,3 @@ +server.port=8080 +spring.jackson.date-format=org.openapitools.RFC3339DateFormat +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/openapi.yaml new file mode 100644 index 000000000000..19d7b49be5b4 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/openapi.yaml @@ -0,0 +1,302 @@ +openapi: 3.0.3 +info: + title: Multipart & Byte Edge Case Coverage + version: 1.0.0 +servers: +- url: / +tags: +- name: coverage +paths: + /coverage/query: + get: + operationId: queryParams + parameters: + - explode: true + in: query + name: plain + required: false + schema: + type: string + style: form + - explode: true + in: query + name: bytes + required: false + schema: + format: byte + type: string + style: form + responses: + "204": + description: No content + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/path/{plain}/{bytes}: + get: + operationId: pathParams + parameters: + - explode: false + in: path + name: plain + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: bytes + required: true + schema: + format: byte + type: string + style: simple + responses: + "204": + description: No content + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/header: + get: + operationId: headerParams + parameters: + - explode: false + in: header + name: X-Plain + required: false + schema: + type: string + style: simple + - explode: false + in: header + name: X-Byte + required: false + schema: + format: byte + type: string + style: simple + responses: + "204": + description: No content + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/cookie: + get: + operationId: cookieParams + parameters: + - explode: true + in: cookie + name: plain + required: false + schema: + type: string + style: form + - explode: true + in: cookie + name: bytes + required: false + schema: + format: byte + type: string + style: form + responses: + "204": + description: No content + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/form: + post: + operationId: formParams + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/formParams_request" + required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/multipart/simple: + post: + operationId: multipartSimple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartSimple_request" + required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/multipart/files: + post: + operationId: multipartFileArray + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartFileArray_request" + responses: + "204": + description: No content + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/multipart/mixed: + post: + operationId: multipartMixed + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartMixed_request" + responses: + "204": + description: No content + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/json: + post: + operationId: jsonBody + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/formParams_request" + required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/binary: + post: + operationId: binaryBody + requestBody: + content: + application/octet-stream: + schema: + format: binary + type: string + required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: application/octet-stream + x-accepts: + - application/json + x-tags: + - tag: coverage +components: + schemas: + MultipartMixedStatus: + enum: + - ALLOWED + - IN_PROGRESS + - REJECTED + type: string + MultipartMixedRequestMarker: + properties: + name: + type: string + priority: + format: int32 + type: integer + active: + type: boolean + required: + - name + type: object + formParams_request: + properties: + plain: + type: string + bytes: + format: byte + type: string + type: object + multipartSimple_request: + properties: + plain: + type: string + bytes: + format: byte + type: string + file: + format: binary + type: string + type: object + multipartFileArray_request: + properties: + files: + items: + format: binary + type: string + type: array + type: object + multipartMixed_request: + properties: + status: + $ref: "#/components/schemas/MultipartMixedStatus" + statusArray: + items: + $ref: "#/components/schemas/MultipartMixedStatus" + type: array + marker: + $ref: "#/components/schemas/MultipartMixedRequestMarker" + markerArray: + items: + $ref: "#/components/schemas/MultipartMixedRequestMarker" + type: array + file: + format: binary + type: string + required: + - file + - status + type: object diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java new file mode 100644 index 000000000000..3681f67e7705 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java @@ -0,0 +1,13 @@ +package org.openapitools; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class OpenApiGeneratorApplicationTests { + + @Test + void contextLoads() { + } + +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES new file mode 100644 index 000000000000..4a548e5fada9 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES @@ -0,0 +1,15 @@ +README.md +pom.xml +src/main/java/org/openapitools/OpenApiGeneratorApplication.java +src/main/java/org/openapitools/RFC3339DateFormat.java +src/main/java/org/openapitools/api/ApiUtil.java +src/main/java/org/openapitools/api/CoverageApi.java +src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java +src/main/java/org/openapitools/configuration/HomeController.java +src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +src/main/java/org/openapitools/model/FormParamsRequest.java +src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java +src/main/java/org/openapitools/model/MultipartMixedStatus.java +src/main/resources/application.properties +src/main/resources/openapi.yaml +src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION new file mode 100644 index 000000000000..193a12d6e891 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.20.0-SNAPSHOT diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/README.md b/samples/server/petstore/springboot-byte-format-edge-cases/README.md new file mode 100644 index 000000000000..5cd22b6081a2 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/README.md @@ -0,0 +1,21 @@ +# OpenAPI generated server + +Spring Boot Server + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework. + + +The underlying library integrating OpenAPI to Spring Boot is [springdoc](https://springdoc.org). +Springdoc will generate an OpenAPI v3 specification based on the generated Controller and Model classes. +The specification is available to download using the following url: +http://localhost:8080/v3/api-docs/ + +Start your server as a simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/swagger-ui.html + +Change default port value in application.properties \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml b/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml new file mode 100644 index 000000000000..b3ab46e3b81f --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml @@ -0,0 +1,82 @@ + + 4.0.0 + org.openapitools + springboot + jar + springboot + 1.0.0-SNAPSHOT + + 1.8 + ${java.version} + ${java.version} + UTF-8 + 1.6.14 + 5.3.1 + + + org.springframework.boot + spring-boot-starter-parent + 2.7.15 + + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.data + spring-data-commons + + + + org.springdoc + springdoc-openapi-ui + ${springdoc.version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + org.openapitools + jackson-databind-nullable + 0.2.8 + + + + org.springframework.boot + spring-boot-starter-validation + + + com.fasterxml.jackson.core + jackson-databind + + + org.springframework.boot + spring-boot-starter-test + test + + + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java new file mode 100644 index 000000000000..97252a8a9402 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/OpenApiGeneratorApplication.java @@ -0,0 +1,30 @@ +package org.openapitools; + +import com.fasterxml.jackson.databind.Module; +import org.openapitools.jackson.nullable.JsonNullableModule; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator; + +@SpringBootApplication( + nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class +) +@ComponentScan( + basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}, + nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class +) +public class OpenApiGeneratorApplication { + + public static void main(String[] args) { + SpringApplication.run(OpenApiGeneratorApplication.class, args); + } + + @Bean(name = "org.openapitools.OpenApiGeneratorApplication.jsonNullableModule") + public Module jsonNullableModule() { + return new JsonNullableModule(); + } + +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java new file mode 100644 index 000000000000..bcd3936d8b34 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -0,0 +1,38 @@ +package org.openapitools; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return this; + } +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java new file mode 100644 index 000000000000..c03486e4081d --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/ApiUtil.java @@ -0,0 +1,21 @@ +package org.openapitools.api; + +import org.springframework.web.context.request.NativeWebRequest; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiUtil { + public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { + try { + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + if (res != null) { + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApi.java new file mode 100644 index 000000000000..3090dd906453 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApi.java @@ -0,0 +1,335 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.20.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import org.openapitools.model.FormParamsRequest; +import org.openapitools.model.MultipartMixedRequestMarker; +import org.openapitools.model.MultipartMixedStatus; +import org.springframework.lang.Nullable; +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Validated +@Tag(name = "coverage", description = "the coverage API") +public interface CoverageApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_BINARY_BODY = "/coverage/binary"; + /** + * POST /coverage/binary + * + * @param body (required) + * @return No content (status code 204) + */ + @Operation( + operationId = "binaryBody", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_BINARY_BODY, + consumes = { "application/octet-stream" } + ) + default ResponseEntity binaryBody( + @Parameter(name = "body", description = "", required = true) @Valid @RequestBody org.springframework.core.io.Resource body + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + String PATH_COOKIE_PARAMS = "/coverage/cookie"; + /** + * GET /coverage/cookie + * + * @param plain (optional) + * @param bytes (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "cookieParams", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = CoverageApi.PATH_COOKIE_PARAMS + ) + default ResponseEntity cookieParams( + @Parameter(name = "plain", description = "", in = ParameterIn.COOKIE) @CookieValue(name = "plain", required = false) @Nullable String plain, + @Parameter(name = "bytes", description = "", in = ParameterIn.COOKIE) @CookieValue(name = "bytes", required = false) @Nullable String bytes /* base64 encoded binary */ + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + String PATH_FORM_PARAMS = "/coverage/form"; + /** + * POST /coverage/form + * + * @param plain (optional) + * @param bytes (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "formParams", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_FORM_PARAMS, + consumes = { "application/x-www-form-urlencoded" } + ) + default ResponseEntity formParams( + @Parameter(name = "plain", description = "") @Valid @RequestParam(value = "plain", required = false) String plain, + @Parameter(name = "bytes", description = "") @Valid @RequestParam(value = "bytes", required = false) String bytes /* base64 encoded binary */ + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + String PATH_HEADER_PARAMS = "/coverage/header"; + /** + * GET /coverage/header + * + * @param xPlain (optional) + * @param xByte (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "headerParams", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = CoverageApi.PATH_HEADER_PARAMS + ) + default ResponseEntity headerParams( + @Parameter(name = "X-Plain", description = "", in = ParameterIn.HEADER) @RequestHeader(value = "X-Plain", required = false) @Nullable String xPlain, + @Parameter(name = "X-Byte", description = "", in = ParameterIn.HEADER) @RequestHeader(value = "X-Byte", required = false) @Nullable String xByte /* base64 encoded binary */ + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + String PATH_JSON_BODY = "/coverage/json"; + /** + * POST /coverage/json + * + * @param formParamsRequest (required) + * @return No content (status code 204) + */ + @Operation( + operationId = "jsonBody", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_JSON_BODY, + consumes = { "application/json" } + ) + default ResponseEntity jsonBody( + @Parameter(name = "FormParamsRequest", description = "", required = true) @Valid @RequestBody FormParamsRequest formParamsRequest + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + String PATH_MULTIPART_FILE_ARRAY = "/coverage/multipart/files"; + /** + * POST /coverage/multipart/files + * + * @param files (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "multipartFileArray", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_MULTIPART_FILE_ARRAY, + consumes = { "multipart/form-data" } + ) + default ResponseEntity multipartFileArray( + @Parameter(name = "files", description = "") @RequestPart(value = "files", required = false) List files + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + String PATH_MULTIPART_MIXED = "/coverage/multipart/mixed"; + /** + * POST /coverage/multipart/mixed + * + * @param status (required) + * @param file (required) + * @param statusArray (optional) + * @param marker (optional) + * @param markerArray (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "multipartMixed", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_MULTIPART_MIXED, + consumes = { "multipart/form-data" } + ) + default ResponseEntity multipartMixed( + @Parameter(name = "status", description = "", required = true) @Valid @RequestParam(value = "status", required = true) MultipartMixedStatus status, + @Parameter(name = "file", description = "", required = true) @RequestPart(value = "file", required = true) MultipartFile file, + @Parameter(name = "statusArray", description = "") @Valid @RequestParam(value = "statusArray", required = false) List statusArray, + @Parameter(name = "marker", description = "") @Valid @RequestPart(value = "marker", required = false) MultipartMixedRequestMarker marker, + @Parameter(name = "markerArray", description = "") @Valid @RequestPart(value = "markerArray", required = false) List<@Valid MultipartMixedRequestMarker> markerArray + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + String PATH_MULTIPART_SIMPLE = "/coverage/multipart/simple"; + /** + * POST /coverage/multipart/simple + * + * @param plain (optional) + * @param bytes (optional) + * @param file (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "multipartSimple", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_MULTIPART_SIMPLE, + consumes = { "multipart/form-data" } + ) + default ResponseEntity multipartSimple( + @Parameter(name = "plain", description = "") @Valid @RequestParam(value = "plain", required = false) String plain, + @Parameter(name = "bytes", description = "") @Valid @RequestParam(value = "bytes", required = false) String bytes /* base64 encoded binary */, + @Parameter(name = "file", description = "") @RequestPart(value = "file", required = false) MultipartFile file + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + String PATH_PATH_PARAMS = "/coverage/path/{plain}/{bytes}"; + /** + * GET /coverage/path/{plain}/{bytes} + * + * @param plain (required) + * @param bytes (required) + * @return No content (status code 204) + */ + @Operation( + operationId = "pathParams", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = CoverageApi.PATH_PATH_PARAMS + ) + default ResponseEntity pathParams( + @NotNull @Parameter(name = "plain", description = "", required = true, in = ParameterIn.PATH) @PathVariable("plain") String plain, + @NotNull @Parameter(name = "bytes", description = "", required = true, in = ParameterIn.PATH) @PathVariable("bytes") String bytes /* base64 encoded binary */ + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + String PATH_QUERY_PARAMS = "/coverage/query"; + /** + * GET /coverage/query + * + * @param plain (optional) + * @param bytes (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "queryParams", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = CoverageApi.PATH_QUERY_PARAMS + ) + default ResponseEntity queryParams( + @Parameter(name = "plain", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "plain", required = false) @Nullable String plain, + @Parameter(name = "bytes", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "bytes", required = false) @Nullable String bytes /* base64 encoded binary */ + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiController.java new file mode 100644 index 000000000000..8f7a163ebb9a --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiController.java @@ -0,0 +1,49 @@ +package org.openapitools.api; + +import org.openapitools.model.FormParamsRequest; +import org.openapitools.model.MultipartMixedRequestMarker; +import org.openapitools.model.MultipartMixedStatus; +import org.springframework.lang.Nullable; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +@Controller +@RequestMapping("${openapi.multipartByteEdgeCaseCoverage.base-path:}") +public class CoverageApiController implements CoverageApi { + + private final NativeWebRequest request; + + @Autowired + public CoverageApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java new file mode 100644 index 000000000000..7c174fb2fd4d --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java @@ -0,0 +1,29 @@ +package org.openapitools.configuration; + +import org.openapitools.model.MultipartMixedStatus; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.converter.Converter; + +/** + * This class provides Spring Converter beans for the enum models in the OpenAPI specification. + * + * By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent + * correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than + * `original` or the specification has an integer enum. + */ +@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration") +public class EnumConverterConfiguration { + + @Bean(name = "org.openapitools.configuration.EnumConverterConfiguration.multipartMixedStatusConverter") + Converter multipartMixedStatusConverter() { + return new Converter() { + @Override + public MultipartMixedStatus convert(String source) { + return MultipartMixedStatus.fromValue(source); + } + }; + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java new file mode 100644 index 000000000000..9aa29284ab5f --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/HomeController.java @@ -0,0 +1,20 @@ +package org.openapitools.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.GetMapping; + +/** + * Home redirection to OpenAPI api documentation + */ +@Controller +public class HomeController { + + @RequestMapping("/") + public String index() { + return "redirect:swagger-ui.html"; + } + +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java new file mode 100644 index 000000000000..656402210dcd --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java @@ -0,0 +1,27 @@ +package org.openapitools.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.Contact; +import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.security.SecurityScheme; + +@Configuration +public class SpringDocConfiguration { + + @Bean(name = "org.openapitools.configuration.SpringDocConfiguration.apiInfo") + OpenAPI apiInfo() { + return new OpenAPI() + .info( + new Info() + .title("Multipart & Byte Edge Case Coverage") + .description("No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)") + .version("1.0.0") + ) + ; + } +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java new file mode 100644 index 000000000000..45a6712a7e0f --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/FormParamsRequest.java @@ -0,0 +1,111 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Arrays; +import org.springframework.lang.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * FormParamsRequest + */ + +@JsonTypeName("formParams_request") +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +public class FormParamsRequest { + + private @Nullable String plain; + + private @Nullable byte[] bytes; + + public FormParamsRequest plain(@Nullable String plain) { + this.plain = plain; + return this; + } + + /** + * Get plain + * @return plain + */ + + @Schema(name = "plain", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("plain") + public @Nullable String getPlain() { + return plain; + } + + public void setPlain(@Nullable String plain) { + this.plain = plain; + } + + public FormParamsRequest bytes(@Nullable byte[] bytes) { + this.bytes = bytes; + return this; + } + + /** + * Get bytes + * @return bytes + */ + + @Schema(name = "bytes", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("bytes") + public @Nullable byte[] getBytes() { + return bytes; + } + + public void setBytes(@Nullable byte[] bytes) { + this.bytes = bytes; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormParamsRequest formParamsRequest = (FormParamsRequest) o; + return Objects.equals(this.plain, formParamsRequest.plain) && + Arrays.equals(this.bytes, formParamsRequest.bytes); + } + + @Override + public int hashCode() { + return Objects.hash(plain, Arrays.hashCode(bytes)); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormParamsRequest {\n"); + sb.append(" plain: ").append(toIndentedString(plain)).append("\n"); + sb.append(" bytes: ").append(toIndentedString(bytes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java new file mode 100644 index 000000000000..6f25fa78d166 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java @@ -0,0 +1,143 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import org.springframework.lang.Nullable; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +/** + * MultipartMixedRequestMarker + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +public class MultipartMixedRequestMarker { + + private String name; + + private @Nullable Integer priority; + + private @Nullable Boolean active; + + public MultipartMixedRequestMarker() { + super(); + } + + /** + * Constructor with only required parameters + */ + public MultipartMixedRequestMarker(String name) { + this.name = name; + } + + public MultipartMixedRequestMarker name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @NotNull + @Schema(name = "name", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonProperty("name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public MultipartMixedRequestMarker priority(@Nullable Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + */ + + @Schema(name = "priority", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("priority") + public @Nullable Integer getPriority() { + return priority; + } + + public void setPriority(@Nullable Integer priority) { + this.priority = priority; + } + + public MultipartMixedRequestMarker active(@Nullable Boolean active) { + this.active = active; + return this; + } + + /** + * Get active + * @return active + */ + + @Schema(name = "active", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("active") + public @Nullable Boolean getActive() { + return active; + } + + public void setActive(@Nullable Boolean active) { + this.active = active; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MultipartMixedRequestMarker multipartMixedRequestMarker = (MultipartMixedRequestMarker) o; + return Objects.equals(this.name, multipartMixedRequestMarker.name) && + Objects.equals(this.priority, multipartMixedRequestMarker.priority) && + Objects.equals(this.active, multipartMixedRequestMarker.active); + } + + @Override + public int hashCode() { + return Objects.hash(name, priority, active); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MultipartMixedRequestMarker {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" active: ").append(toIndentedString(active)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(@Nullable Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/MultipartMixedStatus.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/MultipartMixedStatus.java new file mode 100644 index 000000000000..dfddf2abaaf3 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/model/MultipartMixedStatus.java @@ -0,0 +1,58 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; +import io.swagger.v3.oas.annotations.media.Schema; + + +import java.util.*; +import javax.annotation.Generated; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets MultipartMixedStatus + */ + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") +public enum MultipartMixedStatus { + + ALLOWED("ALLOWED"), + + IN_PROGRESS("IN_PROGRESS"), + + REJECTED("REJECTED"); + + private final String value; + + MultipartMixedStatus(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static MultipartMixedStatus fromValue(String value) { + for (MultipartMixedStatus b : MultipartMixedStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties new file mode 100644 index 000000000000..7e90813e59b2 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/application.properties @@ -0,0 +1,3 @@ +server.port=8080 +spring.jackson.date-format=org.openapitools.RFC3339DateFormat +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml new file mode 100644 index 000000000000..19d7b49be5b4 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml @@ -0,0 +1,302 @@ +openapi: 3.0.3 +info: + title: Multipart & Byte Edge Case Coverage + version: 1.0.0 +servers: +- url: / +tags: +- name: coverage +paths: + /coverage/query: + get: + operationId: queryParams + parameters: + - explode: true + in: query + name: plain + required: false + schema: + type: string + style: form + - explode: true + in: query + name: bytes + required: false + schema: + format: byte + type: string + style: form + responses: + "204": + description: No content + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/path/{plain}/{bytes}: + get: + operationId: pathParams + parameters: + - explode: false + in: path + name: plain + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: bytes + required: true + schema: + format: byte + type: string + style: simple + responses: + "204": + description: No content + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/header: + get: + operationId: headerParams + parameters: + - explode: false + in: header + name: X-Plain + required: false + schema: + type: string + style: simple + - explode: false + in: header + name: X-Byte + required: false + schema: + format: byte + type: string + style: simple + responses: + "204": + description: No content + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/cookie: + get: + operationId: cookieParams + parameters: + - explode: true + in: cookie + name: plain + required: false + schema: + type: string + style: form + - explode: true + in: cookie + name: bytes + required: false + schema: + format: byte + type: string + style: form + responses: + "204": + description: No content + tags: + - coverage + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/form: + post: + operationId: formParams + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/formParams_request" + required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/multipart/simple: + post: + operationId: multipartSimple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartSimple_request" + required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/multipart/files: + post: + operationId: multipartFileArray + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartFileArray_request" + responses: + "204": + description: No content + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/multipart/mixed: + post: + operationId: multipartMixed + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartMixed_request" + responses: + "204": + description: No content + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/json: + post: + operationId: jsonBody + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/formParams_request" + required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: application/json + x-accepts: + - application/json + x-tags: + - tag: coverage + /coverage/binary: + post: + operationId: binaryBody + requestBody: + content: + application/octet-stream: + schema: + format: binary + type: string + required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: application/octet-stream + x-accepts: + - application/json + x-tags: + - tag: coverage +components: + schemas: + MultipartMixedStatus: + enum: + - ALLOWED + - IN_PROGRESS + - REJECTED + type: string + MultipartMixedRequestMarker: + properties: + name: + type: string + priority: + format: int32 + type: integer + active: + type: boolean + required: + - name + type: object + formParams_request: + properties: + plain: + type: string + bytes: + format: byte + type: string + type: object + multipartSimple_request: + properties: + plain: + type: string + bytes: + format: byte + type: string + file: + format: binary + type: string + type: object + multipartFileArray_request: + properties: + files: + items: + format: binary + type: string + type: array + type: object + multipartMixed_request: + properties: + status: + $ref: "#/components/schemas/MultipartMixedStatus" + statusArray: + items: + $ref: "#/components/schemas/MultipartMixedStatus" + type: array + marker: + $ref: "#/components/schemas/MultipartMixedRequestMarker" + markerArray: + items: + $ref: "#/components/schemas/MultipartMixedRequestMarker" + type: array + file: + format: binary + type: string + required: + - file + - status + type: object diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java new file mode 100644 index 000000000000..3681f67e7705 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java @@ -0,0 +1,13 @@ +package org.openapitools; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class OpenApiGeneratorApplicationTests { + + @Test + void contextLoads() { + } + +} \ No newline at end of file From 60780a16a4ad2a1ef6dd8ebb2c60a1541282b8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 12 Feb 2026 18:03:46 +0100 Subject: [PATCH 25/28] add api endpoint for tests and update samples --- .../3_0/spring/byte-format-edge-cases.yaml | 19 +++++++++++ .../org/openapitools/api/CoverageApi.java | 34 +++++++++++++++++++ .../src/main/resources/openapi.yaml | 19 +++++++++++ .../org/openapitools/api/CoverageApi.java | 31 +++++++++++++++++ .../src/main/resources/openapi.yaml | 19 +++++++++++ 5 files changed, 122 insertions(+) diff --git a/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml index b8a197a2c481..ef9a298b1601 100644 --- a/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/spring/byte-format-edge-cases.yaml @@ -157,6 +157,25 @@ paths: - application/json x-tags: - tag: coverage + /coverage/multipart/simple-validated: + post: + operationId: multipartSimpleValidated + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartSimple_request" + required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage /coverage/multipart/files: post: operationId: multipartFileArray diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApi.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApi.java index dfe00df5faf8..df4a1aa669ac 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApi.java +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApi.java @@ -300,6 +300,40 @@ default Mono> multipartSimple( } + String PATH_MULTIPART_SIMPLE_VALIDATED = "/coverage/multipart/simple-validated"; + /** + * POST /coverage/multipart/simple-validated + * + * @param plain (optional) + * @param bytes (optional) + * @param file (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "multipartSimpleValidated", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_MULTIPART_SIMPLE_VALIDATED, + consumes = { "multipart/form-data" } + ) + default Mono> multipartSimpleValidated( + @Parameter(name = "plain", description = "") @Valid @RequestPart(value = "plain", required = false) String plain, + @Parameter(name = "bytes", description = "") @Valid @RequestPart(value = "bytes", required = false) String bytes /* base64 encoded binary */, + @Parameter(name = "file", description = "") @RequestPart(value = "file", required = false) Part file, + @Parameter(hidden = true) final ServerWebExchange exchange + ) { + Mono result = Mono.empty(); + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + return result.then(Mono.empty()); + + } + + String PATH_PATH_PARAMS = "/coverage/path/{plain}/{bytes}"; /** * GET /coverage/path/{plain}/{bytes} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/openapi.yaml index 19d7b49be5b4..0fdcb1301243 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/resources/openapi.yaml @@ -157,6 +157,25 @@ paths: - application/json x-tags: - tag: coverage + /coverage/multipart/simple-validated: + post: + operationId: multipartSimpleValidated + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartSimple_request" + required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage /coverage/multipart/files: post: operationId: multipartFileArray diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApi.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApi.java index 3090dd906453..f173d0b7340d 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApi.java +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApi.java @@ -277,6 +277,37 @@ default ResponseEntity multipartSimple( } + String PATH_MULTIPART_SIMPLE_VALIDATED = "/coverage/multipart/simple-validated"; + /** + * POST /coverage/multipart/simple-validated + * + * @param plain (optional) + * @param bytes (optional) + * @param file (optional) + * @return No content (status code 204) + */ + @Operation( + operationId = "multipartSimpleValidated", + tags = { "coverage" }, + responses = { + @ApiResponse(responseCode = "204", description = "No content") + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = CoverageApi.PATH_MULTIPART_SIMPLE_VALIDATED, + consumes = { "multipart/form-data" } + ) + default ResponseEntity multipartSimpleValidated( + @Parameter(name = "plain", description = "") @Valid @RequestParam(value = "plain", required = false) String plain, + @Parameter(name = "bytes", description = "") @Valid @RequestParam(value = "bytes", required = false) String bytes /* base64 encoded binary */, + @Parameter(name = "file", description = "") @RequestPart(value = "file", required = false) MultipartFile file + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + String PATH_PATH_PARAMS = "/coverage/path/{plain}/{bytes}"; /** * GET /coverage/path/{plain}/{bytes} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml index 19d7b49be5b4..0fdcb1301243 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/resources/openapi.yaml @@ -157,6 +157,25 @@ paths: - application/json x-tags: - tag: coverage + /coverage/multipart/simple-validated: + post: + operationId: multipartSimpleValidated + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/multipartSimple_request" + required: true + responses: + "204": + description: No content + tags: + - coverage + x-content-type: multipart/form-data + x-accepts: + - application/json + x-tags: + - tag: coverage /coverage/multipart/files: post: operationId: multipartFileArray From 879439e16de1ed0bc271e626b0e536c5411610a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 12 Feb 2026 18:12:19 +0100 Subject: [PATCH 26/28] update samples --- ...-boot-byte-format-edge-cases-reactive.yaml | 2 + .../spring-boot-byte-format-edge-cases.yaml | 2 + .../.openapi-generator/FILES | 6 --- .../README.md | 34 +++++++------ .../pom.xml | 14 ++++-- .../api/CoverageApiController.java | 37 -------------- .../.openapi-generator/FILES | 7 --- .../README.md | 34 +++++++------ .../springboot-byte-format-edge-cases/pom.xml | 14 ++++-- .../api/CoverageApiController.java | 49 ------------------- 10 files changed, 64 insertions(+), 135 deletions(-) delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiController.java delete mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiController.java diff --git a/bin/configs/spring-boot-byte-format-edge-cases-reactive.yaml b/bin/configs/spring-boot-byte-format-edge-cases-reactive.yaml index 9ec8439832a0..b4a874f984a3 100644 --- a/bin/configs/spring-boot-byte-format-edge-cases-reactive.yaml +++ b/bin/configs/spring-boot-byte-format-edge-cases-reactive.yaml @@ -7,3 +7,5 @@ additionalProperties: snapshotVersion: "true" hideGenerationTimestamp: "true" reactive: true + interfaceOnly: "true" + requestMappingMode: "none" diff --git a/bin/configs/spring-boot-byte-format-edge-cases.yaml b/bin/configs/spring-boot-byte-format-edge-cases.yaml index 21bbbc44b39c..4dec629decf8 100644 --- a/bin/configs/spring-boot-byte-format-edge-cases.yaml +++ b/bin/configs/spring-boot-byte-format-edge-cases.yaml @@ -6,3 +6,5 @@ additionalProperties: artifactId: springboot snapshotVersion: "true" hideGenerationTimestamp: "true" + interfaceOnly: "true" + requestMappingMode: "none" diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/FILES b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/FILES index c8cfed159154..7e2ea15534aa 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/.openapi-generator/FILES @@ -1,14 +1,8 @@ README.md pom.xml -src/main/java/org/openapitools/OpenApiGeneratorApplication.java -src/main/java/org/openapitools/RFC3339DateFormat.java src/main/java/org/openapitools/api/ApiUtil.java src/main/java/org/openapitools/api/CoverageApi.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java -src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/model/FormParamsRequest.java src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java src/main/java/org/openapitools/model/MultipartMixedStatus.java -src/main/resources/application.properties -src/main/resources/openapi.yaml -src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/README.md b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/README.md index 5cd22b6081a2..d43a1de307df 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/README.md +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/README.md @@ -1,21 +1,27 @@ -# OpenAPI generated server -Spring Boot Server +# OpenAPI generated API stub -## Overview -This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. -By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. -This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework. +Spring Framework stub -The underlying library integrating OpenAPI to Spring Boot is [springdoc](https://springdoc.org). -Springdoc will generate an OpenAPI v3 specification based on the generated Controller and Model classes. -The specification is available to download using the following url: -http://localhost:8080/v3/api-docs/ +## Overview +This code was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://openapis.org), you can easily generate an API stub. +This is an example of building API stub interfaces in Java using the Spring framework. -Start your server as a simple java application +The stubs generated can be used in your existing Spring-MVC or Spring-Boot application to create controller endpoints +by adding ```@Controller``` classes that implement the interface. Eg: +```java +@Controller +public class PetController implements PetApi { +// implement all PetApi methods +} +``` -You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/swagger-ui.html +You can also use the interface to create [Spring-Cloud Feign clients](http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance).Eg: +```java +@FeignClient(name="pet", url="http://petstore.swagger.io/v2") +public interface PetClient extends PetApi { -Change default port value in application.properties \ No newline at end of file +} +``` diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/pom.xml b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/pom.xml index 699d3685ba27..439b85f5ce56 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/pom.xml +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/pom.xml @@ -23,10 +23,16 @@ src/main/java - org.springframework.boot - spring-boot-maven-plugin - - + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiController.java deleted file mode 100644 index 94468328668a..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiController.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapitools.api; - -import org.openapitools.model.FormParamsRequest; -import org.openapitools.model.MultipartMixedRequestMarker; -import org.openapitools.model.MultipartMixedStatus; -import org.springframework.lang.Nullable; - - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.context.request.NativeWebRequest; - -import javax.validation.constraints.*; -import javax.validation.Valid; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Controller -@RequestMapping("${openapi.multipartByteEdgeCaseCoverage.base-path:}") -public class CoverageApiController implements CoverageApi { - -} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES index 4a548e5fada9..7e2ea15534aa 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES +++ b/samples/server/petstore/springboot-byte-format-edge-cases/.openapi-generator/FILES @@ -1,15 +1,8 @@ README.md pom.xml -src/main/java/org/openapitools/OpenApiGeneratorApplication.java -src/main/java/org/openapitools/RFC3339DateFormat.java src/main/java/org/openapitools/api/ApiUtil.java src/main/java/org/openapitools/api/CoverageApi.java src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java -src/main/java/org/openapitools/configuration/HomeController.java -src/main/java/org/openapitools/configuration/SpringDocConfiguration.java src/main/java/org/openapitools/model/FormParamsRequest.java src/main/java/org/openapitools/model/MultipartMixedRequestMarker.java src/main/java/org/openapitools/model/MultipartMixedStatus.java -src/main/resources/application.properties -src/main/resources/openapi.yaml -src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/README.md b/samples/server/petstore/springboot-byte-format-edge-cases/README.md index 5cd22b6081a2..d43a1de307df 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases/README.md +++ b/samples/server/petstore/springboot-byte-format-edge-cases/README.md @@ -1,21 +1,27 @@ -# OpenAPI generated server -Spring Boot Server +# OpenAPI generated API stub -## Overview -This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. -By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. -This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework. +Spring Framework stub -The underlying library integrating OpenAPI to Spring Boot is [springdoc](https://springdoc.org). -Springdoc will generate an OpenAPI v3 specification based on the generated Controller and Model classes. -The specification is available to download using the following url: -http://localhost:8080/v3/api-docs/ +## Overview +This code was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://openapis.org), you can easily generate an API stub. +This is an example of building API stub interfaces in Java using the Spring framework. -Start your server as a simple java application +The stubs generated can be used in your existing Spring-MVC or Spring-Boot application to create controller endpoints +by adding ```@Controller``` classes that implement the interface. Eg: +```java +@Controller +public class PetController implements PetApi { +// implement all PetApi methods +} +``` -You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/swagger-ui.html +You can also use the interface to create [Spring-Cloud Feign clients](http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance).Eg: +```java +@FeignClient(name="pet", url="http://petstore.swagger.io/v2") +public interface PetClient extends PetApi { -Change default port value in application.properties \ No newline at end of file +} +``` diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml b/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml index b3ab46e3b81f..37aba04fbe66 100644 --- a/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml +++ b/samples/server/petstore/springboot-byte-format-edge-cases/pom.xml @@ -23,10 +23,16 @@ src/main/java - org.springframework.boot - spring-boot-maven-plugin - - + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiController.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiController.java deleted file mode 100644 index 8f7a163ebb9a..000000000000 --- a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiController.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.openapitools.api; - -import org.openapitools.model.FormParamsRequest; -import org.openapitools.model.MultipartMixedRequestMarker; -import org.openapitools.model.MultipartMixedStatus; -import org.springframework.lang.Nullable; - - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.CookieValue; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.context.request.NativeWebRequest; - -import javax.validation.constraints.*; -import javax.validation.Valid; - -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Generated; - -@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.20.0-SNAPSHOT") -@Controller -@RequestMapping("${openapi.multipartByteEdgeCaseCoverage.base-path:}") -public class CoverageApiController implements CoverageApi { - - private final NativeWebRequest request; - - @Autowired - public CoverageApiController(NativeWebRequest request) { - this.request = request; - } - - @Override - public Optional getRequest() { - return Optional.ofNullable(request); - } - -} From 6170b60d1e1558cd01c828048f3924ab23d97646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 12 Feb 2026 18:35:47 +0100 Subject: [PATCH 27/28] update samples and add tests --- .../api/CoverageApiTestControllerImpl.java | 415 ++++++++++++++++++ .../api/CoverageApiIntegrationTest.java | 346 +++++++++++++++ .../api/CoverageApiTestControllerImpl.java | 248 +++++++++++ .../api/CoverageApiIntegrationTest.java | 275 ++++++++++++ 4 files changed, 1284 insertions(+) create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/test/java/org/openapitools/api/CoverageApiIntegrationTest.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java create mode 100644 samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/api/CoverageApiIntegrationTest.java diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java new file mode 100644 index 000000000000..3e0edc078b84 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java @@ -0,0 +1,415 @@ +// manually created counterpart to unit tests. Do not delete! +package org.openapitools.api; + +import org.openapitools.model.FormParamsRequest; +import org.openapitools.model.MultipartMixedRequestMarker; +import org.openapitools.model.MultipartMixedStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Base64; +import java.util.List; + +import org.springframework.core.io.Resource; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.http.codec.multipart.Part; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.server.ServerWebExchange; + +@Controller +@RequestMapping("${openapi.multipartByteEdgeCaseCoverage.base-path:}") +public class CoverageApiTestControllerImpl implements CoverageApi { + + private static final Logger logger = LoggerFactory.getLogger(CoverageApiTestControllerImpl.class); + + // Expected content for binary data verification - matches test constants + private static final byte[] EXPECTED_BYTES = "hello".getBytes(StandardCharsets.UTF_8); + private static final String EXPECTED_BYTES_STRING = "hello"; + + private Mono verifyBytesContent(byte[] actual, String fieldName) { + if (!Arrays.equals(EXPECTED_BYTES, actual)) { + String actualString = new String(actual, StandardCharsets.UTF_8); + String errorMsg = fieldName + " content mismatch: expected '" + EXPECTED_BYTES_STRING + "', got '" + actualString + "'"; + logger.warn("Validation failed: {}", errorMsg); + return Mono.error(new IllegalArgumentException(errorMsg)); + } + logger.debug("Bytes verification passed for field: {}", fieldName); + return Mono.empty(); + } + + private Mono verifyBase64Content(String base64Value, String fieldName) { + try { + byte[] decoded = Base64.getDecoder().decode(base64Value); + logger.debug("Base64 decoded successfully for field: {}", fieldName); + return verifyBytesContent(decoded, fieldName); + } catch (IllegalArgumentException e) { + logger.warn("Invalid base64 in field {}: {}", fieldName, e.getMessage()); + return Mono.error(new IllegalArgumentException("Invalid base64 in " + fieldName, e)); + } + } + + @Override + public Mono> binaryBody( + Mono body, + ServerWebExchange exchange + ) { + return body.flatMap(resource -> { + if (resource == null) { + return Mono.error(new IllegalArgumentException("body is required")); + } + return Mono.fromCallable(() -> { + try { + byte[] content = readAllBytes(resource.getInputStream()); + if (content.length == 0) { + throw new IllegalArgumentException("body content is empty"); + } + return content; + } catch (IOException e) { + throw new RuntimeException("Failed to read binary body", e); + } + }).flatMap(content -> verifyBytesContent(content, "body")); + }).then(Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT))) + .onErrorResume(e -> { + exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + return Mono.error(e); + }); + } + + private byte[] readAllBytes(InputStream inputStream) throws IOException { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int nRead; + byte[] data = new byte[1024]; + while ((nRead = inputStream.read(data, 0, data.length)) != -1) { + buffer.write(data, 0, nRead); + } + buffer.flush(); + return buffer.toByteArray(); + } + + @Override + public Mono> cookieParams( + String plain, + String bytes, + ServerWebExchange exchange + ) { + if (bytes != null) { + return verifyBase64Content(bytes, "bytes") + .then(Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT))) + .onErrorResume(e -> { + exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + return Mono.error(e); + }); + } + return Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT)); + } + + @Override + public Mono> formParams( + String plain, + String bytes, + ServerWebExchange exchange + ) { + if (bytes != null) { + return verifyBase64Content(bytes, "bytes") + .then(Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT))) + .onErrorResume(e -> { + exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + return Mono.error(e); + }); + } + return Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT)); + } + + @Override + public Mono> headerParams( + String xPlain, + String xByte, + ServerWebExchange exchange + ) { + if (xByte != null) { + return verifyBase64Content(xByte, "X-Byte") + .then(Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT))) + .onErrorResume(e -> { + exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + return Mono.error(e); + }); + } + return Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT)); + } + + @Override + public Mono> jsonBody( + Mono formParamsRequest, + ServerWebExchange exchange + ) { + return formParamsRequest.flatMap(request -> { + if (request == null) { + return Mono.error(new IllegalArgumentException("formParamsRequest is required")); + } + byte[] bytes = request.getBytes(); + if (bytes != null) { + return verifyBytesContent(bytes, "bytes"); + } + return Mono.empty(); + }).then(Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT))) + .onErrorResume(e -> { + exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + return Mono.error(e); + }); + } + + @Override + public Mono> multipartFileArray( + Flux files, + ServerWebExchange exchange + ) { + // Expected content for each file in the array - matches test constants + String[] expectedContents = { "content1", "content2", "content3" }; + + if (files == null) { + return Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT)); + } + + return files.collectList().flatMap(partList -> { + return Flux.range(0, partList.size()) + .flatMap(i -> { + Part part = partList.get(i); + return part.content() + .collectList() + .flatMap(buffers -> { + byte[] content = new byte[buffers.stream().mapToInt(b -> b.readableByteCount()).sum()]; + int offset = 0; + for (DataBuffer buffer : buffers) { + int readable = buffer.readableByteCount(); + buffer.read(content, offset, readable); + offset += readable; + } + + if (content.length == 0) { + return Mono.error(new IllegalArgumentException("files[" + i + "] content is empty")); + } + + if (i < expectedContents.length) { + byte[] expected = expectedContents[i].getBytes(StandardCharsets.UTF_8); + if (!Arrays.equals(expected, content)) { + String actualString = new String(content, StandardCharsets.UTF_8); + return Mono.error(new IllegalArgumentException( + "files[" + i + "] content mismatch: expected '" + expectedContents[i] + "', got '" + actualString + "'")); + } + } + return Mono.empty(); + }); + }) + .then(Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT))); + }).onErrorResume(e -> { + exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + return Mono.error(e); + }); + } + + @Override + public Mono> multipartMixed( + String status, + Part file, + Flux statusArray, + MultipartMixedRequestMarker marker, + List markerArray, + ServerWebExchange exchange + ) { + if (status == null) { + return Mono.error(new IllegalArgumentException("status is required")); + } + if (file == null) { + return Mono.error(new IllegalArgumentException("file is required")); + } + + // Verify enum value is valid + MultipartMixedStatus enumStatus = MultipartMixedStatus.fromValue(status); + if (enumStatus == null) { + return Mono.error(new IllegalArgumentException("status value is invalid: " + status)); + } + String reconstructedStatus = enumStatus.getValue(); + if (reconstructedStatus == null || reconstructedStatus.isEmpty()) { + return Mono.error(new IllegalArgumentException("status value is invalid")); + } + + return file.content() + .collectList() + .flatMap(buffers -> { + byte[] fileContent = new byte[buffers.stream().mapToInt(b -> b.readableByteCount()).sum()]; + int offset = 0; + for (DataBuffer buffer : buffers) { + int readable = buffer.readableByteCount(); + buffer.read(fileContent, offset, readable); + offset += readable; + } + return verifyBytesContent(fileContent, "file"); + }) + .then(statusArray != null ? + statusArray.index() + .doOnNext(tuple -> { + long index = tuple.getT1(); + String statusValue = tuple.getT2(); + try { + MultipartMixedStatus enumValue = MultipartMixedStatus.fromValue(statusValue); + if (enumValue == null || enumValue.getValue() == null) { + throw new IllegalArgumentException("statusArray[" + index + "] contains invalid enum: " + statusValue); + } + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("statusArray[" + index + "] contains invalid enum: " + statusValue, e); + } + }) + .then() + : Mono.empty()) + .then(Mono.fromCallable(() -> { + + // Verify POJO fields + if (marker != null) { + String name = marker.getName(); + if (name == null) { + throw new IllegalArgumentException("marker.name is required"); + } + } + + // Verify POJO array fields + if (markerArray != null) { + for (int i = 0; i < markerArray.size(); i++) { + MultipartMixedRequestMarker m = markerArray.get(i); + String name = m.getName(); + if (name == null) { + throw new IllegalArgumentException("markerArray[" + i + "].name is required"); + } + } + } + return null; + })) + .then(Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT))) + .onErrorResume(e -> { + exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + return Mono.error(e); + }); + } + + @Override + public Mono> multipartSimple( + String plain, + String bytes, + Part file, + ServerWebExchange exchange + ) { + return Mono.fromCallable(() -> { + if (bytes != null) { + try { + byte[] decoded = Base64.getDecoder().decode(bytes); + if (!Arrays.equals(EXPECTED_BYTES, decoded)) { + String actualString = new String(decoded, StandardCharsets.UTF_8); + throw new IllegalArgumentException( + "bytes content mismatch: expected '" + EXPECTED_BYTES_STRING + "', got '" + actualString + "'"); + } + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Invalid base64 in bytes", e); + } + } + return null; + }).then(file != null ? + file.content() + .collectList() + .then(Mono.empty()) + : Mono.empty()) + .then(Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT))) + .onErrorResume(e -> { + exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + return Mono.error(e); + }); + } + + @Override + public Mono> multipartSimpleValidated( + String plain, + String bytes, + Part file, + ServerWebExchange exchange + ) { + return Mono.fromCallable(() -> { + if (bytes != null) { + try { + byte[] decoded = Base64.getDecoder().decode(bytes); + if (!Arrays.equals(EXPECTED_BYTES, decoded)) { + String actualString = new String(decoded, StandardCharsets.UTF_8); + throw new IllegalArgumentException( + "bytes content mismatch: expected '" + EXPECTED_BYTES_STRING + "', got '" + actualString + "'"); + } + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Invalid base64 in bytes", e); + } + } + return null; + }).then(file != null ? + file.content() + .collectList() + .flatMap(buffers -> { + byte[] fileContent = new byte[buffers.stream().mapToInt(b -> b.readableByteCount()).sum()]; + int offset = 0; + for (DataBuffer buffer : buffers) { + int readable = buffer.readableByteCount(); + buffer.read(fileContent, offset, readable); + offset += readable; + } + return verifyBytesContent(fileContent, "file"); + }).then() + : Mono.empty()) + .then(Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT))) + .onErrorResume(e -> { + exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + return Mono.error(e); + }); + } + + @Override + public Mono> pathParams( + String plain, + String bytes, + ServerWebExchange exchange + ) { + if (plain == null) { + return Mono.error(new IllegalArgumentException("plain is required")); + } + if (bytes == null) { + return Mono.error(new IllegalArgumentException("bytes is required")); + } + return verifyBase64Content(bytes, "bytes") + .then(Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT))) + .onErrorResume(e -> { + exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + return Mono.error(e); + }); + } + + @Override + public Mono> queryParams( + String plain, + String bytes, + ServerWebExchange exchange + ) { + if (bytes != null) { + return verifyBase64Content(bytes, "bytes") + .then(Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT))) + .onErrorResume(e -> { + exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + return Mono.error(e); + }); + } + return Mono.just(new ResponseEntity(HttpStatus.NO_CONTENT)); + } +} + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/test/java/org/openapitools/api/CoverageApiIntegrationTest.java b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/test/java/org/openapitools/api/CoverageApiIntegrationTest.java new file mode 100644 index 000000000000..7138207edbf3 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/test/java/org/openapitools/api/CoverageApiIntegrationTest.java @@ -0,0 +1,346 @@ +// manually created counterpart to unit tests. Do not delete! +package org.openapitools.api; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; +import org.openapitools.model.MultipartMixedRequestMarker; +import org.openapitools.model.MultipartMixedStatus; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.core.io.ByteArrayResource; +import org.springframework.http.MediaType; +import org.springframework.http.client.MultipartBodyBuilder; +import org.springframework.test.web.reactive.server.WebTestClient; +import org.springframework.web.reactive.function.BodyInserters; + +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Base64; +import java.util.List; + + +@SpringBootTest +@AutoConfigureWebTestClient +class CoverageApiIntegrationTest { + + @Autowired + private WebTestClient webTestClient; + + @Autowired + private ObjectMapper objectMapper; + + private static final byte[] SAMPLE_BYTES = "hello".getBytes(StandardCharsets.UTF_8); + private static final String SAMPLE_BYTES_BASE64 = Base64.getEncoder().encodeToString(SAMPLE_BYTES); + + // ==================== multipartMixed tests ==================== + // Covers: enum @RequestParam, file @RequestPart, enum array @RequestParam, + // object @RequestPart, object array @RequestPart + + @Test + void multipartMixed_withRequiredFieldsOnly_returns204() throws Exception { + MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder(); + bodyBuilder.part("file", new ByteArrayResource(SAMPLE_BYTES), MediaType.APPLICATION_OCTET_STREAM); + bodyBuilder.part("status", MultipartMixedStatus.ALLOWED.getValue()); + + webTestClient + .post() + .uri(CoverageApi.PATH_MULTIPART_MIXED) + .contentType(MediaType.MULTIPART_FORM_DATA) + .body(BodyInserters.fromMultipartData(bodyBuilder.build())) + .exchange() + .expectStatus().isNoContent(); + } + + @Test + void multipartMixed_withAllFields_returns204() throws Exception { + MultipartMixedRequestMarker marker = new MultipartMixedRequestMarker("marker1") + .priority(10) + .active(true); + + List markerArray = Arrays.asList( + new MultipartMixedRequestMarker("marker2").priority(20).active(false), + new MultipartMixedRequestMarker("marker3").priority(30).active(true) + ); + + MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder(); + bodyBuilder.part("file", new ByteArrayResource(SAMPLE_BYTES), MediaType.APPLICATION_OCTET_STREAM); + bodyBuilder.part("status", MultipartMixedStatus.IN_PROGRESS.getValue()); + bodyBuilder.part("statusArray", MultipartMixedStatus.ALLOWED.getValue()); + bodyBuilder.part("statusArray", MultipartMixedStatus.REJECTED.getValue()); + bodyBuilder.part("marker", objectMapper.writeValueAsString(marker), MediaType.APPLICATION_JSON); + bodyBuilder.part("markerArray", objectMapper.writeValueAsString(markerArray), MediaType.APPLICATION_JSON); + + webTestClient + .post() + .uri(CoverageApi.PATH_MULTIPART_MIXED) + .contentType(MediaType.MULTIPART_FORM_DATA) + .body(BodyInserters.fromMultipartData(bodyBuilder.build())) + .exchange() + .expectStatus().isNoContent(); + } + + @Test + void multipartMixed_enumValue_deserializesCorrectly() { + for (MultipartMixedStatus status : MultipartMixedStatus.values()) { + MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder(); + bodyBuilder.part("file", new ByteArrayResource(SAMPLE_BYTES), MediaType.APPLICATION_OCTET_STREAM); + bodyBuilder.part("status", status.getValue()); + + webTestClient + .post() + .uri(CoverageApi.PATH_MULTIPART_MIXED) + .contentType(MediaType.MULTIPART_FORM_DATA) + .body(BodyInserters.fromMultipartData(bodyBuilder.build())) + .exchange() + .expectStatus().isNoContent(); + } + } + + // ==================== multipartSimple tests ==================== + // Covers: scalar @RequestParam, base64 bytes @RequestParam, file @RequestPart + + @Test + void multipartSimple_withAllFields_returns204() { + MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder(); + bodyBuilder.part("file", new ByteArrayResource("content".getBytes()), MediaType.TEXT_PLAIN); + bodyBuilder.part("plain", "plainText"); + bodyBuilder.part("bytes", SAMPLE_BYTES_BASE64); + + webTestClient + .post() + .uri(CoverageApi.PATH_MULTIPART_SIMPLE) + .contentType(MediaType.MULTIPART_FORM_DATA) + .body(BodyInserters.fromMultipartData(bodyBuilder.build())) + .exchange() + .expectStatus().isNoContent(); + } + + @Test + void multipartSimple_withNoFields_returns204() { + MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder(); + + webTestClient + .post() + .uri(CoverageApi.PATH_MULTIPART_SIMPLE) + .body(BodyInserters.fromMultipartData(bodyBuilder.build())) + .exchange() + .expectStatus().isNoContent(); + } + + @Test + void multipartSimple_withEmptyFilePart_returns204() { + MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder(); + bodyBuilder.part("file", new ByteArrayResource(new byte[0]), MediaType.APPLICATION_OCTET_STREAM); + + webTestClient + .post() + .uri(CoverageApi.PATH_MULTIPART_SIMPLE) + .contentType(MediaType.MULTIPART_FORM_DATA) + .body(BodyInserters.fromMultipartData(bodyBuilder.build())) + .exchange() + .expectStatus().isNoContent(); + } + + // ==================== multipartSimpleValidated tests ==================== + // Covers: validated file content deserialization + + @Test + void multipartSimpleValidated_withValidContent_returns204() { + MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder(); + bodyBuilder.part("file", new ByteArrayResource(SAMPLE_BYTES), MediaType.TEXT_PLAIN); + bodyBuilder.part("plain", "plainText"); + bodyBuilder.part("bytes", SAMPLE_BYTES_BASE64); + + webTestClient + .post() + .uri(CoverageApi.PATH_MULTIPART_SIMPLE_VALIDATED) + .contentType(MediaType.MULTIPART_FORM_DATA) + .body(BodyInserters.fromMultipartData(bodyBuilder.build())) + .exchange() + .expectStatus().isNoContent(); + } + + // ==================== multipartFileArray tests ==================== + // Covers: array of files @RequestPart List + + @Test + void multipartFileArray_withMultipleFiles_returns204() { + MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder(); + bodyBuilder.part("files", new ByteArrayResource("content1".getBytes()), MediaType.APPLICATION_OCTET_STREAM) + .filename("file1.bin"); + bodyBuilder.part("files", new ByteArrayResource("content2".getBytes()), MediaType.APPLICATION_OCTET_STREAM) + .filename("file2.bin"); + bodyBuilder.part("files", new ByteArrayResource("content3".getBytes()), MediaType.APPLICATION_OCTET_STREAM) + .filename("file3.bin"); + + webTestClient + .post() + .uri(CoverageApi.PATH_MULTIPART_FILE_ARRAY) + .contentType(MediaType.MULTIPART_FORM_DATA) + .body(BodyInserters.fromMultipartData(bodyBuilder.build())) + .exchange() + .expectStatus().isNoContent(); + } + + @Test + void multipartFileArray_withNoFiles_returns204() { + MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder(); + + webTestClient + .post() + .uri(CoverageApi.PATH_MULTIPART_FILE_ARRAY) + .body(BodyInserters.fromMultipartData(bodyBuilder.build())) + .exchange() + .expectStatus().isNoContent(); + } + + // ==================== formParams tests ==================== + // Covers: application/x-www-form-urlencoded with @RequestParam + + @Test + void formParams_withAllFields_returns204() { + webTestClient + .post() + .uri(CoverageApi.PATH_FORM_PARAMS) + .contentType(MediaType.APPLICATION_FORM_URLENCODED) + .bodyValue("plain=plainValue&bytes=" + SAMPLE_BYTES_BASE64) + .exchange() + .expectStatus().isNoContent(); + } + + @Test + void formParams_withNoFields_returns204() { + webTestClient + .post() + .uri(CoverageApi.PATH_FORM_PARAMS) + .contentType(MediaType.APPLICATION_FORM_URLENCODED) + .exchange() + .expectStatus().isNoContent(); + } + + // ==================== queryParams tests ==================== + // Covers: query string @RequestParam + + @Test + void queryParams_withAllParams_returns204() { + webTestClient + .get() + .uri(uriBuilder -> uriBuilder + .path(CoverageApi.PATH_QUERY_PARAMS) + .queryParam("plain", "queryPlain") + .queryParam("bytes", SAMPLE_BYTES_BASE64) + .build()) + .exchange() + .expectStatus().isNoContent(); + } + + @Test + void queryParams_withNoParams_returns204() { + webTestClient + .get() + .uri(CoverageApi.PATH_QUERY_PARAMS) + .exchange() + .expectStatus().isNoContent(); + } + + // ==================== pathParams tests ==================== + // Covers: @PathVariable + + @Test + void pathParams_withBothParams_returns204() { + webTestClient + .get() + .uri("/coverage/path/{plain}/{bytes}", "pathPlain", SAMPLE_BYTES_BASE64) + .exchange() + .expectStatus().isNoContent(); + } + + // ==================== headerParams tests ==================== + // Covers: @RequestHeader + + @Test + void headerParams_withAllHeaders_returns204() { + webTestClient + .get() + .uri(CoverageApi.PATH_HEADER_PARAMS) + .header("X-Plain", "headerPlain") + .header("X-Byte", SAMPLE_BYTES_BASE64) + .exchange() + .expectStatus().isNoContent(); + } + + @Test + void headerParams_withNoHeaders_returns204() { + webTestClient + .get() + .uri(CoverageApi.PATH_HEADER_PARAMS) + .exchange() + .expectStatus().isNoContent(); + } + + // ==================== cookieParams tests ==================== + // Covers: @CookieValue + + @Test + void cookieParams_withAllCookies_returns204() { + webTestClient + .get() + .uri(CoverageApi.PATH_COOKIE_PARAMS) + .cookie("plain", "cookiePlain") + .cookie("bytes", SAMPLE_BYTES_BASE64) + .exchange() + .expectStatus().isNoContent(); + } + + @Test + void cookieParams_withNoCookies_returns204() { + webTestClient + .get() + .uri(CoverageApi.PATH_COOKIE_PARAMS) + .exchange() + .expectStatus().isNoContent(); + } + + // ==================== jsonBody tests ==================== + // Covers: @RequestBody with JSON POJO + + @Test + void jsonBody_withValidBody_returns204() { + String json = "{\"plain\": \"jsonPlain\", \"bytes\": \"" + SAMPLE_BYTES_BASE64 + "\"}"; + + webTestClient + .post() + .uri(CoverageApi.PATH_JSON_BODY) + .contentType(MediaType.APPLICATION_JSON) + .bodyValue(json) + .exchange() + .expectStatus().isNoContent(); + } + + @Test + void jsonBody_withEmptyObject_returns204() { + webTestClient + .post() + .uri(CoverageApi.PATH_JSON_BODY) + .contentType(MediaType.APPLICATION_JSON) + .bodyValue("{}") + .exchange() + .expectStatus().isNoContent(); + } + + // ==================== binaryBody tests ==================== + // Covers: @RequestBody with application/octet-stream Resource + + @Test + void binaryBody_withBinaryContent_returns204() { + webTestClient + .post() + .uri(CoverageApi.PATH_BINARY_BODY) + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .bodyValue(SAMPLE_BYTES) + .exchange() + .expectStatus().isNoContent(); + } + +} diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java new file mode 100644 index 000000000000..f85e6755dfe9 --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java @@ -0,0 +1,248 @@ +// manually created counterpart to unit tests. Do not delete! +package org.openapitools.api; + +import org.openapitools.model.FormParamsRequest; +import org.openapitools.model.MultipartMixedRequestMarker; +import org.openapitools.model.MultipartMixedStatus; +import org.springframework.core.io.Resource; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.multipart.MultipartFile; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Base64; +import java.util.List; + +@Controller +@RequestMapping("${openapi.multipartByteEdgeCaseCoverage.base-path:}") +public class CoverageApiTestControllerImpl implements CoverageApi { + + // Expected content for binary data verification - matches test constants + private static final byte[] EXPECTED_BYTES = "hello".getBytes(StandardCharsets.UTF_8); + private static final String EXPECTED_BYTES_STRING = "hello"; + + private void verifyBytesContent(byte[] actual, String fieldName) { + if (!Arrays.equals(EXPECTED_BYTES, actual)) { + String actualString = new String(actual, StandardCharsets.UTF_8); + throw new IllegalArgumentException( + fieldName + " content mismatch: expected '" + EXPECTED_BYTES_STRING + "', got '" + actualString + "'"); + } + } + + private void verifyBase64Content(String base64Value, String fieldName) { + byte[] decoded = Base64.getDecoder().decode(base64Value); + verifyBytesContent(decoded, fieldName); + } + + @Override + public ResponseEntity binaryBody(Resource body) { + if (body == null) { + throw new IllegalArgumentException("body is required"); + } + try { + byte[] content = readAllBytes(body.getInputStream()); + if (content.length == 0) { + throw new IllegalArgumentException("body content is empty"); + } + verifyBytesContent(content, "body"); + } catch (IOException e) { + throw new RuntimeException("Failed to read binary body", e); + } + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + private byte[] readAllBytes(InputStream inputStream) throws IOException { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int nRead; + byte[] data = new byte[1024]; + while ((nRead = inputStream.read(data, 0, data.length)) != -1) { + buffer.write(data, 0, nRead); + } + buffer.flush(); + return buffer.toByteArray(); + } + + @Override + public ResponseEntity cookieParams(String plain, String bytes) { + if (bytes != null) { + verifyBase64Content(bytes, "bytes"); + } + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Override + public ResponseEntity formParams(String plain, String bytes) { + if (bytes != null) { + verifyBase64Content(bytes, "bytes"); + } + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Override + public ResponseEntity headerParams(String xPlain, String xByte) { + if (xByte != null) { + verifyBase64Content(xByte, "X-Byte"); + } + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Override + public ResponseEntity jsonBody(FormParamsRequest formParamsRequest) { + if (formParamsRequest == null) { + throw new IllegalArgumentException("formParamsRequest is required"); + } + byte[] bytes = formParamsRequest.getBytes(); + if (bytes != null) { + verifyBytesContent(bytes, "bytes"); + } + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Override + public ResponseEntity multipartFileArray(List files) { + // Expected content for each file in the array - matches test constants + String[] expectedContents = {"content1", "content2", "content3"}; + + if (files != null) { + for (int i = 0; i < files.size(); i++) { + MultipartFile file = files.get(i); + try { + byte[] content = file.getBytes(); + if (content.length == 0) { + throw new IllegalArgumentException("files[" + i + "] content is empty"); + } + // Verify content matches expected value for this index + if (i < expectedContents.length) { + byte[] expected = expectedContents[i].getBytes(StandardCharsets.UTF_8); + if (!Arrays.equals(expected, content)) { + String actualString = new String(content, StandardCharsets.UTF_8); + throw new IllegalArgumentException( + "files[" + i + "] content mismatch: expected '" + expectedContents[i] + "', got '" + actualString + "'"); + } + } + } catch (IOException e) { + throw new RuntimeException("Failed to read file", e); + } + } + } + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Override + public ResponseEntity multipartMixed( + MultipartMixedStatus status, + MultipartFile file, + List statusArray, + MultipartMixedRequestMarker marker, + List markerArray + ) { + if (status == null) { + throw new IllegalArgumentException("status is required"); + } + if (file == null) { + throw new IllegalArgumentException("file is required"); + } + + // Verify enum value is valid + String reconstructedStatus = status.getValue(); + if (reconstructedStatus == null || reconstructedStatus.isEmpty()) { + throw new IllegalArgumentException("status value is invalid"); + } + + // Verify file content matches expected bytes + try { + byte[] fileContent = file.getBytes(); + verifyBytesContent(fileContent, "file"); + } catch (IOException e) { + throw new RuntimeException("Failed to read file", e); + } + + // Verify enum array values + if (statusArray != null) { + for (int i = 0; i < statusArray.size(); i++) { + MultipartMixedStatus s = statusArray.get(i); + String value = s.getValue(); + if (value == null) { + throw new IllegalArgumentException("statusArray[" + i + "] contains invalid enum"); + } + } + } + + // Verify POJO fields + if (marker != null) { + String name = marker.getName(); + if (name == null) { + throw new IllegalArgumentException("marker.name is required"); + } + } + + // Verify POJO array fields + if (markerArray != null) { + for (int i = 0; i < markerArray.size(); i++) { + MultipartMixedRequestMarker m = markerArray.get(i); + String name = m.getName(); + if (name == null) { + throw new IllegalArgumentException("markerArray[" + i + "].name is required"); + } + } + } + + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Override + public ResponseEntity multipartSimple(String plain, String bytes, MultipartFile file) { + // This endpoint does NOT validate file content - allows empty files + if (bytes != null) { + verifyBase64Content(bytes, "bytes"); + } + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Override + public ResponseEntity multipartSimpleValidated(String plain, String bytes, MultipartFile file) { + // This endpoint validates file content + if (bytes != null) { + verifyBase64Content(bytes, "bytes"); + } + if (file != null) { + try { + byte[] content = file.getBytes(); + if (content.length == 0) { + throw new IllegalArgumentException("file content is empty"); + } + verifyBytesContent(content, "file"); + } catch (IOException e) { + throw new RuntimeException("Failed to read file", e); + } + } + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Override + public ResponseEntity pathParams(String plain, String bytes) { + if (plain == null) { + throw new IllegalArgumentException("plain is required"); + } + if (bytes == null) { + throw new IllegalArgumentException("bytes is required"); + } + verifyBase64Content(bytes, "bytes"); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Override + public ResponseEntity queryParams(String plain, String bytes) { + if (bytes != null) { + verifyBase64Content(bytes, "bytes"); + } + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } +} + diff --git a/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/api/CoverageApiIntegrationTest.java b/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/api/CoverageApiIntegrationTest.java new file mode 100644 index 000000000000..cd3c06d2e82b --- /dev/null +++ b/samples/server/petstore/springboot-byte-format-edge-cases/src/test/java/org/openapitools/api/CoverageApiIntegrationTest.java @@ -0,0 +1,275 @@ +// manually created counterpart to unit tests. Do not delete! +package org.openapitools.api; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; +import org.openapitools.model.MultipartMixedRequestMarker; +import org.openapitools.model.MultipartMixedStatus; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.test.web.servlet.MockMvc; + +import javax.servlet.http.Cookie; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Base64; +import java.util.List; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +@SpringBootTest +@AutoConfigureMockMvc +class CoverageApiIntegrationTest { + + @Autowired + private MockMvc mockMvc; + + @Autowired + private ObjectMapper objectMapper; + + private static final byte[] SAMPLE_BYTES = "hello".getBytes(StandardCharsets.UTF_8); + private static final String SAMPLE_BYTES_BASE64 = Base64.getEncoder().encodeToString(SAMPLE_BYTES); + + // ==================== multipartMixed tests ==================== + // Covers: enum @RequestParam, file @RequestPart, enum array @RequestParam, + // object @RequestPart, object array @RequestPart + + @Test + void multipartMixed_withRequiredFieldsOnly_returns204() throws Exception { + MockMultipartFile file = new MockMultipartFile( + "file", "test.bin", MediaType.APPLICATION_OCTET_STREAM_VALUE, SAMPLE_BYTES); + + mockMvc.perform(multipart(CoverageApi.PATH_MULTIPART_MIXED) + .file(file) + .param("status", MultipartMixedStatus.ALLOWED.getValue())) + .andExpect(status().isNoContent()); + } + + @Test + void multipartMixed_withAllFields_returns204() throws Exception { + MockMultipartFile file = new MockMultipartFile( + "file", "test.bin", MediaType.APPLICATION_OCTET_STREAM_VALUE, SAMPLE_BYTES); + + MultipartMixedRequestMarker marker = new MultipartMixedRequestMarker("marker1") + .priority(10) + .active(true); + + List markerArray = Arrays.asList( + new MultipartMixedRequestMarker("marker2").priority(20).active(false), + new MultipartMixedRequestMarker("marker3").priority(30).active(true) + ); + + // marker as JSON part + MockMultipartFile markerPart = new MockMultipartFile( + "marker", "", MediaType.APPLICATION_JSON_VALUE, + objectMapper.writeValueAsBytes(marker)); + + // markerArray as JSON part + MockMultipartFile markerArrayPart = new MockMultipartFile( + "markerArray", "", MediaType.APPLICATION_JSON_VALUE, + objectMapper.writeValueAsBytes(markerArray)); + + mockMvc.perform(multipart(CoverageApi.PATH_MULTIPART_MIXED) + .file(file) + .file(markerPart) + .file(markerArrayPart) + .param("status", MultipartMixedStatus.IN_PROGRESS.getValue()) + .param("statusArray", MultipartMixedStatus.ALLOWED.getValue(), + MultipartMixedStatus.REJECTED.getValue())) + .andExpect(status().isNoContent()); + } + + @Test + void multipartMixed_enumValue_deserializesCorrectly() throws Exception { + MockMultipartFile file = new MockMultipartFile( + "file", "test.bin", MediaType.APPLICATION_OCTET_STREAM_VALUE, SAMPLE_BYTES); + + // Test each enum value + for (MultipartMixedStatus status : MultipartMixedStatus.values()) { + mockMvc.perform(multipart(CoverageApi.PATH_MULTIPART_MIXED) + .file(file) + .param("status", status.getValue())) + .andExpect(status().isNoContent()); + } + } + + // ==================== multipartSimple tests ==================== + // Covers: scalar @RequestParam, base64 bytes @RequestParam, file @RequestPart + + @Test + void multipartSimple_withAllFields_returns204() throws Exception { + MockMultipartFile file = new MockMultipartFile( + "file", "test.txt", MediaType.TEXT_PLAIN_VALUE, SAMPLE_BYTES); + + mockMvc.perform(multipart(CoverageApi.PATH_MULTIPART_SIMPLE) + .file(file) + .param("plain", "plainText") + .param("bytes", SAMPLE_BYTES_BASE64)) + .andExpect(status().isNoContent()); + } + + @Test + void multipartSimple_withEmptyFilePart_returns204() throws Exception { + MockMultipartFile emptyFile = + new MockMultipartFile("file", "", MediaType.APPLICATION_OCTET_STREAM_VALUE, new byte[0]); + + mockMvc.perform(multipart(CoverageApi.PATH_MULTIPART_SIMPLE) + .file(emptyFile)) + .andExpect(status().isNoContent()); + } + + // ==================== multipartSimpleValidated tests ==================== + // Covers: validated file content deserialization + + @Test + void multipartSimpleValidated_withValidContent_returns204() throws Exception { + MockMultipartFile file = new MockMultipartFile( + "file", "test.txt", MediaType.TEXT_PLAIN_VALUE, SAMPLE_BYTES); + + mockMvc.perform(multipart(CoverageApi.PATH_MULTIPART_SIMPLE_VALIDATED) + .file(file) + .param("plain", "plainText") + .param("bytes", SAMPLE_BYTES_BASE64)) + .andExpect(status().isNoContent()); + } + + // ==================== multipartFileArray tests ==================== + // Covers: array of files @RequestPart List + + @Test + void multipartFileArray_withMultipleFiles_returns204() throws Exception { + MockMultipartFile file1 = new MockMultipartFile( + "files", "file1.bin", MediaType.APPLICATION_OCTET_STREAM_VALUE, "content1".getBytes()); + MockMultipartFile file2 = new MockMultipartFile( + "files", "file2.bin", MediaType.APPLICATION_OCTET_STREAM_VALUE, "content2".getBytes()); + MockMultipartFile file3 = new MockMultipartFile( + "files", "file3.bin", MediaType.APPLICATION_OCTET_STREAM_VALUE, "content3".getBytes()); + + mockMvc.perform(multipart(CoverageApi.PATH_MULTIPART_FILE_ARRAY) + .file(file1) + .file(file2) + .file(file3)) + .andExpect(status().isNoContent()); + } + + @Test + void multipartFileArray_withNoFiles_returns204() throws Exception { + mockMvc.perform(multipart(CoverageApi.PATH_MULTIPART_FILE_ARRAY)) + .andExpect(status().isNoContent()); + } + + // ==================== formParams tests ==================== + // Covers: application/x-www-form-urlencoded with @RequestParam + + @Test + void formParams_withAllFields_returns204() throws Exception { + mockMvc.perform(post(CoverageApi.PATH_FORM_PARAMS) + .contentType(MediaType.APPLICATION_FORM_URLENCODED) + .param("plain", "plainValue") + .param("bytes", SAMPLE_BYTES_BASE64)) + .andExpect(status().isNoContent()); + } + + @Test + void formParams_withNoFields_returns204() throws Exception { + mockMvc.perform(post(CoverageApi.PATH_FORM_PARAMS) + .contentType(MediaType.APPLICATION_FORM_URLENCODED)) + .andExpect(status().isNoContent()); + } + + // ==================== queryParams tests ==================== + // Covers: query string @RequestParam + + @Test + void queryParams_withAllParams_returns204() throws Exception { + mockMvc.perform(get(CoverageApi.PATH_QUERY_PARAMS) + .param("plain", "queryPlain") + .param("bytes", SAMPLE_BYTES_BASE64)) + .andExpect(status().isNoContent()); + } + + @Test + void queryParams_withNoParams_returns204() throws Exception { + mockMvc.perform(get(CoverageApi.PATH_QUERY_PARAMS)) + .andExpect(status().isNoContent()); + } + + // ==================== pathParams tests ==================== + // Covers: @PathVariable + + @Test + void pathParams_withBothParams_returns204() throws Exception { + mockMvc.perform(get("/coverage/path/{plain}/{bytes}", "pathPlain", SAMPLE_BYTES_BASE64)) + .andExpect(status().isNoContent()); + } + + // ==================== headerParams tests ==================== + // Covers: @RequestHeader + + @Test + void headerParams_withAllHeaders_returns204() throws Exception { + mockMvc.perform(get(CoverageApi.PATH_HEADER_PARAMS) + .header("X-Plain", "headerPlain") + .header("X-Byte", SAMPLE_BYTES_BASE64)) + .andExpect(status().isNoContent()); + } + + @Test + void headerParams_withNoHeaders_returns204() throws Exception { + mockMvc.perform(get(CoverageApi.PATH_HEADER_PARAMS)) + .andExpect(status().isNoContent()); + } + + // ==================== cookieParams tests ==================== + // Covers: @CookieValue + + @Test + void cookieParams_withAllCookies_returns204() throws Exception { + mockMvc.perform(get(CoverageApi.PATH_COOKIE_PARAMS) + .cookie(new Cookie("plain", "cookiePlain")) + .cookie(new Cookie("bytes", SAMPLE_BYTES_BASE64))) + .andExpect(status().isNoContent()); + } + + @Test + void cookieParams_withNoCookies_returns204() throws Exception { + mockMvc.perform(get(CoverageApi.PATH_COOKIE_PARAMS)) + .andExpect(status().isNoContent()); + } + + // ==================== jsonBody tests ==================== + // Covers: @RequestBody with JSON POJO + + @Test + void jsonBody_withValidBody_returns204() throws Exception { + String json = "{\"plain\": \"jsonPlain\", \"bytes\": \"" + SAMPLE_BYTES_BASE64 + "\"}"; + + mockMvc.perform(post(CoverageApi.PATH_JSON_BODY) + .contentType(MediaType.APPLICATION_JSON) + .content(json)) + .andExpect(status().isNoContent()); + } + + @Test + void jsonBody_withEmptyObject_returns204() throws Exception { + mockMvc.perform(post(CoverageApi.PATH_JSON_BODY) + .contentType(MediaType.APPLICATION_JSON) + .content("{}")) + .andExpect(status().isNoContent()); + } + + // ==================== binaryBody tests ==================== + // Covers: @RequestBody with application/octet-stream Resource + + @Test + void binaryBody_withBinaryContent_returns204() throws Exception { + mockMvc.perform(post(CoverageApi.PATH_BINARY_BODY) + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .content(SAMPLE_BYTES)) + .andExpect(status().isNoContent()); + } +} + From 20a0ae24f28a181149975d403196edfc6686673e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1chym=20Metli=C4=8Dka?= Date: Thu, 12 Feb 2026 18:46:15 +0100 Subject: [PATCH 28/28] fix test name --- .../codegen/kotlin/spring/KotlinSpringServerCodegenTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index 12d52f58de59..387732414ecb 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -914,7 +914,7 @@ public void givenOctetStreamResponseType_whenGenerateServer_thenReturnTypeIsReso } @Test - public void givenMultipartForm_whenGenerateReactiveServer_thenParameterAreCreatedAsRequestPart() throws IOException { + public void givenMultipartForm_whenGenerateReactiveServer_thenParameterAreCreatedAsRequestParam() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); output.deleteOnExit(); String outputPath = output.getAbsolutePath().replace('\\', '/');