show the full path of the error/warning in iter_errors
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Start at openapi_v3_spec_validator.iter_errors and reproduce the reported output with the OpenAPI document and snippet in the issue. Trace how validation errors are formatted and verify that each emitted error includes the requested absolute path, including the shown parameters[4] location.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Hi everyone
I'm validating this open API: https://api.apis.guru/v2/specs/exlibrisgroup.com/tasklists/1.0/openapi.json and I need it to show me the absolute path of the error/warning instead, not only: {'default': '10', 'type': 'integer', 'nullable': False}
because the API is a little big and I want an easy way to trace the error/warning.
the code:
import json
import requests
from openapi_spec_validator import openapi_v3_spec_validator
with open('openapi.json', 'w') as file:
file.write(requests.get('https://api.apis.guru/v2/specs/exlibrisgroup.com/tasklists/1.0/openapi.json').text)
file.close()
with open('openapi.json', 'r') as file:
schema = json.load(file)
file.close()
errors = openapi_v3_spec_validator.iter_errors(schema)
for error in errors:
print(error)
print(error.schema, error.path, error.absolute_schema_path)
print(error.relative_path, error.relative_schema_path, error.schema_path)
break
the output:
'10' is not of type integer
Failed validating 'type' in schema:
{'default': '10', 'nullable': False, 'type': 'integer'}
On instance:
'10'
{'default': '10', 'type': 'integer', 'nullable': False} deque([]) deque(['type'])
deque([]) deque(['type']) deque(['type'])
it would be nice if this output is also added to the message:
#/paths//almaws/v1/task-lists/printouts/get/parameters[4]
- Linguagem predominante
- Python
- Estrelas
- 409
- Forks
- 73
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de python-openapi/openapi-spec-validator
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 30/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 42/100
python-openapi/openapi-spec-validator#400 · 1 comentário ·
-
kind/bug/confirmed
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
python-openapi/openapi-spec-validator#373 · 1 comentário ·
Todas as issues de python-openapi/openapi-spec-validator
Issues semelhantes
-
triage/confirmed
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
apache/cloudstack#14222 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100