forked from loafle/openapi-generator-original
better support for multipart (#3736)
This commit is contained in:
parent
158cdfeb3c
commit
b8f9e995ce
@ -2661,7 +2661,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
if (requestBody != null) {
|
if (requestBody != null) {
|
||||||
if (getContentType(requestBody) != null &&
|
if (getContentType(requestBody) != null &&
|
||||||
(getContentType(requestBody).toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
|
(getContentType(requestBody).toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
|
||||||
getContentType(requestBody).toLowerCase(Locale.ROOT).startsWith("multipart/form-data"))) {
|
getContentType(requestBody).toLowerCase(Locale.ROOT).startsWith("multipart"))) {
|
||||||
// process form parameters
|
// process form parameters
|
||||||
formParams = fromRequestBodyToFormParameters(requestBody, imports);
|
formParams = fromRequestBodyToFormParameters(requestBody, imports);
|
||||||
for (CodegenParameter cp : formParams) {
|
for (CodegenParameter cp : formParams) {
|
||||||
@ -4464,7 +4464,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
for (String consume : consumesInfo) {
|
for (String consume : consumesInfo) {
|
||||||
if (consume != null &&
|
if (consume != null &&
|
||||||
consume.toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
|
consume.toLowerCase(Locale.ROOT).startsWith("application/x-www-form-urlencoded") ||
|
||||||
consume.toLowerCase(Locale.ROOT).startsWith("multipart/form-data")) {
|
consume.toLowerCase(Locale.ROOT).startsWith("multipart")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4907,7 +4907,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
LOGGER.warn("The following schema has undefined (null) baseType. " +
|
LOGGER.warn("The following schema has undefined (null) baseType. " +
|
||||||
"It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. " +
|
"It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. " +
|
||||||
"A correct 'consumes' for form parameters should be " +
|
"A correct 'consumes' for form parameters should be " +
|
||||||
"'application/x-www-form-urlencoded' or 'multipart/form-data'");
|
"'application/x-www-form-urlencoded' or 'multipart/?'");
|
||||||
LOGGER.warn("schema: " + schema);
|
LOGGER.warn("schema: " + schema);
|
||||||
LOGGER.warn("codegenModel is null. Default to UNKNOWN_BASE_TYPE");
|
LOGGER.warn("codegenModel is null. Default to UNKNOWN_BASE_TYPE");
|
||||||
codegenModelName = "UNKNOWN_BASE_TYPE";
|
codegenModelName = "UNKNOWN_BASE_TYPE";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user