typed-openapi
typed-openapi copied to clipboard
Support Zod V4
In Zod V3, the following generated Zod schema is valid
const metadata = z.record(z.string())
However in V4, it needs
const metadata = z.record(z.string(), z.string())
Can use the following JSON schema from OpenAPI to test
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string"
}
}
The generated client is a single file that can be used in the browser or in node. Runtime validation schemas are provided by the excellent typebox-codegen
you'd have to open an issue there, typed-openapi doesnt directly handle the conversion to zod