Avoid the importPath field

This commit is contained in:
xhh 2015-05-20 09:23:02 +08:00
parent 792059f195
commit 312f1c6f25
4 changed files with 8 additions and 10 deletions

View File

@ -7,7 +7,7 @@ import java.util.*;
public class CodegenModel { public class CodegenModel {
public String parent; public String parent;
public String name, classname, importPath, description, classVarName, modelJson; public String name, classname, description, classVarName, modelJson;
public String defaultValue; public String defaultValue;
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>(); public List<CodegenProperty> vars = new ArrayList<CodegenProperty>();
public Set<String> imports = new HashSet<String>(); public Set<String> imports = new HashSet<String>();

View File

@ -428,7 +428,6 @@ public class DefaultCodegen {
m.name = name; m.name = name;
m.description = escapeText(model.getDescription()); m.description = escapeText(model.getDescription());
m.classname = toModelName(name); m.classname = toModelName(name);
m.importPath = toModelImport(name);
m.classVarName = toVarName(name); m.classVarName = toVarName(name);
m.modelJson = Json.pretty(model); m.modelJson = Json.pretty(model);
m.externalDocs = model.getExternalDocs(); m.externalDocs = model.getExternalDocs();

View File

@ -428,6 +428,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
CodegenModel cm = config.fromModel(key, mm); CodegenModel cm = config.fromModel(key, mm);
Map<String, Object> mo = new HashMap<String, Object>(); Map<String, Object> mo = new HashMap<String, Object>();
mo.put("model", cm); mo.put("model", cm);
mo.put("importPath", config.toModelImport(key));
models.add(mo); models.add(mo);
allImports.addAll(cm.imports); allImports.addAll(cm.imports);
} }

View File

@ -9,9 +9,7 @@ require '{{gemName}}/swagger/version'
# Models # Models
require '{{modelPackage}}/base_object' require '{{modelPackage}}/base_object'
{{#models}} {{#models}}
{{#model}}
require '{{importPath}}' require '{{importPath}}'
{{/model}}
{{/models}} {{/models}}
# APIs # APIs