[Typescript] Add Error to the list of reserved words that must be escaped (#4203)

* Add Error to the list of reserved words that must be escaped for Class-generation

This fixes a part of #2456.

* add in special casing for the model names to not clobber existing language type names

* address formatting issues to be in line with language convention
This commit is contained in:
Chester Husk III
2016-11-19 01:51:14 -06:00
committed by wing328
parent 7a7eb113b3
commit 95ac238026

View File

@@ -55,7 +55,8 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
"Array",
"Date",
"number",
"any"
"any",
"Error"
));
instantiationTypes.put("array", "Array");
@@ -174,6 +175,11 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
return modelName;
}
if (languageSpecificPrimitives.contains(name)) {
String modelName = camelize("model_" + name);
LOGGER.warn(name + " (model name matches existing language type) cannot be used as a model name. Renamed to " + modelName);
return modelName;
}
// camelize the model name
// phone_number => PhoneNumber
return camelize(name);