Generate @RequestPart parameters for reactive multipart/form-data controllers - #392
Merged
jemacineiras merged 2 commits intoJul 31, 2026
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 72 |
| Duplication | 3 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
…trollers templateReactive.ftlh had no multipart branch: it always wrapped the request body in Mono/Flux with @Valid @RequestBody, so reactive multipart uploads lacked @RequestPart binding and a consumes declaration. Now each form-data part is exposed as its own @RequestPart parameter using the WebFlux multipart API (single file -> FilePart, file array -> Flux<FilePart>, non-file parts keep their declared type), and the @RequestMapping declares consumes = MediaType.MULTIPART_FORM_DATA_VALUE. FilePart is imported only when a file part is present, and the (no longer generated) wrapper model is not imported. Adds a testReactiveFormDataMultipart fixture and golden interface. Fixes sngular#391 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
joseegman-idoneea
force-pushed
the
feat/multipart-reactive-requestpart
branch
from
July 31, 2026 08:50
ccbe20c to
b6bc584
Compare
jemacineiras
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
multipart/form-datasupport to the reactive (WebFlux) server interface template. Closes #391.Each form-data part is exposed as its own
@RequestPartparameter using the WebFlux multipart API, and the endpoint declaresconsumes = MediaType.MULTIPART_FORM_DATA_VALUE.Why
templateReactive.ftlhnever branched onrequest.isFormData— it always wrapped the body inMono/Fluxwith@Valid @RequestBody, so reactive multipart uploads had no@RequestPartbinding, noconsumes, and would rely on the Servlet-onlyMultipartFiletype (unsupported in WebFlux).Change
templateReactive.ftlh: for form-data requests, emit one@RequestPartper schema property via a small FreeMarker macro shared by both signature variants (with/withoutsecurities). File parts use the WebFlux types — single file →FilePart, file array →Flux<FilePart>— non-file parts keep their declared type. Addsconsumes, importsFilePartonly when a file part exists, and stops importing the (no longer generated) wrapper model.Generated output
Test
testReactiveFormDataMultipartfixture + goldenUploadApi.java.Tests run: 119, Failures: 0, Errors: 0.Version
Bumps
6.6.2→6.6.3across engine, Maven plugin and Gradle plugin.Note
Builds on #389 (annotated
@RequestPartmultipart controllers, now merged), which added the shared "don't generate a wrapper model for form-data" change. Rebased ontomain, so this PR contains only its own two commits.🤖 Generated with Claude Code