Skip to content

Commit d09d8bb

Browse files
committed
Merge pull request #1269 from efossier/expose-readonly-to-template
Expose readOnly attribute on model properties to templates
2 parents 85f9993 + a6df340 commit d09d8bb

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class CodegenProperty {
3434
public Boolean hasMore = null, required = null, secondaryParam = null;
3535
public Boolean isPrimitiveType, isContainer, isNotContainer;
3636
public boolean isEnum;
37+
public Boolean isReadOnly = false;
3738
public List<String> _enum;
3839
public Map<String, Object> allowableValues;
3940
public CodegenProperty items;

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ public CodegenProperty fromProperty(String name, Property p) {
642642
property.example = p.getExample();
643643
property.defaultValue = toDefaultValue(p);
644644
property.jsonSchema = Json.pretty(p);
645+
property.isReadOnly = p.getReadOnly();
645646

646647
String type = getSwaggerType(p);
647648
if (p instanceof AbstractNumericProperty) {

0 commit comments

Comments
 (0)