mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
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:
parent
e23b2f6fcc
commit
12ab7e2752
@ -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",
|
||||
@ -345,6 +347,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) {
|
||||
String openAPIType = super.getSchemaType(p);
|
||||
|
Loading…
Reference in New Issue
Block a user