-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[JAVA-SPRING] Convert byte[] to String for operation params [QueryParam; PathParam; HeaderParam; CookieParam; FormParam] #22930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 41 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java">
<violation number="1" location="samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java:383">
P2: @RequestPart is for multipart/form-data, but this endpoint consumes application/x-www-form-urlencoded. The modified parameter still uses @RequestPart, so WebFlux won’t bind the form body correctly (likely 400).</violation>
</file>
<file name="modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java">
<violation number="1" location="modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java:944">
P2: Form/multipart DTO still asserts `format: byte` as `byte[]`, but Spring’s default data binding does not Base64‑decode form strings to `byte[]`; it converts the string to raw bytes. This makes form DTO binding inconsistent with the new `String` parameter handling and can yield incorrect values without a custom converter.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
...etstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java
Outdated
Show resolved
Hide resolved
.../openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 33 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java:16">
P2: RFC3339DateFormat hardcodes the delegate StdDateFormat to UTC and does not override setTimeZone, so any configured timezone will be ignored and dates will always format in UTC.</violation>
<violation number="2" location="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java:36">
P2: clone() returns the same instance instead of a copy, violating the Format/DateFormat clone contract and preventing callers from obtaining an independent DateFormat instance.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
...tore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java
Show resolved
Hide resolved
...tore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java
Show resolved
Hide resolved
.../springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/RFC3339DateFormat.java
Show resolved
Hide resolved
| @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 */, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am now adding this comment as a hint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9 issues found across 87 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs">
<violation number="1" location="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs:156">
P2: MarkerArray is compared by contents via CompareNetObjects, but GetHashCode uses List<T>.GetHashCode() (reference-based), violating the Equals/GetHashCode contract for equal instances with different list instances.</violation>
</file>
<file name="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs">
<violation number="1" location="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs:526">
P2: markerArray is serialized with ParameterToString for multipart/form-data, which turns a list of complex objects into a comma-separated ToString output rather than JSON. This likely produces an invalid multipart part for an array of objects; use JSON serialization instead (matching the async method).</violation>
</file>
<file name="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApi.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApi.java:65">
P2: Converted byte-format parameter is now a String without preserving `format: byte` in the @Parameter schema, which causes generated OpenAPI docs/clients to lose the Base64 byte semantics.</violation>
</file>
<file name="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java:16">
P2: RFC3339DateFormat extends DateFormat but ignores DateFormat configuration and returns `this` from clone(). Callers that set time zone/leniency will only update the inherited calendar, while the delegate `fmt` stays locked to UTC; and cloning returns a shared mutable instance, breaking expected DateFormat clone semantics and risking shared state across threads.</violation>
</file>
<file name="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java">
<violation number="1" location="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java:309">
P2: @RequestParam in WebFlux only binds query parameters; using it for application/x-www-form-urlencoded form fields breaks binding of request-body form data.</violation>
<violation number="2" location="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java:351">
P2: Multipart form fields in WebFlux are not bound by @RequestParam; using it for multipart/form-data will ignore request-body fields.</violation>
</file>
<file name="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java">
<violation number="1" location="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java:666">
P2: @RequestParam in WebFlux binds only query parameters; using it for multipart/form-data fields (additionalMetadata) prevents binding from the request body.</violation>
</file>
<file name="samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java">
<violation number="1" location="samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java:316">
P2: In WebFlux, @RequestParam binds query parameters only; with application/x-www-form-urlencoded this will ignore form body fields, so name/status won’t bind for typical POST form submissions.</violation>
<violation number="2" location="samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java:359">
P2: @RequestParam in WebFlux binds only query parameters, so additionalMetadata will no longer be read from multipart/form-data. This regresses multipart uploads and should remain @RequestPart.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| } | ||
| if (this.MarkerArray != null) | ||
| { | ||
| hashCode = (hashCode * 59) + this.MarkerArray.GetHashCode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: MarkerArray is compared by contents via CompareNetObjects, but GetHashCode uses List.GetHashCode() (reference-based), violating the Equals/GetHashCode contract for equal instances with different list instances.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs, line 156:
<comment>MarkerArray is compared by contents via CompareNetObjects, but GetHashCode uses List<T>.GetHashCode() (reference-based), violating the Equals/GetHashCode contract for equal instances with different list instances.</comment>
<file context>
@@ -141,6 +151,10 @@ public override int GetHashCode()
}
+ if (this.MarkerArray != null)
+ {
+ hashCode = (hashCode * 59) + this.MarkerArray.GetHashCode();
+ }
if (this.File != null)
</file context>
| } | ||
| if (markerArray != null) | ||
| { | ||
| localVarRequestOptions.FormParameters.Add("markerArray", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(markerArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(markerArray)); // form parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: markerArray is serialized with ParameterToString for multipart/form-data, which turns a list of complex objects into a comma-separated ToString output rather than JSON. This likely produces an invalid multipart part for an array of objects; use JSON serialization instead (matching the async method).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs, line 526:
<comment>markerArray is serialized with ParameterToString for multipart/form-data, which turns a list of complex objects into a comma-separated ToString output rather than JSON. This likely produces an invalid multipart part for an array of objects; use JSON serialization instead (matching the async method).</comment>
<file context>
@@ -515,6 +521,10 @@ public Org.OpenAPITools.Client.ApiResponse<Object> MultipartMixedWithHttpInfo(Mu
}
+ 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);
</file context>
| localVarRequestOptions.FormParameters.Add("markerArray", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(markerArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(markerArray)); // form parameter | |
| localVarRequestOptions.FormParameters.Add("markerArray", Org.OpenAPITools.Client.ClientUtils.Serialize(markerArray)); // form parameter |
...r/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/api/PathApi.java
Outdated
Show resolved
Hide resolved
...tore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java
Show resolved
Hide resolved
samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java
Outdated
Show resolved
Hide resolved
samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java
Show resolved
Hide resolved
samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java
Outdated
Show resolved
Hide resolved
| @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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: In WebFlux, @RequestParam binds query parameters only; with application/x-www-form-urlencoded this will ignore form body fields, so name/status won’t bind for typical POST form submissions.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java, line 316:
<comment>In WebFlux, @RequestParam binds query parameters only; with application/x-www-form-urlencoded this will ignore form body fields, so name/status won’t bind for typical POST form submissions.</comment>
<file context>
@@ -313,8 +313,8 @@ default Mono<Void> updatePet(
@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
</file context>
...petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java
Outdated
Show resolved
Hide resolved
|
Please @cubic-dev-ai, do a new CR. And ignore any non-java sample files. |
@Picazsoo I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 issues found across 95 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java">
<violation number="1" location="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java:309">
P2: In WebFlux, @RequestParam binds query params only; for application/x-www-form-urlencoded form data, these fields will not bind from the body, so name/status can be null and the endpoint breaks for form submissions.</violation>
</file>
<file name="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs">
<violation number="1" location="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs:526">
P2: markerArray is serialized with ParameterToString for multipart/form-data, which joins collection elements and uses object.ToString() for complex types, producing invalid form payloads for an array of objects. This differs from the async implementation that uses JSON serialization and will likely break multipart requests expecting structured objects.</violation>
</file>
<file name="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java:36">
P2: RFC3339DateFormat violates DateFormat’s mutability/clone expectations: clone() returns this, and all parsing/formatting bypasses DateFormat state, so setters like setTimeZone/setLenient have no effect on actual formatting and callers cannot obtain independent configured copies.</violation>
</file>
<file name="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java">
<violation number="1" location="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java:370">
P2: @RequestParam in WebFlux binds query parameters only, but this endpoint consumes application/x-www-form-urlencoded. These form fields will not bind from the request body, causing missing parameter errors.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| @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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: In WebFlux, @RequestParam binds query params only; for application/x-www-form-urlencoded form data, these fields will not bind from the body, so name/status can be null and the endpoint breaks for form submissions.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java, line 309:
<comment>In WebFlux, @RequestParam binds query params only; for application/x-www-form-urlencoded form data, these fields will not bind from the body, so name/status can be null and the endpoint breaks for form submissions.</comment>
<file context>
@@ -306,8 +306,8 @@ default Mono<ResponseEntity<Void>> updatePet(
@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
</file context>
| } | ||
| if (markerArray != null) | ||
| { | ||
| localVarRequestOptions.FormParameters.Add("markerArray", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(markerArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(markerArray)); // form parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: markerArray is serialized with ParameterToString for multipart/form-data, which joins collection elements and uses object.ToString() for complex types, producing invalid form payloads for an array of objects. This differs from the async implementation that uses JSON serialization and will likely break multipart requests expecting structured objects.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs, line 526:
<comment>markerArray is serialized with ParameterToString for multipart/form-data, which joins collection elements and uses object.ToString() for complex types, producing invalid form payloads for an array of objects. This differs from the async implementation that uses JSON serialization and will likely break multipart requests expecting structured objects.</comment>
<file context>
@@ -515,6 +521,10 @@ public Org.OpenAPITools.Client.ApiResponse<Object> MultipartMixedWithHttpInfo(Mu
}
+ 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);
</file context>
| localVarRequestOptions.FormParameters.Add("markerArray", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(markerArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(markerArray)); // form parameter | |
| localVarRequestOptions.FormParameters.Add("markerArray", Org.OpenAPITools.Client.ClientUtils.Serialize(markerArray)); // form parameter |
|
|
||
| @Override | ||
| public Object clone() { | ||
| return this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: RFC3339DateFormat violates DateFormat’s mutability/clone expectations: clone() returns this, and all parsing/formatting bypasses DateFormat state, so setters like setTimeZone/setLenient have no effect on actual formatting and callers cannot obtain independent configured copies.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java, line 36:
<comment>RFC3339DateFormat violates DateFormat’s mutability/clone expectations: clone() returns this, and all parsing/formatting bypasses DateFormat state, so setters like setTimeZone/setLenient have no effect on actual formatting and callers cannot obtain independent configured copies.</comment>
<file context>
@@ -0,0 +1,38 @@
+
+ @Override
+ public Object clone() {
+ return this;
+ }
+}
</file context>
| @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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: @RequestParam in WebFlux binds query parameters only, but this endpoint consumes application/x-www-form-urlencoded. These form fields will not bind from the request body, causing missing parameter errors.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java, line 370:
<comment>@RequestParam in WebFlux binds query parameters only, but this endpoint consumes application/x-www-form-urlencoded. These form fields will not bind from the request body, causing missing parameter errors.</comment>
<file context>
@@ -367,20 +367,20 @@ default Mono<ResponseEntity<Client>> testClientModel(
- @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,
</file context>
|
Hello @cubic-dev-ai, please rerun the CR. And take into accounts all the passing integration tests I added (they indeed all pass) |
@Picazsoo I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
11 issues found across 97 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java:36">
P2: clone() returns the same instance, violating DateFormat’s clone contract and preventing per-thread/per-request clones, which can lead to shared mutable state and ignored configuration in Jackson.</violation>
</file>
<file name="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java">
<violation number="1" location="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java:428">
P3: Form parameter enum_form_string_array declares a default in @ApiParam but @RequestParam omits defaultValue, so the default isn’t applied and missing values resolve to null.</violation>
</file>
<file name="samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java">
<violation number="1" location="samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java:316">
P2: @RequestParam in Spring WebFlux only binds query parameters, so form-urlencoded body fields won’t populate name/status here. With consumes=application/x-www-form-urlencoded, this change can lead to null form values. Use form-data binding via @ModelAttribute or read ServerWebExchange.getFormData()/@RequestBody MultiValueMap instead.</violation>
</file>
<file name="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/ApiUtil.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/ApiUtil.java:16">
P2: Response body is always encoded as UTF-8 even when the provided MediaType specifies a different charset, which can cause clients to decode the body incorrectly.</violation>
</file>
<file name="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java:36">
P2: clone() returns `this`, violating the clone contract for mutable DateFormat subclasses and causing callers to share a single mutable instance instead of getting an independent copy.</violation>
</file>
<file name="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs">
<violation number="1" location="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs:156">
P2: GetHashCode uses List.GetHashCode for MarkerArray while Equals performs deep comparison, breaking the equality contract for objects with equivalent list contents.</violation>
</file>
<file name="samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java">
<violation number="1" location="samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java:380">
P2: @RequestParam in WebFlux only binds query parameters; for application/x-www-form-urlencoded POST bodies these required form fields will not bind, leading to missing-parameter 400s.</violation>
</file>
<file name="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java:21">
P3: API title in generated SpringDoc config is HTML-escaped ("&") and no longer matches the source OpenAPI spec, leading to an incorrect title in the generated OpenAPI/Swagger UI output.</violation>
</file>
<file name="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java:72">
P2: The InputStream from `resource.getInputStream()` is never closed and the blocking `readAllBytes` runs on the subscriber thread (no boundedElastic scheduler). This can leak file descriptors and block the Netty event loop in WebFlux.</violation>
<violation number="2" location="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java:194">
P2: DataBuffer instances from multipart Part content are consumed but never released, which can leak pooled Netty buffers under load. Release buffers after reading (DataBufferUtils.release) or use releaseConsumer to avoid native memory leaks.</violation>
</file>
<file name="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java">
<violation number="1" location="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java:309">
P2: In Spring WebFlux, @RequestParam only binds query parameters, so using it for application/x-www-form-urlencoded body fields will leave name/status null for typical form submissions. This breaks the form update endpoint.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| @Override | ||
| public Object clone() { | ||
| return this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: clone() returns the same instance, violating DateFormat’s clone contract and preventing per-thread/per-request clones, which can lead to shared mutable state and ignored configuration in Jackson.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java, line 36:
<comment>clone() returns the same instance, violating DateFormat’s clone contract and preventing per-thread/per-request clones, which can lead to shared mutable state and ignored configuration in Jackson.</comment>
<file context>
@@ -0,0 +1,38 @@
+
+ @Override
+ public Object clone() {
+ return this;
+ }
+}
</file context>
| @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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: @RequestParam in Spring WebFlux only binds query parameters, so form-urlencoded body fields won’t populate name/status here. With consumes=application/x-www-form-urlencoded, this change can lead to null form values. Use form-data binding via @ModelAttribute or read ServerWebExchange.getFormData()/@RequestBody MultiValueMap instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java, line 316:
<comment>@RequestParam in Spring WebFlux only binds query parameters, so form-urlencoded body fields won’t populate name/status here. With consumes=application/x-www-form-urlencoded, this change can lead to null form values. Use form-data binding via @ModelAttribute or read ServerWebExchange.getFormData()/@RequestBody MultiValueMap instead.</comment>
<file context>
@@ -313,8 +313,8 @@ default Mono<Void> updatePet(
@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
</file context>
| ServerHttpResponse response = exchange.getResponse(); | ||
| response.getHeaders().setContentType(mediaType); | ||
|
|
||
| byte[] exampleBytes = example.getBytes(StandardCharsets.UTF_8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Response body is always encoded as UTF-8 even when the provided MediaType specifies a different charset, which can cause clients to decode the body incorrectly.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/ApiUtil.java, line 16:
<comment>Response body is always encoded as UTF-8 even when the provided MediaType specifies a different charset, which can cause clients to decode the body incorrectly.</comment>
<file context>
@@ -0,0 +1,20 @@
+ 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));
</file context>
|
|
||
| @Override | ||
| public Object clone() { | ||
| return this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: clone() returns this, violating the clone contract for mutable DateFormat subclasses and causing callers to share a single mutable instance instead of getting an independent copy.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java, line 36:
<comment>clone() returns `this`, violating the clone contract for mutable DateFormat subclasses and causing callers to share a single mutable instance instead of getting an independent copy.</comment>
<file context>
@@ -0,0 +1,38 @@
+
+ @Override
+ public Object clone() {
+ return this;
+ }
+}
</file context>
| } | ||
| if (this.MarkerArray != null) | ||
| { | ||
| hashCode = (hashCode * 59) + this.MarkerArray.GetHashCode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: GetHashCode uses List.GetHashCode for MarkerArray while Equals performs deep comparison, breaking the equality contract for objects with equivalent list contents.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs, line 156:
<comment>GetHashCode uses List.GetHashCode for MarkerArray while Equals performs deep comparison, breaking the equality contract for objects with equivalent list contents.</comment>
<file context>
@@ -141,6 +151,10 @@ public override int GetHashCode()
}
+ if (this.MarkerArray != null)
+ {
+ hashCode = (hashCode * 59) + this.MarkerArray.GetHashCode();
+ }
if (this.File != null)
</file context>
| } | ||
| return Mono.fromCallable(() -> { | ||
| try { | ||
| byte[] content = readAllBytes(resource.getInputStream()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The InputStream from resource.getInputStream() is never closed and the blocking readAllBytes runs on the subscriber thread (no boundedElastic scheduler). This can leak file descriptors and block the Netty event loop in WebFlux.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java, line 72:
<comment>The InputStream from `resource.getInputStream()` is never closed and the blocking `readAllBytes` runs on the subscriber thread (no boundedElastic scheduler). This can leak file descriptors and block the Netty event loop in WebFlux.</comment>
<file context>
@@ -0,0 +1,415 @@
+ }
+ return Mono.fromCallable(() -> {
+ try {
+ byte[] content = readAllBytes(resource.getInputStream());
+ if (content.length == 0) {
+ throw new IllegalArgumentException("body content is empty");
</file context>
| int offset = 0; | ||
| for (DataBuffer buffer : buffers) { | ||
| int readable = buffer.readableByteCount(); | ||
| buffer.read(content, offset, readable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: DataBuffer instances from multipart Part content are consumed but never released, which can leak pooled Netty buffers under load. Release buffers after reading (DataBufferUtils.release) or use releaseConsumer to avoid native memory leaks.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java, line 194:
<comment>DataBuffer instances from multipart Part content are consumed but never released, which can leak pooled Netty buffers under load. Release buffers after reading (DataBufferUtils.release) or use releaseConsumer to avoid native memory leaks.</comment>
<file context>
@@ -0,0 +1,415 @@
+ int offset = 0;
+ for (DataBuffer buffer : buffers) {
+ int readable = buffer.readableByteCount();
+ buffer.read(content, offset, readable);
+ offset += readable;
+ }
</file context>
| @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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: In Spring WebFlux, @RequestParam only binds query parameters, so using it for application/x-www-form-urlencoded body fields will leave name/status null for typical form submissions. This breaks the form update endpoint.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java, line 309:
<comment>In Spring WebFlux, @RequestParam only binds query parameters, so using it for application/x-www-form-urlencoded body fields will leave name/status null for typical form submissions. This breaks the form update endpoint.</comment>
<file context>
@@ -306,8 +306,8 @@ default Mono<ResponseEntity<Void>> updatePet(
@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
</file context>
| @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<String> 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<String> enumFormStringArray, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: Form parameter enum_form_string_array declares a default in @ApiParam but @RequestParam omits defaultValue, so the default isn’t applied and missing values resolve to null.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java, line 428:
<comment>Form parameter enum_form_string_array declares a default in @ApiParam but @RequestParam omits defaultValue, so the default isn’t applied and missing values resolve to null.</comment>
<file context>
@@ -425,8 +425,8 @@ default Mono<ResponseEntity<Void>> testEnumParameters(
@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<String> 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<String> 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
</file context>
| @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List<String> enumFormStringArray, | |
| @ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false, defaultValue = "$") List<String> enumFormStringArray, |
| return new OpenAPI() | ||
| .info( | ||
| new Info() | ||
| .title("Multipart & Byte Edge Case Coverage") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: API title in generated SpringDoc config is HTML-escaped ("&") and no longer matches the source OpenAPI spec, leading to an incorrect title in the generated OpenAPI/Swagger UI output.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java, line 21:
<comment>API title in generated SpringDoc config is HTML-escaped ("&") and no longer matches the source OpenAPI spec, leading to an incorrect title in the generated OpenAPI/Swagger UI output.</comment>
<file context>
@@ -0,0 +1,27 @@
+ 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")
</file context>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 issues found across 97 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java:21">
P3: OpenAPI title is HTML-escaped in a Java string literal, so the title will render as "&" instead of "&".</violation>
</file>
<file name="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs">
<violation number="1" location="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs:156">
P2: GetHashCode uses List<T>.GetHashCode() for MarkerArray, which is reference-based, while Equals performs deep comparison via Compare.NET Objects. This breaks the equality/hash code contract for equal instances with equivalent list contents and can misbehave in Dictionary/HashSet.</violation>
</file>
<file name="samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java">
<violation number="1" location="samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java:316">
P2: In Spring WebFlux, @RequestParam only binds query parameters. For application/x-www-form-urlencoded POSTs, these parameters come from the request body, so name/status will not bind and will be null. Use @ModelAttribute or @RequestBody form data binding instead.</violation>
</file>
<file name="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java:36">
P2: RFC3339DateFormat.clone() returns the same mutable instance, violating the DateFormat/Cloneable contract and causing shared state when callers clone the formatter (e.g., for thread safety).</violation>
</file>
<file name="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java:51">
P2: Unclosed InputStream and blocking I/O in `Mono.fromCallable` can leak resources and block the WebFlux event loop. Use try-with-resources to close the stream and offload blocking reads to `Schedulers.boundedElastic()`.</violation>
<violation number="2" location="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java:194">
P2: Reactive multipart handlers consume DataBuffer instances without releasing them, which can leak pooled buffers in WebFlux.</violation>
</file>
<file name="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs">
<violation number="1" location="samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs:526">
P2: markerArray is serialized with ParameterToString in multipart requests, which calls ToString on each complex object and produces a debug string rather than JSON. This likely sends invalid data for a list of MultipartMixedRequestMarker objects.</violation>
</file>
<file name="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java">
<violation number="1" location="samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java:36">
P2: clone() returns `this`, breaking the DateFormat clone contract and causing shared mutable state; this defeats thread-safe use of DateFormat clones.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| } | ||
| if (this.MarkerArray != null) | ||
| { | ||
| hashCode = (hashCode * 59) + this.MarkerArray.GetHashCode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: GetHashCode uses List.GetHashCode() for MarkerArray, which is reference-based, while Equals performs deep comparison via Compare.NET Objects. This breaks the equality/hash code contract for equal instances with equivalent list contents and can misbehave in Dictionary/HashSet.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Model/MultipartMixedRequest.cs, line 156:
<comment>GetHashCode uses List<T>.GetHashCode() for MarkerArray, which is reference-based, while Equals performs deep comparison via Compare.NET Objects. This breaks the equality/hash code contract for equal instances with equivalent list contents and can misbehave in Dictionary/HashSet.</comment>
<file context>
@@ -141,6 +151,10 @@ public override int GetHashCode()
}
+ if (this.MarkerArray != null)
+ {
+ hashCode = (hashCode * 59) + this.MarkerArray.GetHashCode();
+ }
if (this.File != null)
</file context>
| @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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: In Spring WebFlux, @RequestParam only binds query parameters. For application/x-www-form-urlencoded POSTs, these parameters come from the request body, so name/status will not bind and will be null. Use @ModelAttribute or @RequestBody form data binding instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java, line 316:
<comment>In Spring WebFlux, @RequestParam only binds query parameters. For application/x-www-form-urlencoded POSTs, these parameters come from the request body, so name/status will not bind and will be null. Use @ModelAttribute or @RequestBody form data binding instead.</comment>
<file context>
@@ -313,8 +313,8 @@ default Mono<Void> updatePet(
@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
</file context>
|
|
||
| @Override | ||
| public Object clone() { | ||
| return this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: RFC3339DateFormat.clone() returns the same mutable instance, violating the DateFormat/Cloneable contract and causing shared state when callers clone the formatter (e.g., for thread safety).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/RFC3339DateFormat.java, line 36:
<comment>RFC3339DateFormat.clone() returns the same mutable instance, violating the DateFormat/Cloneable contract and causing shared state when callers clone the formatter (e.g., for thread safety).</comment>
<file context>
@@ -0,0 +1,38 @@
+
+ @Override
+ public Object clone() {
+ return this;
+ }
+}
</file context>
| } | ||
|
|
||
| private Mono<Void> verifyBase64Content(String base64Value, String fieldName) { | ||
| try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Unclosed InputStream and blocking I/O in Mono.fromCallable can leak resources and block the WebFlux event loop. Use try-with-resources to close the stream and offload blocking reads to Schedulers.boundedElastic().
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java, line 51:
<comment>Unclosed InputStream and blocking I/O in `Mono.fromCallable` can leak resources and block the WebFlux event loop. Use try-with-resources to close the stream and offload blocking reads to `Schedulers.boundedElastic()`.</comment>
<file context>
@@ -0,0 +1,415 @@
+ }
+
+ private Mono<Void> verifyBase64Content(String base64Value, String fieldName) {
+ try {
+ byte[] decoded = Base64.getDecoder().decode(base64Value);
+ logger.debug("Base64 decoded successfully for field: {}", fieldName);
</file context>
| int offset = 0; | ||
| for (DataBuffer buffer : buffers) { | ||
| int readable = buffer.readableByteCount(); | ||
| buffer.read(content, offset, readable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Reactive multipart handlers consume DataBuffer instances without releasing them, which can leak pooled buffers in WebFlux.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/api/CoverageApiTestControllerImpl.java, line 194:
<comment>Reactive multipart handlers consume DataBuffer instances without releasing them, which can leak pooled buffers in WebFlux.</comment>
<file context>
@@ -0,0 +1,415 @@
+ int offset = 0;
+ for (DataBuffer buffer : buffers) {
+ int readable = buffer.readableByteCount();
+ buffer.read(content, offset, readable);
+ offset += readable;
+ }
</file context>
| } | ||
| if (markerArray != null) | ||
| { | ||
| localVarRequestOptions.FormParameters.Add("markerArray", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(markerArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(markerArray)); // form parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: markerArray is serialized with ParameterToString in multipart requests, which calls ToString on each complex object and produces a debug string rather than JSON. This likely sends invalid data for a list of MultipartMixedRequestMarker objects.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs, line 526:
<comment>markerArray is serialized with ParameterToString in multipart requests, which calls ToString on each complex object and produces a debug string rather than JSON. This likely sends invalid data for a list of MultipartMixedRequestMarker objects.</comment>
<file context>
@@ -515,6 +521,10 @@ public Org.OpenAPITools.Client.ApiResponse<Object> MultipartMixedWithHttpInfo(Mu
}
+ 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);
</file context>
| localVarRequestOptions.FormParameters.Add("markerArray", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(markerArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(markerArray)); // form parameter | |
| localVarRequestOptions.FormParameters.Add("markerArray", Org.OpenAPITools.Client.ClientUtils.Serialize(markerArray)); // form parameter |
|
|
||
| @Override | ||
| public Object clone() { | ||
| return this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: clone() returns this, breaking the DateFormat clone contract and causing shared mutable state; this defeats thread-safe use of DateFormat clones.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases-reactive/src/main/java/org/openapitools/RFC3339DateFormat.java, line 36:
<comment>clone() returns `this`, breaking the DateFormat clone contract and causing shared mutable state; this defeats thread-safe use of DateFormat clones.</comment>
<file context>
@@ -0,0 +1,38 @@
+
+ @Override
+ public Object clone() {
+ return this;
+ }
+}
</file context>
| return new OpenAPI() | ||
| .info( | ||
| new Info() | ||
| .title("Multipart & Byte Edge Case Coverage") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: OpenAPI title is HTML-escaped in a Java string literal, so the title will render as "&" instead of "&".
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-byte-format-edge-cases/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java, line 21:
<comment>OpenAPI title is HTML-escaped in a Java string literal, so the title will render as "&" instead of "&".</comment>
<file context>
@@ -0,0 +1,27 @@
+ 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")
</file context>
This change updates the generator to correctly map OpenAPI
format: bytefields across all locations.format: byteis generated asString(manual Base64 decoding required).String.format: binary):MultipartFile.byte[], with automatic Base64 decoding via Jackson.application/octet-stream):Resourcefor streaming, no decoding applied.This ensures all
format: bytevalues are correctly typed across parameters and bodies, preserving the distinction between Base64-encoded values and raw binary.The changes are practically limited to
QueryParam; PathParam; HeaderParam; CookieParam; FormParam. But all the other types are asserted as well to prevent accidental regression.fixes #22898
Tests performed:
Verified generated Java files for query, path, header, cookie, form, multipart, JSON body, and binary body fields.
Asserts confirm parameters and properties have the expected types (String, byte[], MultipartFile, Resource).
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)"fixes #123"present in the PR description)Summary by cubic
Convert byte[] operation parameters to String in the Java Spring generator for query, path, header, cookie, and form. Fixes base64 handling and reactive multipart text binding; adds CoverageApi endpoints and MVC/WebFlux edge‑case samples to CI.
Bug Fixes
Migration
Written for commit 20a0ae2. Summary will update on new commits.