mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 08:31:23 +00:00
[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 <bruno.matissek@gmail.com>
This commit is contained in:
@@ -20,11 +20,7 @@ package org.openapitools.codegen.languages;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.meta.features.DocumentationFeature;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
@@ -146,15 +142,18 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
||||
.filter(op -> op.consumes.stream().anyMatch(opc -> opc.values().stream().anyMatch("multipart/form-data"::equals)))
|
||||
.forEach(op -> {
|
||||
op.vendorExtensions.putIfAbsent("multipartFormData", true);
|
||||
op.allParams.stream()
|
||||
.filter(param -> param.isFormParam)
|
||||
.filter(param -> param.isArray)
|
||||
.filter(param -> param.dataFormat.equals("binary"))
|
||||
.forEach(param -> param.isCollectionFormatMulti = true);
|
||||
});
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessParameter(CodegenParameter parameter) {
|
||||
super.postProcessParameter(parameter);
|
||||
if (parameter.isFormParam && parameter.isArray && "binary".equals(parameter.dataFormat)) {
|
||||
parameter.isCollectionFormatMulti = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
|
||||
Map<String, Object> result = super.postProcessAllModels(objs);
|
||||
|
||||
Reference in New Issue
Block a user