Merge pull request #1269 from efossier/expose-readonly-to-template

Expose readOnly attribute on model properties to templates
This commit is contained in:
wing328 2015-09-23 09:29:49 +08:00
commit d09d8bb495
2 changed files with 2 additions and 0 deletions

View File

@ -34,6 +34,7 @@ public class CodegenProperty {
public Boolean hasMore = null, required = null, secondaryParam = null; public Boolean hasMore = null, required = null, secondaryParam = null;
public Boolean isPrimitiveType, isContainer, isNotContainer; public Boolean isPrimitiveType, isContainer, isNotContainer;
public boolean isEnum; public boolean isEnum;
public Boolean isReadOnly = false;
public List<String> _enum; public List<String> _enum;
public Map<String, Object> allowableValues; public Map<String, Object> allowableValues;
public CodegenProperty items; public CodegenProperty items;

View File

@ -642,6 +642,7 @@ public class DefaultCodegen {
property.example = p.getExample(); property.example = p.getExample();
property.defaultValue = toDefaultValue(p); property.defaultValue = toDefaultValue(p);
property.jsonSchema = Json.pretty(p); property.jsonSchema = Json.pretty(p);
property.isReadOnly = p.getReadOnly();
String type = getSwaggerType(p); String type = getSwaggerType(p);
if (p instanceof AbstractNumericProperty) { if (p instanceof AbstractNumericProperty) {