Skip to content

Commit c8ace81

Browse files
haraldFMikailBag
authored andcommitted
Make "Index" a reserved word (OpenAPITools#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.
1 parent 189fe4d commit c8ace81

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/generators/typescript-fetch.md

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ sidebar_label: typescript-fetch
7676
<li>HTTPHeaders</li>
7777
<li>HTTPMethod</li>
7878
<li>HTTPQuery</li>
79+
<li>Index</li>
7980
<li>JSONApiResponse</li>
8081
<li>Middleware</li>
8182
<li>ModelPropertyNaming</li>

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java

+3
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ private void addExtraReservedWords() {
327327
this.reservedWords.add("VoidApiResponse");
328328
this.reservedWords.add("BlobApiResponse");
329329
this.reservedWords.add("TextApiResponse");
330+
// "Index" would create a file "Index.ts" which on case insensitive filesystems
331+
// would override our "index.js" file
332+
this.reservedWords.add("Index");
330333
}
331334

332335
private boolean getUseSingleRequestParameter() {

0 commit comments

Comments
 (0)