New schema implementation idea
gregsdennis opened this issue · 1 comments
I think that there is much to be said about a generic solution for schema. Especially given the upcoming changes for draft 8, now may be the time to change some things in the back-end.
I think I can keep the public-facing types, meaning that the change would be non-breaking, but the internals definitely need to be updated. I can probably take a page out of my Manatee.Trello book: contexts.
The idea is that the schema objects will just be a front for a single generic schema validation engine. Each of the properties will map themselves to a validator based on property name and schema type. The engine will then search the validators for one that handles the property name for that schema and run it.
$ref
resolution may need to go through the engine as well since draft 8 is likely going to change some things around how this keyword is interpreted.
Validators are already fairly independent from the schema itself.