We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drizzle-orm
0.30.10
drizzle-kit
0.21.2
I defined a numeric field:
import { pgTable, text, timestamp, numeric } from 'drizzle-orm/pg-core'; import { createInsertSchema, createSelectSchema } from 'drizzle-zod'; export const user = pgTable('user', { id: text('id').primaryKey(), githubId: numeric('github_id').unique() }); export const insertUserSchema = createInsertSchema(user); export const selectUserSchema = createSelectSchema(user);
The types generated with createInsertSchema / createSelectSchema result in:
const insertUserSchema: ZodObject<{ id: ZodString; githubId: ZodOptional<ZodNullable<ZodString>>; },
therefore the parsing fails:
insertUserSchema.parse({ id: generateId(15), githubId: 0123456789 })
numeric() should be converted to ZodNumber
drizzle-zod 0.5.1
The text was updated successfully, but these errors were encountered:
for the moment this issue can be circumnavigated by overriding insertUserSchema:
insertUserSchema
export const insertUserSchema = createInsertSchema(user, { githubId: z.number() });
Sorry, something went wrong.
No branches or pull requests
What version of
drizzle-orm
are you using?0.30.10
What version of
drizzle-kit
are you using?0.21.2
Describe the Bug
I defined a numeric field:
The types generated with createInsertSchema / createSelectSchema result in:
therefore the parsing fails:
Expected behavior
numeric() should be converted to ZodNumber
Environment & setup
drizzle-zod 0.5.1
The text was updated successfully, but these errors were encountered: