anl 25.1203.1 → 26.105.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.jp.md CHANGED
@@ -21,6 +21,8 @@
21
21
  - 🎨 コードフォーマットのサポート
22
22
  - ⚡️ ファイルアップロードのサポート
23
23
  - 🛠 カスタマイズ可能なコード生成オプション
24
+ - 🌐 複数の Swagger サーバー設定のサポート
25
+ - 🔧 OPTIONS、HEAD、SEARCH などの HTTP メソッドのサポート
24
26
 
25
27
  - `anl lint`
26
28
  - 🔍 各種 lint ツールのワンクリック設定
@@ -96,13 +98,20 @@ $ anl type
96
98
 
97
99
  #### 設定ファイルの例
98
100
 
101
+ **単一 Swagger サーバー設定:**
102
+
99
103
  ```json
100
104
  {
101
105
  "saveTypeFolderPath": "apps/types",
102
106
  "saveApiListFolderPath": "apps/api/",
103
107
  "saveEnumFolderPath": "apps/enums",
104
108
  "importEnumPath": "../../enums",
105
- "swaggerJsonUrl": "https://generator3.swagger.io/openapi.json",
109
+ "swaggerServers": {
110
+ "url": "https://generator3.swagger.io/openapi2.json",
111
+ "apiListFileName": "index.ts",
112
+ "publicPrefix": "api",
113
+ "headers": {}
114
+ },
106
115
  "requestMethodsImportPath": "./fetch",
107
116
  "dataLevel": "serve",
108
117
  "formatting": {
@@ -122,7 +131,6 @@ $ anl type
122
131
  "method": "post"
123
132
  }
124
133
  ],
125
- "publicPrefix": "api",
126
134
  "parameterSeparator": "_",
127
135
  "enmuConfig": {
128
136
  "erasableSyntaxOnly": false,
@@ -132,26 +140,68 @@ $ anl type
132
140
  }
133
141
  ```
134
142
 
143
+ **複数の Swagger サーバー設定:**
144
+
145
+ ```json
146
+ {
147
+ "saveTypeFolderPath": "apps/types",
148
+ "saveApiListFolderPath": "apps/api/",
149
+ "saveEnumFolderPath": "apps/enums",
150
+ "importEnumPath": "../../enums",
151
+ "requestMethodsImportPath": "./fetch",
152
+ "dataLevel": "serve",
153
+ "formatting": {
154
+ "indentation": "\t",
155
+ "lineEnding": "\n"
156
+ },
157
+ "parameterSeparator": "_",
158
+ "enmuConfig": {
159
+ "erasableSyntaxOnly": false,
160
+ "varnames": "enum-varnames",
161
+ "comment": "enum-descriptions"
162
+ },
163
+ "swaggerServers": [
164
+ {
165
+ "url": "https://generator3.swagger.io/openapi1.json",
166
+ "apiListFileName": "op.ts",
167
+ "headers": {}
168
+ },
169
+ {
170
+ "url": "https://generator3.swagger.io/openapi2.json",
171
+ "apiListFileName": "index.ts",
172
+ "publicPrefix": "/api",
173
+ "headers": {}
174
+ }
175
+ ]
176
+ }
177
+ ```
178
+
135
179
  #### 設定項目の説明
136
180
 
