You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
by default, drizzle-zod handles max column length if the config.length field is set.
but when i add a refinement on that field, the length is no longer respected.
// example tableexportconsttable=mysqlTable("table",{id: varchar("id",{length: 36}).primaryKey(),url: varchar("url",{length: 2048}).notNull(),},(table)=>({}),);// default schemaexportconsttableSchema=createInsertSchema(table);tableSchema.parse({ id,url: "https://domain.com/some-super-long-path..."});// fails cause string is too long// restrict valid urlsexportconsttableSchema=createInsertSchema(table,{url: z.string().url(),// we now lost the `.max()` restriction that was auto-inferred by drizzle});tableSchema.parse({ id,url: "https://domain.com/some-super-long-string..."});// now succeeds cause no more auto-inferred max length
would be nice to have some way to merge refinements, so I don't have to "manage" the length in 2 places
Describe what you want
by default,
drizzle-zod
handles max column length if the config.length field is set.but when i add a refinement on that field, the length is no longer respected.
would be nice to have some way to merge refinements, so I don't have to "manage" the length in 2 places
The text was updated successfully, but these errors were encountered: