Skip to content

Commit b8f9e99

Browse files
authored
better support for multipart (#3736)
1 parent 158cdfe commit b8f9e99

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -2661,7 +2661,7 @@ public CodegenOperation fromOperation(String path,
26612661
if (requestBody != null) {
26622662
if (getContentType(requestBody) != null &&
26632663
(getContentType(requestBody).toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
2664-
getContentType(requestBody).toLowerCase(Locale.ROOT).startsWith("multipart/form-data"))) {
2664+
getContentType(requestBody).toLowerCase(Locale.ROOT).startsWith("multipart"))) {
26652665
// process form parameters
26662666
formParams = fromRequestBodyToFormParameters(requestBody, imports);
26672667
for (CodegenParameter cp : formParams) {
@@ -4464,7 +4464,7 @@ public boolean hasFormParameter(OpenAPI openAPI, Operation operation) {
44644464
for (String consume : consumesInfo) {
44654465
if (consume != null &&
44664466
consume.toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
4467-
consume.toLowerCase(Locale.ROOT).startsWith("multipart/form-data")) {
4467+
consume.toLowerCase(Locale.ROOT).startsWith("multipart")) {
44684468
return true;
44694469
}
44704470
}
@@ -4907,7 +4907,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set<String> imports, S
49074907
LOGGER.warn("The following schema has undefined (null) baseType. " +
49084908
"It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. " +
49094909
"A correct 'consumes' for form parameters should be " +
4910-
"'application/x-www-form-urlencoded' or 'multipart/form-data'");
4910+
"'application/x-www-form-urlencoded' or 'multipart/?'");
49114911
LOGGER.warn("schema: " + schema);
49124912
LOGGER.warn("codegenModel is null. Default to UNKNOWN_BASE_TYPE");
49134913
codegenModelName = "UNKNOWN_BASE_TYPE";

0 commit comments

Comments
 (0)