137
- | 設定項目 | 型 | 必須 | 説明 |
138
- | ------------------------------- | ------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
139
- | saveTypeFolderPath | string | はい | 型定義ファイルの保存パス |
140
- | saveApiListFolderPath | string | はい | API リクエスト関数ファイルの保存パス |
141
- | saveEnumFolderPath | string | はい | 列挙データファイルの保存パス |
142
- | importEnumPath | string | はい | 列挙型インポートパス(apps/types/models/\*.ts で enum ファイルを参照するパス) |
143
- | swaggerJsonUrl | string | はい | Swagger JSON ドキュメントのアドレス |
144
- | requestMethodsImportPath | string | はい | リクエストメソッドのインポートパス |
145
- | dataLevel | 'data' \| 'serve' \| 'axios' | はい | インターフェースレスポンスデータのレベル |
181
+ | 設定項目 | 型 | 必須 | 説明 |
182
+ | -------------------------------- | ------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
183
+ | saveTypeFolderPath | string | はい | 型定義ファイルの保存パス |
184
+ | saveApiListFolderPath | string | はい | API リクエスト関数ファイルの保存パス |
185
+ | saveEnumFolderPath | string | はい | 列挙データファイルの保存パス |
186
+ | importEnumPath | string | はい | 列挙型インポートパス(apps/types/models/\*.ts で enum ファイルを参照するパス) |
187
+ | swaggerJsonUrl | string | いいえ | Swagger JSON ドキュメントのアドレス(`swaggerServers` に移行済み、旧版設定との互換性のため保持)**今後のバージョンでこのフィールドは削除されます** |
188
+ | swaggerServers | object \| Array<object> | いいえ | Swagger サーバー設定。単一サーバーの場合は直接オブジェクトを記入、複数サーバーの場合は配列を使用。各サーバーで `url`、`publicPrefix`、`apiListFileName`、`headers` を設定可能<br />このフィールドは単一 Swagger サーバー設定と複数の Swagger サーバー設定の例に対応します。上にスクロールして確認してください |
189
+ | swaggerServers[].url | string | はい | Swagger JSON ドキュメントのアドレス |
190
+ | swaggerServers[].publicPrefix | string | いいえ | URL パス上の共通プレフィックス、例:api/users、api/users/{id}、api が共通プレフィックスです |
191
+ | swaggerServers[].apiListFileName | string | いいえ | API リストファイル名、デフォルトは `index.ts`。複数サーバー使用時、各サーバーのファイル名は一意である必要があります |
192
+ | swaggerServers[].headers | object | いいえ | リクエストヘッダー設定 |
193
+ | requestMethodsImportPath | string | はい | リクエストメソッドのインポートパス |
194
+ | dataLevel | 'data' \| 'serve' \| 'axios' | はい | インターフェースレスポンスデータのレベル |
146
195
  | formatting | object | いいえ | コードフォーマット設定 |
147
- | headers | object | いいえ | リクエストヘッダー設定 |
148
- | includeInterface | Array<{path: string, method: string}> | いいえ | 含めるインターフェース:`saveApiListFolderPath` で指定されたインターフェースリストファイルには、このリストに含まれるインターフェースのみが含まれます。`excludeInterface` フィールドと相互排他的です |
149
- | excludeInterface | Array<{path: string, method: string}> | いいえ | 除外するインターフェース:`saveApiListFolderPath` で指定されたインターフェースリストテキストには、このリストに含まれないインターフェースが含まれます。`includeInterface` と相互排他的です |
150
- | publicPrefix | string | いいえ | URL パス上の共通プレフィックス、例:api/users、api/users/{id}、api が共通プレフィックスです |
151
- | enmuConfig.erasableSyntaxOnly | boolean | はい | tsconfig.json `compilerOptions.erasableSyntaxOnly` オプションと一致させます。`true` の場合、enum ではなく const オブジェクトを生成します(型のみの構文)。デフォルト値:`false` |
152
- | parameterSeparator | string | いいえ | API 名と型名を生成する際に、パスセグメントとパラメータの間に使用される区切り文字。例えば、`/users/{userId}/posts` に区切り文字 `'_'` を使用すると `users_userId_posts_GET` が生成されます。デフォルト値:`'_'` |
153
- | enmuConfig.varnames | string | いいえ | Swagger schema 内でカスタム列挙メンバー名が格納されているフィールド名。デフォルト値:`enum-varnames`。 |
154
- | enmuConfig.comment | string | いいえ | Swagger schema 内で列挙メンバーの説明が格納されているフィールド名(コメント生成に使用)。デフォルト値:`enum-descriptions`。 |
196
+ | headers | object | いいえ | リクエストヘッダー設定(`swaggerServers` に移行済み、旧版設定との互換性のため保持) |
197
+ | includeInterface | Array<{path: string, method: string}> | いいえ | 含めるインターフェース:`saveApiListFolderPath` で指定されたインターフェースリストファイルには、このリストに含まれるインターフェースのみが含まれます。`excludeInterface` フィールドと相互排他的です |
198
+ | excludeInterface | Array<{path: string, method: string}> | いいえ | 除外するインターフェース:`saveApiListFolderPath` で指定されたインターフェースリストテキストには、このリストに含まれないインターフェースが含まれます。`includeInterface` と相互排他的です |
199
+ | publicPrefix | string | いいえ | URL パス上の共通プレフィックス(`swaggerServers` に移行済み、旧版設定との互換性のため保持) |
200
+ | apiListFileName | string | いいえ | API リストファイル名、デフォルトは `index.ts`(`swaggerServers` に移行済み、旧版設定との互換性のため保持) |
201
+ | enmuConfig.erasableSyntaxOnly | boolean | はい | tsconfig.json `compilerOptions.erasableSyntaxOnly` オプションと一致させます。`true` の場合、enum ではなく const オブジェクトを生成します(型のみの構文)。デフォルト値:`false` |
202
+ | parameterSeparator | string | いいえ | API 名と型名を生成する際に、パスセグメントとパラメータの間に使用される区切り文字。例えば、`/users/{userId}/posts` に区切り文字 `'_'` を使用すると `users_userId_posts_GET` が生成されます。デフォルト値:`'_'` |
203
+ | enmuConfig.varnames | string | いいえ | Swagger schema 内でカスタム列挙メンバー名が格納されているフィールド名。デフォルト値:`enum-varnames`。 |
204
+ | enmuConfig.comment | string | いいえ | Swagger schema 内で列挙メンバーの説明が格納されているフィールド名(コメント生成に使用)。デフォルト値:`enum-descriptions`。 |
155
205
 
