Skip to content

[java][microprofile] Emit List<File> to upload multiple files when declaring an array of binary forms - #24453

Merged
wing328 merged 1 commit into
OpenAPITools:masterfrom
Ignacio-Vidal:java-microprofile-files-upload
Jul 26, 2026
Merged

[java][microprofile] Emit List<File> to upload multiple files when declaring an array of binary forms#24453
wing328 merged 1 commit into
OpenAPITools:masterfrom
Ignacio-Vidal:java-microprofile-files-upload

Conversation

@Ignacio-Vidal

@Ignacio-Vidal Ignacio-Vidal commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

A type: array of format: binary form properties was collapsed onto the scalar File type, so a multi-file upload was generated with the same signature as a single-file one — only the array dimension was silently dropped, and only one file could ever be sent.

Given:

files:
  type: array
  items:
    type: string
    format: binary

Before (identical to the single-file signature):

void uploadMultiple(@FormParam("files") File filesDetail, @FormParam("description") String description);

After:

void uploadMultiple(@FormParam("files") List<File> filesDetail, @FormParam("description") String description);

A single binary property is still bound to a scalar File, so existing specs are unaffected — the petstore samples are byte-identical to master.

isArray was already populated on file parameters, so this is a template-only change (formParams.mustache and formParamsImpl.mustache);

This is the client-side counterpart of #24455, which fixes the same limitation in jaxrs-spec. The two are independent and can be merged in either order.

Testing

  • 1 new test in JavaClientCodegenTest (testMicroprofileFormMultipartArray), reusing the existing 3_0/form-multipart-binary-array.yaml fixture and following the same shape as the neighbouring testRestTemplateFormMultipart/testWebClientFormMultipart tests.

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    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.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Fixes multi-file uploads in the Java MicroProfile client by preserving the array dimension for binary form fields. Multi-file params now generate as List<File>; single-file stays File.

  • Bug Fixes
    • Generate @FormParam("...") List<File> paramDetail for type: array + format: binary; scalar stays File.
    • Updated templates: formParams.mustache, formParamsImpl.mustache; no DefaultCodegen changes.
    • Added testMicroprofileFormMultipartArray using 3_0/form-multipart-binary-array.yaml; all tests pass.

Written for commit ec060f6. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@Ignacio-Vidal
Ignacio-Vidal marked this pull request as draft July 26, 2026 02:10
A `type: array` of `format: binary` form properties was collapsed onto the
scalar `File` type, so a multi-file upload was generated with the same
signature as a single-file one and only one file could ever be sent.

The array dimension is now preserved and such a parameter is generated as
`List<File>`. A single binary property is still bound to a scalar `File`, so
existing specs are unaffected.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@Ignacio-Vidal

Copy link
Copy Markdown
Contributor Author

@wing328 - any chance you could review?

@Ignacio-Vidal Ignacio-Vidal changed the title [java][microprofile] Bind an array of binary form properties to a list [java][microprofile] Emit List<File> to upload multiple files when declaring an array of binary forms Jul 26, 2026
@wing328
wing328 merged commit f191c70 into OpenAPITools:master Jul 26, 2026
15 checks passed
@wing328

wing328 commented Jul 26, 2026

Copy link
Copy Markdown
Member

lgtm. thanks for the fix

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.

2 participants