-
Notifications
You must be signed in to change notification settings - Fork 29
Allow custom validation rules in validator #1089
Description
Currently the validator only validates against known traits (e.g. range etc) and if you defined a custom protocol or just added some custom traits, there is no way to add validation rules for them unless you implement the whole validation yourself. It would be great if Validator would provide a way to override handling for each node so that if there is a custom trait then it can be handled. I see it maybe like an extra class (maybe similar to ShapeVisitor with ShapeVisitor.Default option but with validation API) that you can provide to the validator that it will call for every node it sees before/after the default validation. I know that the generated schema extracts some of the "known" values and saves them in the schema for performance reasons I guess and maybe it would be good to have an option to provide custom extracted fields as well? But I'm not too sure how it going to look like tho. Let me know what you think, I'm happy to contribute (if we agree on the solution).