15 Replies
yes
also, you can use drizzle-zod to do that for you
im using drizzle for the schema but i don't know how to do it for the enum
im trying to do this
ok i think i found how
you can just do
insertHistorySchema.shape.historyType
?
it's just a Zod object
you can use any Zod API on itamazing mate
not sure enums are working.. check this i have this schema:
but zod is giving me this error:
if i debug the zod codebase this is what we are sending to zod as
this._def.values
:
this looks fine not sure whats going on

looks like a bug
let me check
yeah,,, but the code looks fine
ill try to check why and make a aPR
I'm currently reworking the internal API for enums a bit, which affects how they are processed by drizzle-zod, so it'll be easier for me to do this on my own
great! in the meantime ill just hardcode the values
@charli can you update drizzle-orm and drizzle-zod to latest and try again?
i updated to:
still same error

now the enum is converted to string instead of enum
also enum values are shown like this

upgraded again and now its fixed!
thanks man!