Skip to content

Preserve individual multipart part encodings - #3461

Open
6londe wants to merge 1 commit into
springdoc:mainfrom
6londe:fix/multipart-part-encoding
Open

6londe wants to merge 1 commit into
springdoc:mainfrom
6londe:fix/multipart-part-encoding

Conversation

@6londe

@6londe 6londe commented Dec 2, 2026

Copy link
Copy Markdown

Problem

When multiple @RequestPart parameters declare individual content types through @Parameter(content = @Content(...)), the first part can create the multipart media entry and its encoding. A later part then reuses the existing entry, and its encoding is omitted. The same omission can occur when the method-level request body already declares an encoding for a different part.

Change

Merge inferred encodings into the existing multipart entry. Preserve explicitly declared values for an existing part name. Copy the encoding map before adding entries so the merge also works with immutable maps.

Validation

On current main (4951052), both new regression cases failed and three related historical tests passed. The regressions check the generated OpenAPI document for both part types and for explicit encoding precedence. The Spring MVC test also sends a multipart request and checks that the controller reads the JSON part.

The patched Maven reactor passed 903 tests across the common, WebMVC API, and WebFlux API modules.

./mvnw -B -ntp -pl springdoc-openapi-starter-webmvc-api,springdoc-openapi-starter-webflux-api -am test

Local verification used JDK 21 and Maven settings that resolve released dependencies from Maven Central.

AI use

Codex investigated, implemented, and verified the contribution under the contributor's standing authorization. It has yet to receive a human review.

Merge inferred encodings into the existing multipart entry and retain explicit per-part encodings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant