-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider adding referencing.jsonschema.SchemaValidatingRegistry
#68
Comments
A further consideration I suppose is that whilst we don't yet have any OpenAPI / AsyncAPI-specific support, when we do, that support may also benefit from such an object, which is possibly further argument to not couple at all to |
Regarding how this relates back to #119 (I think it does relate; I think it's a good fit!), I don't think it's necessary or desriable that all of the validation happens when a resource is added to the registry. You probably already have this idea in mind, but I'd allow for invalid_schema = ...
registry = invalid_schema @ registry # fine
registry.lookup(...) # big boom! as valid/correct behavior. For |
(I have not fully specced this out so definitely definitely your thoughts are even more welcome than they always are, and also as usual I'll respond just with first thoughts so it's possible I'll change my mind quite easily :)
The idea I think was to tie this to registry |
Am I understanding correctly that
With the expectation that an implementation will try to match against The only project I've encountered in the wild where this is very significant is mkdocs-material. They have a plugin community which provides their own schemas. As a result, So that's sort of a question / input here: I think lazy evaluation is desirable for some users. Am I following the idea of |
And in that case you want to essentially defer checking the schema is valid until the first time it's looked up, right? If so I think that's definitely doable, basically defer validation until "crawl-time" but not force you to crawl all the schemas sounds like "ideal" behavior. |
For future noodling, there is some work in this area experimentally in Bowtie -- though it involves two concepts, validator registries as well as endpoints. |
It might be a nice convenience to have an object with the same interface as
referencing.Registry
but which automatically validated schemas (Resource
s) on insertion.Specifically an object where (in pseudocode):
This would be an inverted dependency on
jsonschema
(the library) -- because we'd callDraftNValidator.check_schema
each time a resource was added to theSchemaValidatingRegistry
.We should likely allow for parametrizing looking up the right object for validation (i.e. fetching which metaschema to use and what function to call with it), especially considering that this library (
referencing
) is meant to be JSON Schema implementation agnostic.The text was updated successfully, but these errors were encountered: