drizzle-orm
drizzle-orm copied to clipboard
[drizzle-valibot]: Update for valibot 0.31.0+
This PR picks up from #2481, brings it up to the latest main changes to resolve issues with Valibot 0.31.0+
Fixes #2521
Also addresses,
- failing
lintondrizzle-orm. This was caused by an invalid comment symbol in the command, used to disable another command. (Was// # lintinstead of# lint) - failing
buildstep ontypebox,valibot, andzodvalidation adapters. Thebuildcommands were using an older version oftsxspecified by local deps, not the version oftsxwhich is specified at the top-level package.json
Happy to help if there are any questions about Valibot!
Would love some eyes on this @drizzle-team @dankochetov @AndriiSherman @AlexBlokh
Is this something we can just use to patch drizzle? :)
I tried patching but was getting some errors when using forwarding such as...
const itemSchema = v.pipe(
v.omit(
v.object({
...createInsertSchema(items, {
groups: v.optional(v.array(group), [])
}).entries,
tags: v.optional(v.array(tagSchema), [])
}),
['createdAt', 'updatedAt']
),
v.forward(
v.partialCheck(
[
['groups']
],
(input) => new Set(input.groups.map((p) => p.label)).size === input.groups.length,
'Group labels must be unique'
)
)
);
Any progress on this? It's been idle for a while
@Hugos68 good question
@drizzle-team Just rebased on main, would be great for some feedback here 😅
I've been following #3508 that overhaul all validation packages. That one also comes with a number of utility functions for more advanced use-cases, this PR could get canceled in favor of that one.
#3508 was merged.