Standard Schema validation output issues can't be flattened
As far as I can tell the other validation libraries will have multiple issues for the same path, but for arktype they all get grouped in an intersection error type (if I have something like
string < 10 & /some_regex/
and it fails both
I feel like the default should flatten all errors in arktype to match the others behavior, or at least make it configurable?
Or is the intention to just wrap our own StandardSchema around arktype where we flatten if needed?5 Replies
Errors are flattened by path because that's usually the most actionable result, but ArkErrors also has a
.flat
prop you can use to get this
Also you can get individual errors from an intersection error so it's not lossy
Myeah, but you lack those when passing an arktype schema into a place expecting a StandardSchema
Maybe other schema libraries should change to group errors by path so they're more useful and save user some work then 😉
Well, I guess wrapping arktype into a (flaterrors standard schema) is not that hard
There's nothing about this grouping that doesn't conform to Standard Schema. If you need the granular details this way, you'll have to check if it's an arktype Type then acces
.flat