How to transform schema to conform to z.object() shape? #1044
chrisjansky
started this conversation in
General
Replies: 1 comment 1 reply
-
Yes, it is possible to write such a function. Valibot schemas store any information in their objects. For example, via |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am very fond of using valibot in nuxt and have migrated all validator logic to it from
zod
. The recent v3 of nuxt/content has introduced a schema requirement for content like this:I have raised an issue in
nuxt/content
to offer a more generic way to define schema without relying on a specific stack, ideally through https://standardschema.dev.Realistically that’s not going to happen any time soon, so is there any way to work around that and give
nuxt/content
what it needs without maintaining two sets of validator schemas (valibot
application-wide,zod
fornuxt/content
)?Basically a transformer function that maps it to the shape of
ZodObject
.Any help appreciated 🌈
Beta Was this translation helpful? Give feedback.
All reactions