···11+---
22+'@hey-api/openapi-ts': minor
33+---
44+55+feat(zod): generate a single schema for requests
66+77+### Single Zod schema per request
88+99+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.
1010+1111+```ts
1212+const zData = z.object({
1313+ body: z.object({
1414+ foo: z.string().optional(),
1515+ bar: z.union([z.number(), z.null()]).optional(),
1616+ }).optional(),
1717+ headers: z.never().optional(),
1818+ path: z.object({
1919+ baz: z.string()
2020+ }),
2121+ query: z.never().optional()
2222+});
2323+```
2424+2525+If you need to access individual fields, you can do so using the [`.shape`](https://zod.dev/api?id=shape) API. For example, we can get the request body schema with `zData.shape.body`.
+5
.changeset/poor-stingrays-remember.md
···11+---
22+'@hey-api/openapi-ts': patch
33+---
44+55+fix(parser): do not mark schemas as duplicate if they have different format
+24
docs/openapi-ts/migrating.md
···27272828This config option is deprecated and will be removed.
29293030+## v0.74.0
3131+3232+### Single Zod schema per request
3333+3434+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.
3535+3636+```ts
3737+const zData = z.object({
3838+ body: z
3939+ .object({
4040+ foo: z.string().optional(),
4141+ bar: z.union([z.number(), z.null()]).optional(),
4242+ })
4343+ .optional(),
4444+ headers: z.never().optional(),
4545+ path: z.object({
4646+ baz: z.string(),
4747+ }),
4848+ query: z.never().optional(),
4949+});
5050+```
5151+5252+If you need to access individual fields, you can do so using the [`.shape`](https://zod.dev/api?id=shape) API. For example, we can get the request body schema with `zData.shape.body`.
5353+3054## v0.73.0
31553256### Bundle `@hey-api/client-*` plugins
+2-2
docs/openapi-ts/plugins/custom.md
···110110111111import type { Config } from './types';
112112113113-export const handler: Plugin.Handler<Config> = ({ context, plugin }) => {
113113+export const handler: Plugin.Handler<Config> = ({ plugin }) => {
114114 // create an output file. it will not be
115115 // generated until it contains nodes
116116- const file = context.createFile({
116116+ const file = plugin.createFile({
117117 id: plugin.name,
118118 path: plugin.output,
119119 });
+33-24
docs/openapi-ts/plugins/zod.md
···2626## Features
27272828- seamless integration with `@hey-api/openapi-ts` ecosystem
2929-- Zod schemas for request payloads, parameters, and responses
2929+- Zod schemas for requests, responses, and reusable definitions
30303131## Installation
3232···66666767The Zod plugin will generate the following artifacts, depending on the input specification.
68686969+## Requests
7070+7171+A single request schema is generated for each endpoint. It may contain a request body, parameters, and headers.
7272+7373+```ts
7474+const zData = z.object({
7575+ body: z
7676+ .object({
7777+ foo: z.string().optional(),
7878+ bar: z.union([z.number(), z.null()]).optional(),
7979+ })
8080+ .optional(),
8181+ headers: z.never().optional(),
8282+ path: z.object({
8383+ baz: z.string(),
8484+ }),
8585+ query: z.never().optional(),
8686+});
8787+```
8888+8989+::: tip
9090+If you need to access individual fields, you can do so using the [`.shape`](https://zod.dev/api?id=shape) API. For example, we can get the request body schema with `zData.shape.body`.
9191+:::
9292+9393+You can customize the naming and casing pattern for requests using the `requests.name` and `requests.case` options.
9494+6995## Responses
70967197A single Zod schema is generated for all endpoint's responses. If the endpoint describes multiple responses, the generated schema is a union of all possible response shapes.
···81107]);
82108```
831098484-## Request Bodies
8585-8686-If an endpoint describes a request body, we will generate a Zod schema representing its shape.
8787-8888-```ts
8989-const zData = z.object({
9090- foo: z.string().optional(),
9191- bar: z.union([z.number(), z.null()]).optional(),
9292-});
9393-```
9494-9595-## Parameters
9696-9797-A separate Zod schema is generated for every request parameter.
110110+You can customize the naming and casing pattern for responses using the `responses.name` and `responses.case` options.
981119999-```ts
100100-const zParameterFoo = z.number().int();
101101-102102-const zParameterBar = z.string();
103103-```
104104-105105-## Schemas
112112+## Definitions
106113107107-A separate Zod schema is generated for every reusable schema.
114114+A Zod schema is generated for every reusable definition from your input.
108115109116```ts
110117const zFoo = z.number().int();
···114121});
115122```
116123124124+You can customize the naming and casing pattern for definitions using the `definitions.name` and `definitions.case` options.
125125+117126## Metadata
118127119119-It's often useful to associate a schema with some additional metadata for documentation, code generation, AI structured outputs, form validation, and other purposes. If this is your use case, you can set `metadata` to `true` to generate additional metadata about schemas.
128128+It's often useful to associate a schema with some additional [metadata](https://zod.dev/metadata) for documentation, code generation, AI structured outputs, form validation, and other purposes. If this is your use case, you can set `metadata` to `true` to generate additional metadata about schemas.
120129121130```js
122131export default {