Parameter.required flag implemented

Made the "required" flag for Parameter objects available to the code generator templates
This commit is contained in:
Martin Ehrnhoefer 2014-10-20 15:50:00 +02:00
parent 053419234a
commit 0aa87cfbeb
2 changed files with 8 additions and 1 deletions

View File

@ -4,4 +4,10 @@ public class CodegenParameter {
public Boolean hasMore = null, isContainer = null, secondaryParam = null;
public String baseName, paramName, dataType, collectionFormat, description, baseType;
public Boolean isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam;
/**
* Determines whether this parameter is mandatory. If the parameter is in "path",
* this property is required and its value MUST be true. Otherwise, the property
* MAY be included and its default value is false.
*/
public boolean required;
}

View File

@ -636,7 +636,8 @@ public class DefaultCodegen {
CodegenParameter p = new CodegenParameter();
p.baseName = param.getName();
p.description = param.getDescription();
p.required = param.getRequired();
if(param instanceof SerializableParameter) {
SerializableParameter qp = (SerializableParameter) param;
Property property = null;