Skip to content

Commit

Permalink
Revert "Fix issue swagger-api#2449: SubClass annotations are missing …
Browse files Browse the repository at this point in the history
…from the base class."

This reverts commit ff0cefe.
  • Loading branch information
Yael Aharon committed Mar 30, 2016
1 parent ff0cefe commit e021a99
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class CodegenModel {
// References to parent and interface CodegenModels. Only set when code generator supports inheritance.
public CodegenModel parentModel;
public List<CodegenModel> interfaceModels;
public List<CodegenModel> children;

public String name, classname, description, classVarName, modelJson, dataType;
public String classFilename; // store the class file name, mainly used for import
Expand All @@ -27,7 +26,7 @@ public class CodegenModel {
public Set<String> allMandatory;

public Set<String> imports = new TreeSet<String>();
public Boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasChildren, hasMoreChildren;
public Boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum;
public ExternalDocs externalDocs;

public Map<String, Object> vendorExtensions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,6 @@ public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
}
}
}
// Let parent know about all its children
for (String name : allModels.keySet()) {
CodegenModel cm = allModels.get(name);
if (cm.parent == null) continue;
CodegenModel parent = allModels.get(cm.parent);
if (parent.children == null) {
parent.children = new ArrayList<CodegenModel>();
} else {
parent.children.get(parent.children.size() - 1).hasMoreChildren = Boolean.TRUE;
}
parent.children.add(cm);
parent.hasChildren = true;
}
}
return objs;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {

public JavaClientCodegen() {
super();
supportsInheritance = true;
outputFolder = "generated-code" + File.separator + "java";
modelTemplateFiles.put("model.mustache", ".java");
apiTemplateFiles.put("api.mustache", ".java");
Expand Down Expand Up @@ -236,8 +235,6 @@ public void processOpts() {
importMapping.put("ApiModelProperty", "io.swagger.annotations.ApiModelProperty");
importMapping.put("ApiModel", "io.swagger.annotations.ApiModel");
importMapping.put("JsonProperty", "com.fasterxml.jackson.annotation.JsonProperty");
importMapping.put("JsonSubTypes", "com.fasterxml.jackson.annotation.JsonSubTypes");
importMapping.put("JsonTypeInfo", "com.fasterxml.jackson.annotation.JsonTypeInfo");
importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue");
importMapping.put("Objects", "java.util.Objects");
importMapping.put("StringUtil", invokerPackage + ".StringUtil");
Expand Down Expand Up @@ -542,10 +539,6 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
if(codegenModel.description != null) {
codegenModel.imports.add("ApiModel");
}
if (codegenModel.discriminator != null) {
codegenModel.imports.add("JsonSubTypes");
codegenModel.imports.add("JsonTypeInfo");
}
if (allDefinitions != null && codegenModel != null && codegenModel.parentSchema != null && codegenModel.hasEnums) {
final Model parentModel = allDefinitions.get(codegenModel.parentSchema);
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}
{{>generatedAnnotation}}
{{#hasChildren}}{{>typeInfoAnnotation}}{{/hasChildren}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#vars}}{{#isEnum}}

Expand Down

This file was deleted.

0 comments on commit e021a99

Please sign in to comment.