@hey-api/openapi-ts 0.27.37 → 0.27.39
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 +32 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
- [Quick Start](#quick-start)
|
|
10
10
|
- [Installation](#installation)
|
|
11
11
|
- [Configuration](#configuration)
|
|
12
|
+
- [Clients](#clients)
|
|
12
13
|
- [Formatting](#formatting)
|
|
13
14
|
- [Linting](#linting)
|
|
14
15
|
- [Enums](#enums)
|
|
15
16
|
- [Config API](#config-api)
|
|
17
|
+
- [Migrating](#migrating)
|
|
16
18
|
- [Contributing](#contributing)
|
|
17
19
|
|
|
18
20
|
## About
|
|
@@ -95,6 +97,17 @@ export default {
|
|
|
95
97
|
|
|
96
98
|
Alternatively, you can use `openapi-ts.config.js` and configure the export statement depending on your project setup.
|
|
97
99
|
|
|
100
|
+
### Clients
|
|
101
|
+
|
|
102
|
+
We provide a variety of possible clients to use when generating your `openapi-ts` client. If one is not specified by the user, we will try to infer the client to use. If the inferred client is not correct, you can set it with the client config parameter. The following are available:
|
|
103
|
+
|
|
104
|
+
- `angular`: An [Angular](https://angular.io/) client using [RxJS](https://rxjs.dev/).
|
|
105
|
+
- `axios`: An [Axios](https://axios-http.com/docs/intro) client.
|
|
106
|
+
- `fetch`: A [Fetch API](https://developer.mozilla.org/docs/Web/API/Fetch_API) client.
|
|
107
|
+
> NOTE: The Fetch API is experimental in Node.js 18+ and was stabilized in [Node.js v21](https://nodejs.org/docs/latest-v21.x/api/globals.html#fetch)
|
|
108
|
+
- `node`: A [Node.js](https://nodejs.org/) client using [node-fetch](https://www.npmjs.com/package/node-fetch).
|
|
109
|
+
- `xhr`: A [XMLHttpRequest](https://developer.mozilla.org/docs/Web/API/XMLHttpRequest) client.
|
|
110
|
+
|
|
98
111
|
### Formatting
|
|
99
112
|
|
|
100
113
|
By default, `openapi-ts` will automatically format your client according to your project configuration. To disable automatic formatting, set `format` to false
|
|
@@ -160,7 +173,7 @@ $ openapi-ts --help
|
|
|
160
173
|
-o, --output <value> Output directory (required)
|
|
161
174
|
-c, --client <value> HTTP client to generate [fetch, xhr, node, axios, angular] (default: "fetch")
|
|
162
175
|
--name <value> Custom client class name
|
|
163
|
-
--useOptions <value> Use options instead of arguments (default:
|
|
176
|
+
--useOptions <value> Use options instead of arguments (default: true)
|
|
164
177
|
--base <value> Manually set base in OpenAPI config instead of inferring from server value
|
|
165
178
|
--enums Generate JavaScript objects from enum definitions (default: false)
|
|
166
179
|
--exportCore <value> Write core files to disk (default: true)
|
|
@@ -179,6 +192,24 @@ $ openapi-ts --help
|
|
|
179
192
|
-h, --help display help for command
|
|
180
193
|
```
|
|
181
194
|
|
|
195
|
+
## Migrating
|
|
196
|
+
|
|
197
|
+
While we try to avoid breaking changes, sometimes it's unavoidable in order to offer you the latest features.
|
|
198
|
+
|
|
199
|
+
### v0.27.38
|
|
200
|
+
|
|
201
|
+
### `useOptions: true`
|
|
202
|
+
|
|
203
|
+
By default, generated clients will use a single object argument to pass values to API calls. This is a significant change from the previous default of unspecified array of arguments. If migrating your application in one go isn't feasible, we recommend deprecating your old client and generating a new client.
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
import { DefaultService } from 'client' // <-- old client with array arguments
|
|
207
|
+
|
|
208
|
+
import { DefaultService } from 'client_v2' // <-- new client with options argument
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
This way, you can gradually switch over to the new syntax as you update parts of your code. Once you've removed all instances of `client` imports, you can safely delete the old `client` folder and find and replace all `client_v2` calls to `client`.
|
|
212
|
+
|
|
182
213
|
## Contributing
|
|
183
214
|
|
|
184
215
|
Please refer to the [contributing guide](CONTRIBUTING.md) for how to install the project for development purposes.
|