156
206
  #### 設定項目と生成ファイルの対応関係
157
207
 
@@ -164,7 +214,8 @@ project/
164
214
  │ │ ├── models/ # すべての型定義ファイル(列挙型を除く)制御外
165
215
  │ │ ├── connectors/ # API 型定義(インターフェース定義ファイル)制御外
166
216
  │ └── api/ # リクエストファイル:saveApiListFolderPath 設定項目で指定
167
- │ │ └── index.ts # API リクエスト関数リスト 制御外
217
+ │ │ └── index.ts # API リクエスト関数リスト(単一サーバーまたは最初のサーバー)制御外
218
+ │ │ └── op.ts # 複数サーバー時、他のサーバーの API リストファイル 制御外
168
219
  │ │ └── api-type.d.ts # リクエスト型定義ファイル 制御外
169
220
  │ │ └── config.ts # リクエスト、レスポンスインターセプター、リクエスト設定 制御外
170
221
  │ │ └── error-message.ts # システムレベルのエラーメッセージ 制御外
@@ -308,12 +359,73 @@ export const uploadFile = (params: UploadFile.Body) =>
308
359
 
309
360
  注意:`includeInterface` と `excludeInterface` は同時に使用できません。両方を設定した場合は、`includeInterface` が優先されます。
310
361
 
362
+ #### 複数の Swagger サーバーサポート
363
+
364
+ ツールは複数の Swagger サーバーの設定をサポートしており、各サーバーは独立して設定できます:
365
+
366
+ - **単一サーバー**:`swaggerServers` は直接オブジェクトとして記入可能
367
+ - **複数サーバー**:`swaggerServers` は配列形式を使用し、各サーバーは一意の `apiListFileName` を設定する必要があります
368
+
369
+ **動作原理:**
370
+
371
+ - 最初のサーバーの API は指定された `apiListFileName`(デフォルトは `index.ts`)に生成されます
372
+ - 後続のサーバーの API はそれぞれの `apiListFileName` ファイルに追加されます
373
+ - 型定義と列挙型は統一されたフォルダにマージされ、重複を避けます
374
+
375
+ **設定例:**
376
+
377
+ ```json
378
+ {
379
+ "swaggerServers": [
380
+ {
381
+ "url": "http://api1.example.com/swagger.json",
382
+ "apiListFileName": "api1.ts",
383
+ "publicPrefix": "/api/v1",
384
+ "headers": {
385
+ "Authorization": "Bearer token1"
386
+ }
387
+ },
388
+ {
389
+ "url": "http://api2.example.com/swagger.json",
390
+ "apiListFileName": "api2.ts",
391
+ "publicPrefix": "/api/v2",
392
+ "headers": {
393
+ "Authorization": "Bearer token2"
394
+ }
395
+ }
396
+ ]
397
+ }
398
+ ```
399
+
400
+ **移行説明:**
401
+
402
+ - 旧版設定(`swaggerJsonUrl`、`publicPrefix`、`headers`)は引き続き互換性があります
403
+ - ツールは自動的に旧版設定を検出し、移行方法を提示します
404
+ - より柔軟性を得るために、新しい `swaggerServers` 設定への移行をお勧めします
405
+
406
+ #### HTTP メソッドサポート
407
+
408
+ ツールは以下の HTTP メソッドをサポートしています:
409
+
410
+ - `GET` - リソースの取得
411
+ - `POST` - リソースの作成
412
+ - `PUT` - リソースの更新(完全置換)
413
+ - `PATCH` - リソースの更新(部分更新)
414
+ - `DELETE` - リソースの削除
415
+ - `OPTIONS` - プリフライトリクエスト
416
+ - `HEAD` - レスポンスヘッダーの取得
417
+ - `SEARCH` - 検索リクエスト
418
+
419
+ すべてのメソッドは型安全なパラメータとレスポンス型定義をサポートしています。
420
+
311
421
  ### 注意事項
