ts-openapi-codegen 2.1.0-beta.3 → 2.1.0-beta.4
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.md +14 -1
- package/README.rus.md +14 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
- Supports tsc and @babel/plugin-transform-typescript
|
|
29
29
|
- Supports customization names of models
|
|
30
30
|
- Supports external references using [`swagger-parser`](https://github.com/APIDevTools/swagger-parser/)
|
|
31
|
+
- Supports strict OpenAPI diagnostics with JSON reports (`--strict-openapi`, `--report-file`)
|
|
32
|
+
- Supports generator plugins (`plugins`) including built-in `x-typescript-type`
|
|
31
33
|
- Supports binary request/response generation (`format: binary` -> `Blob`)
|
|
32
34
|
|
|
33
35
|
## Install
|
|
@@ -246,7 +248,9 @@ Instead of passing all options via CLI, you can use a configuration file. Create
|
|
|
246
248
|
"enabled": true,
|
|
247
249
|
"confidence": 1,
|
|
248
250
|
"types": ["RENAME", "TYPE_COERCION"]
|
|
249
|
-
}
|
|
251
|
+
},
|
|
252
|
+
"plugins": ["./plugins/custom-type.plugin.cjs"],
|
|
253
|
+
"customExecutorPath": "./custom/createExecutorAdapter.ts"
|
|
250
254
|
}
|
|
251
255
|
```
|
|
252
256
|
|
|
@@ -297,6 +301,7 @@ Instead of passing all options via CLI, you can use a configuration file. Create
|
|
|
297
301
|
| `useUnionTypes` | boolean | `false` | Use union types instead of enums |
|
|
298
302
|
| `excludeCoreServiceFiles` | boolean | `false` | Exclude core and service files generation |
|
|
299
303
|
| `request` | string | - | Path to custom request file |
|
|
304
|
+
| `plugins` | string[] | `[]` | Paths to generator plugins |
|
|
300
305
|
| `customExecutorPath` | string | - | Path to custom `createExecutorAdapter` module |
|
|
301
306
|
| `interfacePrefix` | string | `I` | Prefix for interface models |
|
|
302
307
|
| `enumPrefix` | string | `E` | Prefix for enum models |
|
|
@@ -318,6 +323,14 @@ Instead of passing all options via CLI, you can use a configuration file. Create
|
|
|
318
323
|
|
|
319
324
|
**Note:** You can use the `init` command to generate a template configuration file.
|
|
320
325
|
|
|
326
|
+
### Plugins
|
|
327
|
+
|
|
328
|
+
Generator plugins can override schema type mapping (for example via `x-typescript-type`) and extend generation behavior.
|
|
329
|
+
|
|
330
|
+
- Configuration key: `plugins` (array of module paths)
|
|
331
|
+
- Supported module formats: CJS, ESM, and TS (when runtime supports TS imports)
|
|
332
|
+
- Full guide: [docs/plugins.md](./docs/plugins.md)
|
|
333
|
+
|
|
321
334
|
## Examples
|
|
322
335
|
|
|
323
336
|
### Using CLI commands
|
package/README.rus.md
CHANGED
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
- Поддерживает tsc и @babel/plugin-transform-typescript
|
|
29
29
|
- Поддерживает кастомизацию имен моделей
|
|
30
30
|
- Поддерживает внешние ссылки с помощью [`swagger-parser`](https://github.com/APIDevTools/swagger-parser/)
|
|
31
|
+
- Поддерживает strict-диагностику OpenAPI с JSON-отчетом (`--strict-openapi`, `--report-file`)
|
|
32
|
+
- Поддерживает плагины генератора (`plugins`), включая встроенный `x-typescript-type`
|
|
31
33
|
- Поддерживает генерацию бинарных request/response (`format: binary` -> `Blob`)
|
|
32
34
|
|
|
33
35
|
## Установка
|
|
@@ -245,7 +247,9 @@ openapi analyze-diff --input ./openapi/spec.yaml --git HEAD~1
|
|
|
245
247
|
"enabled": true,
|
|
246
248
|
"confidence": 1,
|
|
247
249
|
"types": ["RENAME", "TYPE_COERCION"]
|
|
248
|
-
}
|
|
250
|
+
},
|
|
251
|
+
"plugins": ["./plugins/custom-type.plugin.cjs"],
|
|
252
|
+
"customExecutorPath": "./custom/createExecutorAdapter.ts"
|
|
249
253
|
}
|
|
250
254
|
```
|
|
251
255
|
|
|
@@ -296,6 +300,7 @@ openapi analyze-diff --input ./openapi/spec.yaml --git HEAD~1
|
|
|
296
300
|
| `useUnionTypes` | boolean | `false` | Использовать union типы вместо enums |
|
|
297
301
|
| `excludeCoreServiceFiles` | boolean | `false` | Исключить генерацию core и сервисных файлов |
|
|
298
302
|
| `request` | string | - | Путь к пользовательскому файлу запросов |
|
|
303
|
+
| `plugins` | string[] | `[]` | Пути к плагинам генератора |
|
|
299
304
|
| `customExecutorPath` | string | - | Путь к пользовательскому модулю `createExecutorAdapter` |
|
|
300
305
|
| `interfacePrefix` | string | `I` | Префикс для интерфейсов моделей |
|
|
301
306
|
| `enumPrefix` | string | `E` | Префикс для enum моделей |
|
|
@@ -317,6 +322,14 @@ openapi analyze-diff --input ./openapi/spec.yaml --git HEAD~1
|
|
|
317
322
|
|
|
318
323
|
**Примечание:** Вы можете использовать команду `init` для генерации шаблона файла конфигурации.
|
|
319
324
|
|
|
325
|
+
### Плагины
|
|
326
|
+
|
|
327
|
+
Плагины генератора позволяют переопределять маппинг типов схем (например через `x-typescript-type`) и расширять поведение генерации.
|
|
328
|
+
|
|
329
|
+
- Ключ конфигурации: `plugins` (массив путей к модулям)
|
|
330
|
+
- Поддерживаемые форматы модулей: CJS, ESM и TS (если рантайм поддерживает импорт TS)
|
|
331
|
+
- Подробная документация: [docs/plugins.md](./docs/plugins.md)
|
|
332
|
+
|
|
320
333
|
## Примеры
|
|
321
334
|
|
|
322
335
|
### Использование CLI команд
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-openapi-codegen",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.4",
|
|
4
4
|
"description": "Library that generates Typescript clients based on the OpenAPI specification. It bases on openapi-typescript-codegen",
|
|
5
5
|
"author": "Alexey Zverev",
|
|
6
6
|
"homepage": "https://github.com/ozonophore/openapi-codegen.git",
|