-
-
Notifications
You must be signed in to change notification settings - Fork 496
Labels
zodZod related issueZod related issue
Milestone
Description
Situation
I generate zod schema validators from an openapi 3.0 document, one of the structures has a circular reference to itself.
// Example data model, this wont work because bar implicitly has type 'any', it (`foo`) references itself
const foo = zod.object({
bar: foo
})// Example orval output, instead of a self-reference it uses `zod.any`
const foo = zod.object({
bar: zod.any(),
})Expectation
Zod has support for circular references, it would be great if this can be supported (in zod) as well, it works by simply adding a getter for (self/circular) references.
const foo = zod.object({
get bar() {
return foo
}
})
Please consider adding support for self/circular references, it will greatly improve DX and/or reduce type errors
noots-kimia and pavel-spacil
Metadata
Metadata
Assignees
Labels
zodZod related issueZod related issue