312
422
 
313
423
  1. Swagger JSON ドキュメントのアドレスにアクセスできることを確認してください
314
424
  2. 設定ファイル内のパスは、プロジェクトルートディレクトリからの相対パスである必要があります
315
425
  3. 生成されたファイルは、既存の同名ファイルを上書きします
316
426
  4. 生成されたファイルをバージョン管理に含めることをお勧めします
427
+ 5. 複数の Swagger サーバーを使用する場合、各サーバーの `apiListFileName` が一意であることを確認し、ファイルの上書きを避けてください
428
+ 6. 複数のサーバー設定を使用する場合、型定義と列挙型はマージされます。異なるサーバーに同じ名前の型がある場合、競合が発生する可能性があります
317
429
 
318
430
  ### よくある質問
319
431
 
package/README.md CHANGED
@@ -21,6 +21,8 @@
21
21
  - 🎨 Supports code formatting
22
22
  - ⚡️ Supports file upload
23
23
  - 🛠 Configurable code generation options
24
+ - 🌐 Supports multiple Swagger server configurations
25
+ - 🔧 Supports HTTP methods like OPTIONS, HEAD, SEARCH
24
26
 
25
27
  - `anl lint`
26
28
  - 🔍 One-click configuration for various lint tools
@@ -94,13 +96,20 @@ $ anl type
94
96
 
95
97
  #### Configuration File Example
96
98
 
99
+ **Single Swagger Server Configuration:**
100
+
97
101
  ```json
98
102
  {
99
103
  "saveTypeFolderPath": "apps/types",
100
104
  "saveApiListFolderPath": "apps/api/",
101
105
  "saveEnumFolderPath": "apps/enums",
102
106
  "importEnumPath": "../../enums",
103
- "swaggerJsonUrl": "https://generator3.swagger.io/openapi.json",
107
+ "swaggerServers": {
108
+ "url": "https://generator3.swagger.io/openapi2.json",
109
+ "apiListFileName": "index.ts",
110
+ "publicPrefix": "api",
111
+ "headers": {}
112
+ },
104
113
  "requestMethodsImportPath": "./fetch",
105
114
  "dataLevel": "serve",
106
115
  "formatting": {
@@ -120,7 +129,6 @@ $ anl type
120
129
  "method": "post"
121
130
  }
122
131
  ],
123
- "publicPrefix": "api",
124
132
  "parameterSeparator": "_",
125
133
  "enmuConfig": {
126
134
  "erasableSyntaxOnly": false,
@@ -130,26 +138,68 @@ $ anl type
130
138
  }
131
139
  ```
132
140
 
141
+ **Multiple Swagger Servers Configuration:**
142
+
143
+ ```json
144
+ {
145
+ "saveTypeFolderPath": "apps/types",
146
+ "saveApiListFolderPath": "apps/api/",
147
+ "saveEnumFolderPath": "apps/enums",
148
+ "importEnumPath": "../../enums",
149
+ "requestMethodsImportPath": "./fetch",
150
+ "dataLevel": "serve",
151
+ "formatting": {
152
+ "indentation": "\t",
153
+ "lineEnding": "\n"
154
+ },
155
+ "parameterSeparator": "_",
156
+ "enmuConfig": {
157
+ "erasableSyntaxOnly": false,
158
+ "varnames": "enum-varnames",
159
+ "comment": "enum-descriptions"
160
+ },
161
+ "swaggerServers": [
162
+ {
163
+ "url": "https://generator3.swagger.io/openapi1.json",
164
+ "apiListFileName": "op.ts",
165
+ "headers": {}
166
+ },
167
+ {
168
+ "url": "https://generator3.swagger.io/openapi2.json",
169
+ "apiListFileName": "index.ts",
170
+ "publicPrefix": "/api",
171
+ "headers": {}
172
+ }
173
+ ]
174
+ }
175
+ ```
176
+
133
177
  #### Configuration Item Descriptions
134
178
 
