Use case sensitivity when checking reserved words (PHNX-1040) (#3) (#351)

Motivation
-------------
Open API generator previously wasn't case sensitive when checking for reserved words in the typescript generator. This will allow us to have the "Package" model in ProductCatalogs without needing to rename anything.

Modifications
------------------
Duplicated the C# logic for reserved words (per the @jimschubert from openapitools' suggestion)
This commit is contained in:
Geoff Brown 2018-06-21 05:34:22 -04:00 committed by William Cheng
parent e23b2f6fcc
commit 12ab7e2752

View File

@ -48,7 +48,9 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
importMapping.clear();
supportsInheritance = true;
setReservedWordsLowerCase(Arrays.asList(
// NOTE: TypeScript uses camel cased reserved words, while models are title cased. We don't want lowercase comparisons.
reservedWords.addAll(Arrays.asList(
// local variable names used in API methods (endpoints)
"varLocalPath", "queryParameters", "headerParams", "formParams", "useFormData", "varLocalDeferred",
"requestOptions",
@ -344,6 +346,12 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
}
}
@Override
protected boolean isReservedWord(String word) {
// NOTE: This differs from super's implementation in that TypeScript does _not_ want case insensitive matching.
return reservedWords.contains(word);
}
@Override
public String getSchemaType(Schema p) {