|
14 | 14 | - Frontend ❤️ OpenAPI, but we do not want to use JAVA codegen in our builds
|
15 | 15 | - Quick, lightweight, robust and framework-agnostic 🚀
|
16 | 16 | - Supports generation of TypeScript clients
|
17 |
| -- Supports generations of Fetch, [Node-Fetch](#node-fetch-support), [Axios](#axios-support) and XHR http clients |
| 17 | +- Supports generations of [Axios](#axios-support) client |
18 | 18 | - Supports OpenAPI specification v2.0 and v3.0
|
19 | 19 | - Supports JSON and YAML files for input
|
20 | 20 | - Supports generation through CLI, Node.js and NPX
|
@@ -411,7 +411,7 @@ openapi --input ./spec.json --output ./dist --exportClient true --name DemoAppCl
|
411 | 411 | The generated client will be exported from the `index` file and can be used as shown below:
|
412 | 412 | ```typescript
|
413 | 413 | // create the client instance with server and authentication details
|
414 |
| -const appClient = new DemoAppClient({ BASE: 'http://server-host.com', TOKEN: '1234' }); |
| 414 | +const appClient = new DemoAppClient({ base: 'http://server-host.com', token: '1234' }); |
415 | 415 |
|
416 | 416 | // use the client instance to make the API call
|
417 | 417 | const res: OrganizationResponse = await appClient.organizations.createOrganization({
|
|
488 | 488 | In order to compile the project and resolve the imports, you will need to enable the `allowSyntheticDefaultImports`
|
489 | 489 | in your `tsconfig.json` file.
|
490 | 490 |
|
491 |
| - |
492 |
| -### Node-Fetch support |
493 |
| -By default, this tool will generate a client that is compatible with the (browser based) Fetch API. |
494 |
| -However, this client will not work inside the Node.js environment. If you want to generate the Node.js compatible |
495 |
| -client then you can specify `--client node` in the openapi call: |
496 |
| - |
497 |
| -`openapi --input ./spec.json --output ./dist --client node` |
498 |
| - |
499 |
| -This will generate a client that uses [`node-fetch`](https://www.npmjs.com/package/node-fetch) internally. However, |
500 |
| -in order to compile and run this client, you might need to install the `[email protected]` dependencies. |
501 |
| - |
502 |
| -> Since version 3.x [`node-fetch`](https://www.npmjs.com/package/node-fetch) switched to ESM only, |
503 |
| -> breaking many CommonJS based toolchains (like Jest). Right now we do not support this new version! |
504 |
| -
|
505 |
| -``` |
506 |
| -npm install @types/[email protected] --save-dev |
507 |
| -npm install [email protected] --save-dev |
508 |
| -npm install [email protected] --save-dev |
509 |
| -npm install [email protected] --save-dev |
510 |
| -``` |
511 |
| - |
512 |
| -In order to compile the project and resolve the imports, you will need to enable the `allowSyntheticDefaultImports` |
513 |
| -in your `tsconfig.json` file. |
514 |
| - |
515 |
| - |
516 | 491 | [npm-url]: https://www.npmjs.com/package/@ciptex/openapi-typescript-codegen
|
517 | 492 | [npm-image]: https://img.shields.io/npm/v/@ciptex/openapi-typescript-codegen.svg
|
518 | 493 | [license-url]: LICENSE
|
|
0 commit comments