[](https://npmjs.org/package/@standard-community/standard-openapi "View this project on NPM") [


Standard Schema Validator's OpenAPI Schema Converter
Install the main package -
``sh`
pnpm add @standard-community/standard-openapi
For some specific vendor, install the respective package also -
| Vendor | Package |
| ------- | ------- |
| Zod | zod-openapi |@standard-community/standard-json
| Valibot | @valibot/to-json-schema json-schema-walker |@standard-community/standard-json
| ArkType | json-schema-walker |@standard-community/standard-json
| Effect Schema | json-schema-walker |
`ts
import { toOpenAPISchema } from "@standard-community/standard-openapi";
// Define your schema
const schema = v.pipe(
v.object({
myString: v.string(),
myUnion: v.union([v.number(), v.boolean()]),
}),
v.description("My neat object schema"),
);
// Convert it to OpenAPI Schema
const openapiSchema = await toOpenAPISchema(schema);
``
List of supported validators -
| Vendor | Supported |
| ------- | ------- |
| Zod | ✅ |
| Valibot | ✅ |
| ArkType | ✅ |
| Typebox | ✅ (Using TypeMap |
| Effect Schema | 🛠️ |
You can check the compatibility versions at standardschema.dev