Skip to content

Commit e732804

Browse files
BrMtsskbmatissek
andauthored
[BUG][typescript-axios] Sets 'isCollectionFormatMulti' flag to true on multiple file uploads (#8105)
* [typescript-axios] Sets 'isCollectionFormatMulti' to true on file uploads. Fixes #8104 * Safely checks if dateFormat is "binary" #8105 Co-authored-by: Bruno Matissek <[email protected]>
1 parent a3aa199 commit e732804

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@
2020
import io.swagger.v3.oas.models.media.Schema;
2121
import io.swagger.v3.parser.util.SchemaTypeUtil;
2222
import org.apache.commons.lang3.StringUtils;
23-
import org.openapitools.codegen.CliOption;
24-
import org.openapitools.codegen.CodegenModel;
25-
import org.openapitools.codegen.CodegenProperty;
26-
import org.openapitools.codegen.CodegenOperation;
27-
import org.openapitools.codegen.SupportingFile;
23+
import org.openapitools.codegen.*;
2824
import org.openapitools.codegen.meta.features.DocumentationFeature;
2925
import org.openapitools.codegen.utils.ModelUtils;
3026

@@ -146,15 +142,18 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o
146142
.filter(op -> op.consumes.stream().anyMatch(opc -> opc.values().stream().anyMatch("multipart/form-data"::equals)))
147143
.forEach(op -> {
148144
op.vendorExtensions.putIfAbsent("multipartFormData", true);
149-
op.allParams.stream()
150-
.filter(param -> param.isFormParam)
151-
.filter(param -> param.isArray)
152-
.filter(param -> param.dataFormat.equals("binary"))
153-
.forEach(param -> param.isCollectionFormatMulti = true);
154145
});
155146
return objs;
156147
}
157148

149+
@Override
150+
public void postProcessParameter(CodegenParameter parameter) {
151+
super.postProcessParameter(parameter);
152+
if (parameter.isFormParam && parameter.isArray && "binary".equals(parameter.dataFormat)) {
153+
parameter.isCollectionFormatMulti = true;
154+
}
155+
}
156+
158157
@Override
159158
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
160159
Map<String, Object> result = super.postProcessAllModels(objs);

0 commit comments

Comments
 (0)