Skip to content

Allow custom validation rules in validator #1089

@timocov

Description

@timocov

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions