Make "Index" a reserved word (#6000)

Some APIs have a model called "Index" which would create a file
"Index.ts" which would override "index.ts" on case-insensitive file
systems (e.g. macOS, some Windows versions). Make "Index" a reserved
word to prevent this clash.
This commit is contained in:
Harald Fernengel 2020-04-22 14:24:42 +02:00 committed by GitHub
parent 63b4429775
commit b431d65099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -76,6 +76,7 @@ sidebar_label: typescript-fetch
<li>HTTPHeaders</li> <li>HTTPHeaders</li>
<li>HTTPMethod</li> <li>HTTPMethod</li>
<li>HTTPQuery</li> <li>HTTPQuery</li>
<li>Index</li>
<li>JSONApiResponse</li> <li>JSONApiResponse</li>
<li>Middleware</li> <li>Middleware</li>
<li>ModelPropertyNaming</li> <li>ModelPropertyNaming</li>

View File

@ -327,6 +327,9 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
this.reservedWords.add("VoidApiResponse"); this.reservedWords.add("VoidApiResponse");
this.reservedWords.add("BlobApiResponse"); this.reservedWords.add("BlobApiResponse");
this.reservedWords.add("TextApiResponse"); this.reservedWords.add("TextApiResponse");
// "Index" would create a file "Index.ts" which on case insensitive filesystems
// would override our "index.js" file
this.reservedWords.add("Index");
} }
private boolean getUseSingleRequestParameter() { private boolean getUseSingleRequestParameter() {