···11+---
22+'@hey-api/openapi-ts': patch
33+---
44+55+fix(zod): add `metadata` option to generate additional metadata for documentation, code generation, AI structured outputs, form validation, and other purposes
+1-1
docs/index.md
···3344hero:
55 name: High-quality tools for interacting with APIs
66- tagline: Codegen for your TypeScript projects. Trusted over 1,250,000 times each month to generate reliable API clients and SDKs.
66+ tagline: Codegen for your TypeScript projects. Trusted over 1,500,000 times each month to generate reliable API clients and SDKs.
77 actions:
88 - link: /openapi-ts/get-started
99 text: Get Started
+1-1
docs/openapi-ts/get-started.md
···1313This package is in initial development. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues).
1414:::
15151616-[@hey-api/openapi-ts](https://github.com/hey-api/openapi-ts) is an OpenAPI to TypeScript codegen trusted over 1,250,000 times each month to generate reliable API clients and SDKs. The code is [MIT-licensed](/license) and free to use. Discover available features below or view our [roadmap](https://github.com/orgs/hey-api/discussions/1495) to learn what's coming next.
1616+[@hey-api/openapi-ts](https://github.com/hey-api/openapi-ts) is an OpenAPI to TypeScript codegen trusted over 1,500,000 times each month to generate reliable API clients and SDKs. The code is [MIT-licensed](/license) and free to use. Discover available features below or view our [roadmap](https://github.com/orgs/hey-api/discussions/1495) to learn what's coming next.
17171818### Demo
1919
+20-6
docs/openapi-ts/plugins/zod.md
···3333In your [configuration](/openapi-ts/get-started), add `zod` to your plugins and you'll be ready to generate Zod artifacts. :tada:
34343535```js
3636-import { defaultPlugins } from '@hey-api/openapi-ts';
3737-3836export default {
3937 input: 'https://get.heyapi.dev/hey-api/backend',
4038 output: 'src/client',
4139 plugins: [
4242- ...defaultPlugins,
4040+ // ...other plugins
4341 '@hey-api/client-fetch',
4442 'zod', // [!code ++]
4543 ],
···5149To automatically validate response data in your SDKs, set `sdk.validator` to `true`.
52505351```js
5454-import { defaultPlugins } from '@hey-api/openapi-ts';
5555-5652export default {
5753 input: 'https://get.heyapi.dev/hey-api/backend',
5854 output: 'src/client',
5955 plugins: [
6060- ...defaultPlugins,
5656+ // ...other plugins
6157 '@hey-api/client-fetch',
6258 'zod',
6359 {
···118114const zBar = z.object({
119115 bar: z.array(z.number().int()).optional(),
120116});
117117+```
118118+119119+## Metadata
120120+121121+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.
122122+123123+```js
124124+export default {
125125+ input: 'https://get.heyapi.dev/hey-api/backend',
126126+ output: 'src/client',
127127+ plugins: [
128128+ // ...other plugins
129129+ {
130130+ metadata: true, // [!code ++]
131131+ name: 'zod',
132132+ },
133133+ ],
134134+};
121135```
122136123137<!--@include: ../../examples.md-->
···1616 */
1717 exportFromIndex?: boolean;
1818 /**
1919+ * Enable Zod metadata support? It's often useful to associate a schema with
2020+ * some additional metadata for documentation, code generation, AI
2121+ * structured outputs, form validation, and other purposes.
2222+ *
2323+ * @default false
2424+ */
2525+ metadata?: boolean;
2626+ /**
1927 * Customise the Zod schema name. By default, `z{{name}}` is used,
2028 * where `name` is a definition name or an operation name.
2129 */