forked from loafle/openapi-generator-original
Add all required parameters as default constructor parameters #1294
This commit is contained in:
@@ -13,6 +13,13 @@ public class CodegenModel {
|
||||
public String unescapedDescription;
|
||||
public String defaultValue;
|
||||
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>();
|
||||
|
||||
// list of all required parameters
|
||||
public Set<String> mandatory = new HashSet<String>();
|
||||
|
||||
// TODO: temporary solution to get a delimited list of default constructor parameters, should be replaced if there is a better way of injecting the mandatory parameters into the mustache templates
|
||||
public String mandatoryParams;
|
||||
|
||||
public Set<String> imports = new HashSet<String>();
|
||||
public Boolean hasVars, emptyVars, hasMoreModels, hasEnums;
|
||||
public ExternalDocs externalDocs;
|
||||
|
||||
@@ -1881,6 +1881,10 @@ public class DefaultCodegen {
|
||||
m.vars.add(cp);
|
||||
}
|
||||
}
|
||||
|
||||
m.mandatory = mandatory;
|
||||
m.mandatoryParams = StringUtils.join(mandatory, ", ");
|
||||
|
||||
} else {
|
||||
m.emptyVars = true;
|
||||
m.hasVars = false;
|
||||
|
||||
Reference in New Issue
Block a user