typed-openapi icon indicating copy to clipboard operation
typed-openapi copied to clipboard

Support Zod V4

Open yzhe554 opened this issue 5 months ago • 1 comments

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"
  }
}

yzhe554 avatar Aug 06 '25 23:08 yzhe554

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

astahmer avatar Aug 07 '25 07:08 astahmer