python-jsonschema / python-jsonschema/jsonschema
Designating a dialect for custom metaschemas in 4.18
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5k
- Forks
- 671
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Description
I'm working with a custom metaschema that is a superset of draft 4, is there/will there be a way to select the draft 4 dialect when creating a Validator class? Currently the create method is choosing the opaque dialect when it fails to recognize our metaschema's id:
https://github.com/python-jsonschema/jsonschema/blob/v4.18.0a1/jsonschema/validators.py#L187
and the referencing package doesn't appear to offer a sanctioned method for registering a new dialect id:
https://github.com/python-jsonschema/referencing/blob/v0.24.4/referencing/jsonschema.py#L544-L556
Is there another way to accomplish this that I'm missing? And if not, are you open to adding something like a default_specification argument to the create method?
By the way, thanks a lot for providing an alpha release, it's super helpful to be able to work through our issues ahead of time.
Contributor guide
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 with the create method in jsonschema/validators.py at the linked line, then read the dialect registration code in referencing/jsonschema.py at the linked lines. Review the discussion to determine whether custom metaschemas should select draft 4 or register a new dialect. Done means an agreed, supported way to choose the specification for a custom metaschema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100