Skip to content

Commit a6df340

Browse files
author
Evan Fossier
committed
Expose readOnly attribute on model properties to templates, can now use isReadOnly property in model templates
1 parent 9e5de7d commit a6df340

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
@@ -32,6 +32,7 @@ public class CodegenProperty {
3232
public Boolean hasMore = null, required = null, secondaryParam = null;
3333
public Boolean isPrimitiveType, isContainer, isNotContainer;
3434
public boolean isEnum;
35+
public Boolean isReadOnly = false;
3536
public List<String> _enum;
3637
public Map<String, Object> allowableValues;
3738
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
@@ -628,6 +628,7 @@ public CodegenProperty fromProperty(String name, Property p) {
628628
property.example = p.getExample();
629629
property.defaultValue = toDefaultValue(p);
630630
property.jsonSchema = Json.pretty(p);
631+
property.isReadOnly = p.getReadOnly();
631632

632633
String type = getSwaggerType(p);
633634
if (p instanceof AbstractNumericProperty) {

0 commit comments

Comments
 (0)