Align TypeScript multipart file array handling#1
Closed
hwisu wants to merge 2 commits into
Closed
Conversation
18b4a1c to
6e3eef5
Compare
6e3eef5 to
567e1e5
Compare
567e1e5 to
60313a4
Compare
Owner
Author
|
Superseded by upstream PR OpenAPITools#24133. |
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.
Summary
typescript-fetch,typescript-axios, andtypescript-inversify.parameter.items, not only from the array parameter's owndataFormat.AbstractTypeScriptClientCodegenso the TypeScript client family uses the same rule.typescript-fetch,typescript-axios, andtypescript-inversifygenerated output.Root Cause
For
type: arraywithitems: { type: string, format: binary }, the binary/file metadata is attached to the item schema. The affected TypeScript generators only checkedparameter.dataFormat == "binary", so the array parameter could miss file-array handling and fall back to csv-style form serialization instead of repeated multipart fields.Cross-Generator Consistency
This brings the TypeScript client generators in line with existing generator behavior for the same OpenAPI shape:
modules/openapi-generator/src/test/resources/3_0/form-multipart-binary-array.yamlalready defines the canonical multipart binary array case asfiles: { type: array, items: { type: string, format: binary } }.List<MultipartFile> fileswith@RequestPart("files").List<FormDataBodyPart> files.List<File>/Collection<Resource>and are added with repeatedformParams.addAll("files", ...)entries.So the fix does not introduce a new TypeScript-specific convention; it makes the TypeScript client generators honor the same item-level binary metadata that other generators already rely on.
Regression Safety
typescript-axiosandtypescript-inversifytemplates do not branch onisFile; they useisCollectionFormatMultifor repeated field serialization, so the change is scoped to the multipart array serialization path.typescript-axiosecho sample regeneration produced no diff.typescript-inversifypetstore sample regeneration produced no diff.typescript-fetchsample was re-generated after commit cleanup and committed exactly as generated.Validation
./mvnw -pl modules/openapi-generator -am -Dtest=TypeScriptFetchClientCodegenTest,TypeScriptAxiosClientCodegenTest,TypeScriptInversifyClientCodegenTest -Dsurefire.failIfNoSpecifiedTests=false test./bin/generate-samples.sh bin/configs/typescript-fetch-multipart-file-array.yaml./bin/generate-samples.sh bin/configs/typescript-axios-echo-api.yaml./bin/generate-samples.sh bin/configs/typescript-inversify.yaml./mvnw -pl modules/openapi-generator-cli -am -DskipTests package./mvnw clean package./bin/generate-samples.sh ./bin/configs/*.yaml./bin/utils/export_docs_generators.shRelated upstream issue: OpenAPITools#22597
PR checklist