Conditional copy properties from parent.

Pull request #946 broke the TypeScript generation with inheritance where a superclass defined an enum. This makes it up to each language to decide the behavior appropriate for the language.
This commit is contained in:
Mads Mætzke Tandrup 2015-07-25 07:45:08 +02:00
parent cde8d7ba4c
commit e924cec595
No known key found for this signature in database
GPG Key ID: 67056F406C84B14B
2 changed files with 3 additions and 1 deletions

View File

@ -80,6 +80,7 @@ public class DefaultCodegen {
protected List<SupportingFile> supportingFiles = new ArrayList<SupportingFile>(); protected List<SupportingFile> supportingFiles = new ArrayList<SupportingFile>();
protected List<CliOption> cliOptions = new ArrayList<CliOption>(); protected List<CliOption> cliOptions = new ArrayList<CliOption>();
protected boolean skipOverwrite; protected boolean skipOverwrite;
protected boolean copyPropertiesFromParents = true;
public List<CliOption> cliOptions() { public List<CliOption> cliOptions() {
return cliOptions; return cliOptions;
@ -533,7 +534,7 @@ public class DefaultCodegen {
final String parentRef = toModelName(parent.getSimpleRef()); final String parentRef = toModelName(parent.getSimpleRef());
m.parent = parentRef; m.parent = parentRef;
addImport(m, parentRef); addImport(m, parentRef);
if (allDefinitions != null) { if (copyPropertiesFromParents && allDefinitions != null) {
final Model parentModel = allDefinitions.get(parentRef); final Model parentModel = allDefinitions.get(parentRef);
if (parentModel instanceof ModelImpl) { if (parentModel instanceof ModelImpl) {
final ModelImpl _parent = (ModelImpl) parentModel; final ModelImpl _parent = (ModelImpl) parentModel;

View File

@ -30,6 +30,7 @@ public class TypeScriptNodeClientCodegen extends DefaultCodegen implements Codeg
public TypeScriptNodeClientCodegen() { public TypeScriptNodeClientCodegen() {
super(); super();
copyPropertiesFromParents = false;
outputFolder = "generated-code/typescript-node"; outputFolder = "generated-code/typescript-node";
modelTemplateFiles.put("model.mustache", ".ts"); modelTemplateFiles.put("model.mustache", ".ts");
apiTemplateFiles.put("api.mustache", ".ts"); apiTemplateFiles.put("api.mustache", ".ts");