135
- | Configuration Item | Type | Required | Description |
136
- | ------------------------ | ------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
137
- | saveTypeFolderPath | string | Yes | Type definition file save path |
138
- | saveApiListFolderPath | string | Yes | API request function file save path |
139
- | saveEnumFolderPath | string | Yes | Enum data file save path |
140
- | importEnumPath | string | Yes | Enum import path (path referenced by enum files in apps/types/models/\*.ts) |
141
- | swaggerJsonUrl | string | Yes | Swagger JSON documentation address |
142
- | requestMethodsImportPath | string | Yes | Request method import path |
143
- | dataLevel | 'data' \| 'serve' \| 'axios' | Yes | Interface return data level |
144
- | formatting | object | No | Code formatting configuration |
145
- | headers | object | No | Request header configuration |
146
- | includeInterface | Array<{path: string, method: string}> | No | Included interfaces: The interface list file specified by `saveApiListFolderPath` will only include interfaces in the list, mutually exclusive with `excludeInterface` field |
147
- | excludeInterface | Array<{path: string, method: string}> | No | Excluded interfaces: The interface list file specified by `saveApiListFolderPath` will not include interfaces in this list, mutually exclusive with `includeInterface` |
148
- | publicPrefix | string | No | Common prefix on url path, e.g.: api/users, api/users/{id}, api is the common prefix |
149
- | enmuConfig.erasableSyntaxOnly | boolean | Yes | Align with tsconfig.json `compilerOptions.erasableSyntaxOnly`. When `true`, generates const objects instead of enums (type-only syntax). Default: `false` |
150
- | parameterSeparator | string | No | Separator used between path segments and parameters when generating API names and type names. For example, `/users/{userId}/posts` with separator `'_'` generates `users_userId_posts_GET`. Default: `'_'` |
151
- | enmuConfig.varnames | string | No | Schema field name that stores custom enum member identifiers. Default: `enum-varnames`. |
152
- | enmuConfig.comment | string | No | Schema field name that stores enum member descriptions (used for inline comments). Default: `enum-descriptions`. |
179
+ | Configuration Item | Type | Required | Description |
180
+ | -------------------------------------------- | ------------------------------------- | -------- | ------------------------------------------------------------------- |
181
+ | saveTypeFolderPath | string | Yes | Type definition file save path |
182
+ | saveApiListFolderPath | string | Yes | API request function file save path |
183
+ | saveEnumFolderPath | string | Yes | Enum data file save path |
184
+ | importEnumPath | string | Yes | Enum import path (path referenced by enum files in apps/types/models/\*.ts) |
185
+ | swaggerJsonUrl | string | No | Swagger JSON documentation address (migrated to `swaggerServers`, retained for backward compatibility) **This field will be removed in future versions** |
186
+ | swaggerServers | object \| Array<object> | No | Swagger server configuration. Single server can be an object, multiple servers use an array. Each server can configure `url`, `publicPrefix`, `apiListFileName`, `headers`<br />See single and multiple Swagger server configuration examples above |
187
+ | swaggerServers[].url | string | Yes | Swagger JSON documentation address |
188
+ | swaggerServers[].publicPrefix | string | No | Common prefix on url path, e.g.: api/users, api/users/{id}, api is the common prefix |
189
+ | swaggerServers[].apiListFileName | string | No | API list file name, defaults to `index.ts`. When using multiple servers, each server's file name must be unique |
190
+ | swaggerServers[].headers | object | No | Request header configuration |
191
+ | requestMethodsImportPath | string | Yes | Request method import path |
192
+ | dataLevel | 'data' \| 'serve' \| 'axios' | Yes | Interface return data level |
193
+ | formatting | object | No | Code formatting configuration |
194
+ | headers | object | No | Request header configuration (migrated to `swaggerServers`, retained for backward compatibility) |
195
+ | includeInterface | Array<{path: string, method: string}> | No | Included interfaces: The interface list file specified by `saveApiListFolderPath` will only include interfaces in the list, mutually exclusive with `excludeInterface` field |
196
+ | excludeInterface | Array<{path: string, method: string}> | No | Excluded interfaces: The interface list file specified by `saveApiListFolderPath` will not include interfaces in this list, mutually exclusive with `includeInterface` |
197
+ | publicPrefix | string | No | Common prefix on url path (migrated to `swaggerServers`, retained for backward compatibility) |
198
+ | apiListFileName | string | No | API list file name, defaults to `index.ts` (migrated to `swaggerServers`, retained for backward compatibility) |
199
+ | enmuConfig.erasableSyntaxOnly | boolean | Yes | Align with tsconfig.json `compilerOptions.erasableSyntaxOnly`. When `true`, generates const objects instead of enums (type-only syntax). Default: `false` |
200
+ | parameterSeparator | string | No | Separator used between path segments and parameters when generating API names and type names. For example, `/users/{userId}/posts` with separator `'_'` generates `users_userId_posts_GET`. Default: `'_'` |
201
+ | enmuConfig.varnames | string | No | Schema field name that stores custom enum member identifiers. Default: `enum-varnames`. |
202
+ | enmuConfig.comment | string | No | Schema field name that stores enum member descriptions (used for inline comments). Default: `enum-descriptions`. |
153
203
 
