JavaScript: fix model name in initialization and import

Closes #1935
This commit is contained in:
xhh 2016-01-22 11:48:59 +08:00
parent 16e367bdc8
commit a607856406

View File

@ -279,7 +279,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
@Override @Override
public String toModelImport(String name) { public String toModelImport(String name) {
return name; return toModelName(name);
} }
@Override @Override
@ -308,17 +308,9 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
return "[]"; return "[]";
} else if (p instanceof MapProperty) { } else if (p instanceof MapProperty) {
return "{}"; return "{}";
} else if (p instanceof LongProperty) {
LongProperty dp = (LongProperty) p;
if (dp.getDefault() != null) {
return dp.getDefault().toString()+"l";
}
return "null";
// added for Javascript
} else if (p instanceof RefProperty) { } else if (p instanceof RefProperty) {
RefProperty rp = (RefProperty)p; RefProperty rp = (RefProperty)p;
return "new " +rp.getSimpleRef() + "()"; return "new " + getTypeDeclaration(p) + "()";
} }
return super.toDefaultValue(p); return super.toDefaultValue(p);