{"repo":"samchungy/zod-openapi","free":true,"listed":false,"github":"https://github.com/samchungy/zod-openapi","clone":"git clone https://github.com/samchungy/zod-openapi.git","description":"Use Zod Schemas to create OpenAPI v3.x documentation","language":"TypeScript","stars":637,"topics":["openapi","swagger","typescript","zod","json-schema","openapi3","zod-openapi"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"zod-openapi A TypeScript library which uses Zod schemas to generate OpenAPI v3.x documentation. Installation Install via npm , yarn , or pnpm : Usage .meta() Use Zod's native .meta() method to add OpenAPI metadata to your schemas. This library leverages Zod's built-in metadata functionality - no monkey patching or additional setup is required. Simply call .meta() on any Zod schema and it accepts an object with the following options: Note: For full TypeScript support of OpenAPI properties in .meta() , simply import zod-openapi in your project or add /// anywhere in your project. This provides compile-time type definitions for properties like id , param , header , etc. Option Description ---------- ---------------------------------------------------------------------------------------------------------------- id Registers a schema as a reusable OpenAPI component. header Adds metadata for response headers. param Adds metadata for request parameters. override Allows you to override the rendered OpenAPI schema. This takes either an object or a function. outputId Allows you to set a different ID for the output schema. This is useful when the input and output schemas differ. unusedIO Allows you to set the io for an unused schema added to the components section. Defaults to output . You can also set standard OpenAPI properties directly in Zod's native .meta() method, such as: You can set additional metadata to the rendered schema in a few different ways. Zod's native .meta() method a","default_branch":null,"files":null,"tree":[],"storefront":"/r/samchungy","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/samchungy/zod-openapi/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}