Skip to content

Commit

Permalink
better support for multipart (#3736)
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Aug 24, 2019
1 parent 158cdfe commit b8f9e99
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2661,7 +2661,7 @@ public CodegenOperation fromOperation(String path,
if (requestBody != null) {
if (getContentType(requestBody) != null &&
(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
formParams = fromRequestBodyToFormParameters(requestBody, imports);
for (CodegenParameter cp : formParams) {
Expand Down Expand Up @@ -4464,7 +4464,7 @@ public boolean hasFormParameter(OpenAPI openAPI, Operation operation) {
for (String consume : consumesInfo) {
if (consume != null &&
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;
}
}
Expand Down Expand Up @@ -4907,7 +4907,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set<String> imports, S
LOGGER.warn("The following schema has undefined (null) baseType. " +
"It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. " +
"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("codegenModel is null. Default to UNKNOWN_BASE_TYPE");
codegenModelName = "UNKNOWN_BASE_TYPE";
Expand Down

0 comments on commit b8f9e99

Please sign in to comment.