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
It would be amazing to have the option of defining a custom validator instead of zod only – seems a very opionated assumption that everyone is using zod. We have migrated to valibot as (purely subjective) we deem it better, more lightweight and flexible.
Validators are purely matter of taste, so please consider making the schema property of data collections more generic, perhaps accept an object that can be generated from different sources or introduce an adapter that transforms to the necessary format?
Thank you for considering 🌈
The text was updated successfully, but these errors were encountered:
Also, changing the validator library is not planned yet, but we are checking for ways to improve the validation in Nuxt Content. We might leverage https://standardschema.dev/ for generic validation, which unlocks the possibility of using different validation libraries.
But still Nuxt Content uses schema for other purposes, like generating database structure and this might be one of the blockers for supporting different libraries.
We already have an extensive set of complex Typescript types and maintaining a duplicate set of those via zod would be quite the headache.
As a workaround I am casting the query result to a certain type, I suppose that’s the easiest fix for that for now?
constqueryPath=`/foo/bar`// Can be either .json or .mdconst{ data }=awaituseAsyncData(queryPath,()=>queryCollection("foo").path(queryPath).all())// Filter .json filesconstjson=(data.value?.find((c)=>c.extension==="json")?.body||{})asFooType
Hello,
It would be amazing to have the option of defining a custom validator instead of zod only – seems a very opionated assumption that everyone is using
zod
. We have migrated to valibot as (purely subjective) we deem it better, more lightweight and flexible.Validators are purely matter of taste, so please consider making the
schema
property of data collections more generic, perhaps accept an object that can be generated from different sources or introduce an adapter that transforms to the necessary format?Thank you for considering 🌈
The text was updated successfully, but these errors were encountered: