mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 20:50:55 +00:00
add postProcessParamter for body, form parameter (#263)
This commit is contained in:
parent
2ce721d0b9
commit
80c8b92cb5
@ -1150,7 +1150,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
if (StringUtils.isNotEmpty(schemaName)) {
|
if (StringUtils.isNotEmpty(schemaName)) {
|
||||||
return getAlias(schemaName);
|
return getAlias(schemaName);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.warn("Error obtaining the datatype from ref:" + schema.get$ref()+ ". Default to 'object'");
|
LOGGER.warn("Error obtaining the datatype from ref:" + schema.get$ref() + ". Default to 'object'");
|
||||||
return "object";
|
return "object";
|
||||||
}
|
}
|
||||||
} else { // primitive type (non-model)
|
} else { // primitive type (non-model)
|
||||||
@ -2212,6 +2212,9 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
"multipart/form-data".equalsIgnoreCase(getContentType(requestBody))) {
|
"multipart/form-data".equalsIgnoreCase(getContentType(requestBody))) {
|
||||||
// process form parameters
|
// process form parameters
|
||||||
formParams = fromRequestBodyToFormParameters(requestBody, schemas, imports);
|
formParams = fromRequestBodyToFormParameters(requestBody, schemas, imports);
|
||||||
|
for (CodegenParameter cp : formParams) {
|
||||||
|
postProcessParameter(cp);
|
||||||
|
}
|
||||||
// add form parameters to the beginning of all parameter list
|
// add form parameters to the beginning of all parameter list
|
||||||
if (prependFormOrBodyParameters) {
|
if (prependFormOrBodyParameters) {
|
||||||
for (CodegenParameter cp : formParams) {
|
for (CodegenParameter cp : formParams) {
|
||||||
@ -2225,6 +2228,8 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
bodyParam = fromRequestBody(requestBody, schemas, imports);
|
bodyParam = fromRequestBody(requestBody, schemas, imports);
|
||||||
bodyParam.description = requestBody.getDescription();
|
bodyParam.description = requestBody.getDescription();
|
||||||
|
postProcessParameter(bodyParam);
|
||||||
|
|
||||||
bodyParams.add(bodyParam);
|
bodyParams.add(bodyParam);
|
||||||
|
|
||||||
if (prependFormOrBodyParameters) {
|
if (prependFormOrBodyParameters) {
|
||||||
@ -3195,9 +3200,9 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
for (Map.Entry<String, Schema> entry : schemas.entrySet()) {
|
for (Map.Entry<String, Schema> entry : schemas.entrySet()) {
|
||||||
String oasName = entry.getKey();
|
String oasName = entry.getKey();
|
||||||
Schema schema = entry.getValue();
|
Schema schema = entry.getValue();
|
||||||
String typeType = getPrimitiveType(schema);
|
String schemaType = getPrimitiveType(schema);
|
||||||
if (typeType != null && !typeType.equals("object") && !typeType.equals("array") && schema.getEnum() == null) {
|
if (schemaType != null && !schemaType.equals("object") && !schemaType.equals("array") && schema.getEnum() == null) {
|
||||||
aliases.put(oasName, typeType);
|
aliases.put(oasName, schemaType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user