show the full path of the error/warning in iter_errors
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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]
- Langage dominant
- Python
- Étoiles
- 409
- Forks
- 73
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python-openapi/openapi-spec-validator
-
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 30/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 42/100
python-openapi/openapi-spec-validator#400 · 1 commentaire ·
-
kind/bug/confirmed
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
python-openapi/openapi-spec-validator#373 · 1 commentaire ·
Toutes les issues de python-openapi/openapi-spec-validator
Issues similaires
-
sponsored
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
opensubtitlescom: moviehash never sent when opensubtitles (.org) is not in the provider list Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
Diaoul/subliminal#1382 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
-
triage/confirmed
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
agentscope-ai/agentscope#2775 ·
-
worker.gpuVendors silently accepts unsupported/misspelled vendor names — no validation guard Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100