mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 11:23:58 +00:00
Merge pull request #2563 from neilotoole/issue-2561-post-process-params
Issue #2561 : set isXYZParam flags before postProcessParameter [updated]
This commit is contained in:
commit
01ad3c3d3a
@ -1578,33 +1578,20 @@ public class DefaultCodegen {
|
||||
|
||||
|
||||
allParams.add(p);
|
||||
// Issue #2561 (neilotoole) : Moved setting of is<Type>Param flags
|
||||
// from here to fromParameter().
|
||||
if (param instanceof QueryParameter) {
|
||||
p.isQueryParam = new Boolean(true);
|
||||
queryParams.add(p.copy());
|
||||
} else if (param instanceof PathParameter) {
|
||||
p.required = true;
|
||||
p.isPathParam = new Boolean(true);
|
||||
pathParams.add(p.copy());
|
||||
} else if (param instanceof HeaderParameter) {
|
||||
p.isHeaderParam = new Boolean(true);
|
||||
headerParams.add(p.copy());
|
||||
} else if (param instanceof CookieParameter) {
|
||||
p.isCookieParam = new Boolean(true);
|
||||
cookieParams.add(p.copy());
|
||||
} else if (param instanceof BodyParameter) {
|
||||
p.isBodyParam = new Boolean(true);
|
||||
p.isBinary = p.dataType.toLowerCase().startsWith("byte");
|
||||
bodyParam = p;
|
||||
bodyParams.add(p.copy());
|
||||
} else if (param instanceof FormParameter) {
|
||||
if ("file".equalsIgnoreCase(((FormParameter) param).getType())) {
|
||||
p.isFile = true;
|
||||
} else if("file".equals(p.baseType)){
|
||||
p.isFile = true;
|
||||
} else {
|
||||
p.notFile = true;
|
||||
}
|
||||
p.isFormParam = new Boolean(true);
|
||||
formParams.add(p.copy());
|
||||
}
|
||||
if (p.required == null || !p.required) {
|
||||
@ -1932,6 +1919,33 @@ public class DefaultCodegen {
|
||||
// should be overridden by lang codegen
|
||||
setParameterExampleValue(p);
|
||||
|
||||
// Issue #2561 (neilotoole) : Set the is<TYPE>Param flags.
|
||||
// This code has been moved to here from #fromOperation
|
||||
// because these values should be set before calling #postProcessParameter.
|
||||
// See: https://github.com/swagger-api/swagger-codegen/issues/2561
|
||||
if (param instanceof QueryParameter) {
|
||||
p.isQueryParam = true;
|
||||
} else if (param instanceof PathParameter) {
|
||||
p.required = true;
|
||||
p.isPathParam = true;
|
||||
} else if (param instanceof HeaderParameter) {
|
||||
p.isHeaderParam = true;
|
||||
} else if (param instanceof CookieParameter) {
|
||||
p.isCookieParam = true;
|
||||
} else if (param instanceof BodyParameter) {
|
||||
p.isBodyParam = true;
|
||||
p.isBinary = p.dataType.toLowerCase().startsWith("byte");
|
||||
} else if (param instanceof FormParameter) {
|
||||
if ("file".equalsIgnoreCase(((FormParameter) param).getType())) {
|
||||
p.isFile = true;
|
||||
} else if("file".equals(p.baseType)){
|
||||
p.isFile = true;
|
||||
} else {
|
||||
p.notFile = true;
|
||||
}
|
||||
p.isFormParam = true;
|
||||
}
|
||||
|
||||
postProcessParameter(p);
|
||||
return p;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user