Minor fix to body parameter in required parameter list (#6885)

* minor fix to required parameter list

* better if then else block
This commit is contained in:
wing328 2017-11-05 10:22:36 +08:00 committed by GitHub
parent cd1c2b13e3
commit 37184a1cd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2227,17 +2227,7 @@ public class DefaultCodegen {
} }
} }
// set isPrimitiveType and baseType for allParams
/*if (languageSpecificPrimitives.contains(p.baseType)) {
p.isPrimitiveType = true;
p.baseType = getSwaggerType(p);
}*/
allParams.add(p); allParams.add(p);
if (p.required || p.isBodyParam) {
requiredParams.add(p.copy());
}
// Issue #2561 (neilotoole) : Moved setting of is<Type>Param flags // Issue #2561 (neilotoole) : Moved setting of is<Type>Param flags
// from here to fromParameter(). // from here to fromParameter().
if (param instanceof QueryParameter) { if (param instanceof QueryParameter) {
@ -2257,7 +2247,10 @@ public class DefaultCodegen {
} else if (param instanceof FormParameter) { } else if (param instanceof FormParameter) {
formParams.add(p.copy()); formParams.add(p.copy());
} }
if (!p.required) {
if (p.required) { //required parameters
requiredParams.add(p.copy());
} else { // optional parameters
op.hasOptionalParams = true; op.hasOptionalParams = true;
} }
} }