Consider an API which collects validation errors and raises an exception group

Aberta
#1,011 0 comentários 1 reação 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 6 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
25/100
Tipo de issue
Funcionalidade
Clareza
Precisa de esclarecimento
Status de atividade
Estagnada
Stack de tecnologia
python

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Dialects v2 Enhancement Error Reporting

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 errors
  • Validator.is_valid, aimed at returning no errors and indicating via a boolean whether things are OK
  • Validator.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.

Linguagem predominante
Python
Estrelas
5k
Forks
741
Merge médio
4d 17h
PRs com merge (30d)
6

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de python-jsonschema/jsonschema

Todas as issues de python-jsonschema/jsonschema

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.