forked from loafle/openapi-generator-original
fix csharp constructor for model with read-only 1st property
This commit is contained in:
@@ -25,6 +25,8 @@ public class CodegenModel {
|
||||
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>();
|
||||
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
|
||||
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
|
||||
public List<CodegenProperty> readOnlyVars = new ArrayList<CodegenProperty>(); // a list of read-only properties
|
||||
public List<CodegenProperty> readWriteVars = new ArrayList<CodegenProperty>(); // a list of properties for read, write
|
||||
public List<CodegenProperty> allVars;
|
||||
public Map<String, Object> allowableValues;
|
||||
|
||||
|
||||
@@ -2598,11 +2598,19 @@ public class DefaultCodegen {
|
||||
addImport(m, cp.complexType);
|
||||
vars.add(cp);
|
||||
|
||||
if (Boolean.TRUE.equals(cp.required)) { // if required, add to the list "requiredVars"
|
||||
// if required, add to the list "requiredVars"
|
||||
if (Boolean.TRUE.equals(cp.required)) {
|
||||
m.requiredVars.add(cp);
|
||||
} else { // else add to the list "optionalVars" for optional property
|
||||
m.optionalVars.add(cp);
|
||||
}
|
||||
|
||||
// if readonly, add to readOnlyVars (list of properties)
|
||||
if (Boolean.TRUE.equals(cp.isReadOnly)) {
|
||||
m.readOnlyVars.add(cp);
|
||||
} else { // else add to readWriteVars (list of properties)
|
||||
m.readWriteVars.add(cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user