python-jsonschema / python-jsonschema/referencing
Consider adding `referencing.jsonschema.SchemaValidatingRegistry`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 53
- Forks
- 27
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 8
Description
It might be a nice convenience to have an object with the same interface as referencing.Registry but which automatically validated schemas (Resources) on insertion.
Specifically an object where (in pseudocode):
import referencing.jsonschema
valid_schema = referencing.jsonschema.DRAFT7.create_resource({"type": "integer"})
invalid_schema = referencing.jsonschema.DRAFT7.create_resource({"type": 37})
registry = referencing.jsonschema.SchemaValidatingRegistry()
valid_schema @ registry # fine
invalid_schema @ registry # -> big boom!
This would be an inverted dependency on jsonschema (the library) -- because we'd call DraftNValidator.check_schema each time a resource was added to the SchemaValidatingRegistry.
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing referencing.Registry interface and referencing.jsonschema resource creation around DRAFT7.create_resource. Compare the proposed SchemaValidatingRegistry behavior with DraftNValidator.check_schema and determine how configurable metaschema lookup should work; done means insertion validates resources and rejects invalid schemas without breaking the registry interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100