Open Shyrogan opened 2 months ago
Any update so far? I'm facing the same issue
Facing the same issue, did you find a workaround to support recursive types?
Facing the same issue, did you find a workaround to support recursive types?
Sadly there is no other way than lazy
I ended up overwriting type with the .openapi
method like this:
BaseSearchOrdersFiltersSchema.extend({
oneOf: z
.lazy(() => SearchOrdersFiltersSchema.array().optional())
.openapi({
type: "array",
items: {
type: "object",
},
}),
I'm sure there is a better way to define the openapi schema but this at least does not break the spec generation
Similarly to how
zod-openapi
does it: https://github.com/samchungy/zod-openapi/tree/master?tab=readme-ov-file#supported-zod-schemaCurrently, we get the following error:
A good example of usage would be the JSON schema from Zod's documentation: