python-jsonschema / python-jsonschema/jsonschema
Consider an API which collects validation errors and raises an exception group
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5k
- Forks
- 671
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Description
Python 3.11 now supports exception groups for grouping together multiple (simultaneous, unrelated) exceptions.
This seems to suit us -- right now we have:
Validator.iter_errors, aimed at returning (not raising) all errorsValidator.is_valid, aimed at returning no errors and indicating via a boolean whether things are OKValidator.validate, aimed at raising 1 single exception (the first encountered one)
Another API where we raise all exceptions iter_errors would have returned seems like it may fit the picture.
Reviewing the notes API to see if we should make any use of it is likely also wise.
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 by reading the existing Validator.iter_errors, Validator.is_valid, and Validator.validate APIs, then review PEP 654 on exception groups and PEP 678 on exception notes. Define whether a new API should raise all validation errors, how it relates to the existing methods, and what completed behavior and compatibility expectations would be.
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
- Needs clarification
- Newbie friendliness
- 25/100