Releases: hey-api/openapi-ts
@hey-api/[email protected]
Minor Changes
-
#2227
4ea6f24
Thanks @mrlubos! - refactor(plugin): addDefinePlugin
utility typesUpdated Plugin API
Please refer to the custom plugin tutorial for the latest guide.
-
#2227
4ea6f24
Thanks @mrlubos! - feat(sdk): updatevalidator
optionUpdated
sdk.validator
optionClients can now validate both request and response data. As a result, passing a boolean or string to
validator
will control both of these options. To preserve the previous behavior, setvalidator.request
tofalse
andvalidator.response
to your previous configuration.export default { input: 'https://get.heyapi.dev/hey-api/backend', output: 'src/client', plugins: [ // ...other plugins { name: '@hey-api/sdk', validator: { request: false, response: true, }, }, ], };
Patch Changes
@hey-api/[email protected]
Minor Changes
-
#2226
1c66d88
Thanks @mrlubos! - feat(valibot): generate a single schema for requestsSingle Valibot schema per request
Previously, we generated a separate schema for each endpoint parameter and request body. In v0.76.0, a single request schema is generated for the whole endpoint. It may contain a request body, parameters, and headers.
const vData = v.object({ body: v.optional( v.object({ foo: v.optional(v.string()), bar: v.optional(v.union([v.number(), v.null()])), }), ), headers: v.optional(v.never()), path: v.object({ baz: v.string(), }), query: v.optional(v.never()), });
If you need to access individual fields, you can do so using the
.entries
API. For example, we can get the request body schema withvData.entries.body
.
Patch Changes
@hey-api/[email protected]
Minor Changes
-
#2215
82e56e9
Thanks @mrlubos! - feat(parser): replaceplugin.subscribe()
withplugin.forEach()
Added
plugin.forEach()
methodThis method replaces the
.subscribe()
method. Additionally,.forEach()
is executed immediately, which means we don't need thebefore
andafter
events – simply move your code before and after the.forEach()
block.plugin.forEach('operation', 'schema', (event) => { // do something with event });
-
#2218
e5ff024
Thanks @mrlubos! - feat(tanstack-query): add name and case optionsUpdated TanStack Query options
The TanStack Query plugin options have been expanded to support more naming and casing patterns. As a result, the following options have been renamed.
queryOptionsNameBuilder
renamed toqueryOptions
infiniteQueryOptionsNameBuilder
renamed toinfiniteQueryOptions
mutationOptionsNameBuilder
renamed tomutationOptions
queryKeyNameBuilder
renamed toqueryKeys
infiniteQueryKeyNameBuilder
renamed toinfiniteQueryKeys
Patch Changes
-
#2219
4df6fa0
Thanks @mrlubos! - fix: make output pass stricter tsconfig configurations" -
#2213
2ffb612
Thanks @mrlubos! - fix(validators): handle additional properties object when no other properties are defined -
#2216
1456f87
Thanks @mrlubos! - fix(parser): addmeta
andversion
options to input.patch -
#2210
5b1362a
Thanks @mrlubos! - fix(cli): correctly detect watch mode
@hey-api/[email protected]
Minor Changes
-
#2201
ab8cede
Thanks @mrlubos! - feat(zod): generate a single schema for requestsSingle Zod schema per request
Previously, we generated a separate schema for each endpoint parameter and request body. In v0.74.0, a single request schema is generated for the whole endpoint. It may contain a request body, parameters, and headers.
const zData = z.object({ body: z .object({ foo: z.string().optional(), bar: z.union([z.number(), z.null()]).optional(), }) .optional(), headers: z.never().optional(), path: z.object({ baz: z.string(), }), query: z.never().optional(), });
If you need to access individual fields, you can do so using the
.shape
API. For example, we can get the request body schema withzData.shape.body
.
Patch Changes
@hey-api/[email protected]
Minor Changes
-
#2172
29605a0
Thanks @mrlubos! - feat: bundle@hey-api/client-*
pluginsBundle
@hey-api/client-*
pluginsIn previous releases, you had to install a separate client package to generate a fully working output, e.g.
npm install @hey-api/client-fetch
. This created a few challenges: getting started was slower, upgrading was sometimes painful, and bundling too. Beginning with v0.73.0, all Hey API clients are bundled by default and don't require installing any additional dependencies. You can remove any installed client packages and re-run@hey-api/openapi-ts
.npm uninstall @hey-api/client-fetch
Patch Changes
@hey-api/[email protected]
@hey-api/[email protected]
Patch Changes
-
#2163
9769998
Thanks @mrlubos! - fix(zod): addmetadata
option to generate additional metadata for documentation, code generation, AI structured outputs, form validation, and other purposes -
#2167
a46259e
Thanks @mrlubos! - fix(tanstack-query): add name builder options for all generated artifacts -
#2166
594f3a6
Thanks @mrlubos! - fix(parser): filter orphans only when there are some operations -
#2166
594f3a6
Thanks @mrlubos! - fix(zod): support tuple types -
#2167
a46259e
Thanks @mrlubos! - fix(parser): set correct subscription context for plugins