154
204
  #### Configuration Items and Generated Files Correspondence
155
205
 
@@ -162,7 +212,8 @@ project/
162
212
  │ │ ├── models/ # All type definition files (excluding enum types) uncontrolled
163
213
  │ │ ├── connectors/ # API type definitions (interface definition files) uncontrolled
164
214
  │ └── api/ # Request files: Specified by saveApiListFolderPath configuration item
165
- │ │ └── index.ts # API request function list uncontrolled
215
+ │ │ └── index.ts # API request function list (single server or first server) uncontrolled
216
+ │ │ └── op.ts # Other servers' API list files when using multiple servers uncontrolled
166
217
  │ │ └── api-type.d.ts # Request type definition file uncontrolled
167
218
  │ │ └── config.ts # Request, response interceptor, request configuration uncontrolled
168
219
  │ │ └── error-message.ts # System-level error messages uncontrolled
@@ -306,12 +357,73 @@ Example configuration: This configuration is in `an.config.json`
306
357
 
307
358
  Note: `includeInterface` and `excludeInterface` cannot be used simultaneously. If both are configured, `includeInterface` will be prioritized.
308
359
 
360
+ #### Multiple Swagger Servers Support
361
+
362
+ The tool supports configuring multiple Swagger servers, each server can be configured independently:
363
+
364
+ - **Single server**: `swaggerServers` can be directly filled with an object
365
+ - **Multiple servers**: `swaggerServers` uses an array format, each server must configure a unique `apiListFileName`
366
+
367
+ **How it works:**
368
+
369
+ - The first server's APIs will be generated to the specified `apiListFileName` (defaults to `index.ts`)
370
+ - Subsequent servers' APIs will be appended to their respective `apiListFileName` files
371
+ - Type definitions and enums will be merged into a unified folder to avoid duplication
372
+
373
+ **Configuration example:**
374
+
375
+ ```json
376
+ {
377
+ "swaggerServers": [
378
+ {
379
+ "url": "http://api1.example.com/swagger.json",
380
+ "apiListFileName": "api1.ts",
381
+ "publicPrefix": "/api/v1",
382
+ "headers": {
383
+ "Authorization": "Bearer token1"
384
+ }
385
+ },
386
+ {
387
+ "url": "http://api2.example.com/swagger.json",
388
+ "apiListFileName": "api2.ts",
389
+ "publicPrefix": "/api/v2",
390
+ "headers": {
391
+ "Authorization": "Bearer token2"
392
+ }
393
+ }
394
+ ]
395
+ }
396
+ ```
397
+
398
+ **Migration notes:**
399
+
400
+ - Old configuration (`swaggerJsonUrl`, `publicPrefix`, `headers`) is still compatible
401
+ - The tool will automatically detect old configuration and suggest migration methods
402
+ - It's recommended to migrate to the new `swaggerServers` configuration for better flexibility
403
+
404
+ #### HTTP Method Support
405
+
406
+ The tool supports the following HTTP methods:
407
+
408
+ - `GET` - Get resources
409
+ - `POST` - Create resources
410
+ - `PUT` - Update resources (full replacement)
411
+ - `PATCH` - Update resources (partial update)
412
+ - `DELETE` - Delete resources
413
+ - `OPTIONS` - Preflight requests
414
+ - `HEAD` - Get response headers
415
+ - `SEARCH` - Search requests
416
+
417
+ All methods support type-safe parameter and response type definitions.
418
+
309
419
  ### Notes
310
420
 
311
421
  1. Ensure the Swagger JSON documentation address is accessible
312
422
  2. Paths in the configuration file need to be relative to the project root directory
313
423
  3. Generated files will overwrite existing files with the same name
314
424
  4. It's recommended to add generated files to version control
425
+ 5. When using multiple Swagger servers, ensure each server's `apiListFileName` is unique to avoid file overwriting
426
+ 6. When configuring multiple servers, type definitions and enums will be merged. If different servers have types with the same name, conflicts may occur
315
427
 
316
428
  ### Common Issues
317
429