Closed beyondcreed closed 5 years ago
I can't come up with a nice way to do this, without bringing JSON::Validator out of scope for what it's designed to do.
yeah, was just curious how they dealt (or if they even did) with this in the drafts. it would be nice to have definitions for lang neutral custom validators in addition to prebuilt constructs.
another thing, while we are on the subject, is chained validators. If we can make a chain of rules that must all pass or at least some to satisfy constraint imposed on param.
Can you show me where in the drafts they talk about this?
Can't you use "allOf":[...]
for chained validation? https://github.com/jhthorsen/json-validator/blob/master/t/jv-allof.t
never saw it in the drafts, that is why I was asking above, thought maybe you knew of anything. ah, allOf, anyOf should work for that use case, thanks.
so its just the custom validators at this point.
I am still reviewing json schema drafts, but was wondering if there was a way to specify custom validator rule or constraint.
e.g. lets say you wanna validate email in backend and return error if one is found, is there a way to specify property so that validator could execute custom handler for it. In this instance, we would query db to see if such record exists.