Generate @RequestPart parameters for multipart/form-data controllers - #389
Merged
jemacineiras merged 2 commits intoJul 31, 2026
Merged
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
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.
The server interface template collapsed a multipart/form-data body into a single immutable wrapper DTO passed as a bare @Valid parameter, with no @RequestPart/@RequestParam binding and no consumes declaration, so the generated controller could not bind multipart requests. Now each part of the form-data schema is exposed as its own @RequestPart parameter (files as MultipartFile / List<MultipartFile>), the @RequestMapping declares consumes = MediaType.MULTIPART_FORM_DATA_VALUE, and the now-unused wrapper model is no longer generated (OpenApiUtil.processRequestBody skips multipart/form-data bodies). Extends the testFormDataMultipartGeneration fixture with a file-array part and updates the golden interface accordingly. Fixes sngular#388 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-requestpart
branch
from
July 31, 2026 08:37
924f108 to
a049334
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
Makes generated Spring controllers actually usable for
multipart/form-datarequest bodies. Closes #388.Each part of the form-data schema is now exposed as its own
@RequestPartparameter, files are typed asMultipartFile/List<MultipartFile>, and the endpoint declaresconsumes = MediaType.MULTIPART_FORM_DATA_VALUE. The unused immutable wrapper DTO is no longer generated.Why
Previously the whole multipart body was collapsed into one immutable
@Valuewrapper DTO passed as a bare@Validparameter — no@RequestPart/@RequestParam, noconsumes, and unbindable by Spring at runtime (see #388).Change
template.ftlh: when the request is form-data, emit one@RequestPart(value = "<part>", required = <req>)per schema property; addconsumes = {MediaType.MULTIPART_FORM_DATA_VALUE}to@RequestMapping; importMultipartFilewhen a file part is present; stop importing the wrapper type.OpenApiUtil.processRequestBody: skip generating a wrapper model formultipart/form-databodies.Before / after
Test
testFormDataMultipartGenerationfixture with asomeFilesfile-array part and updated the goldenTestApi.java.Tests run: 118, Failures: 0, Errors: 0.Version
Bumps
6.6.1→6.6.2across engine, Maven plugin and Gradle plugin.Note
Builds on #387 (
List<MultipartFile>array mapping, now merged); thesomeFilesfile-array part in the test relies on that fix. Rebased ontomain, so this PR contains only its own two commits.🤖 Generated with Claude Code