Open KKSzymanowski opened 1 year ago
It might not give you the exact output you're looking for but you might be able to reconstruct it yourself, have you looked into: schema.describe()
?
Sadly describe()
doesn't give any validation error messages and the info it gives isn't really structured in a way to be easily translated into the messages.
I have tried doing it via schema.$_terms
but I can't ever be sure that I'm including everything because some rules are under dependencies
, some are under flags
etc. Also the messages don't align very well with the rules in some cases, for example { presence: 'forbidden' }
generates any.unknown
, not any.forbidden
.
Alright I understand. Maybe somebody else has a better suggestion for you.
Support plan
Context
How can we help?
Given some schema, how can I list all possible validation errors that can occur when validating an object against that schema.
For example for this schema:
I'd get: