help with drizzle-zod with jsonb column
I have this table definition:
then I use drizzle-zod to create a type from that schema:
but the addresses property is a json type, not an array of Address.
Is there a way to change that behavior?
2 Replies
It can't do that, the library and Zod only know about concrete information, and types aren't concrete. The only concrete information is Json. For custom columns, it uses
z.any
(https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-zod/src/index.ts#L205).
But you can override it
appreciate that, Rafael! thanks, man