show the full path of the error/warning in iter_errors
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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]
- Ngôn ngữ chính
- Python
- Star
- 409
- Fork
- 73
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của python-openapi/openapi-spec-validator
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
python-openapi/openapi-spec-validator#400 · 1 bình luận ·
-
kind/bug/confirmed
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
python-openapi/openapi-spec-validator#373 · 1 bình luận ·
Tất cả issue của python-openapi/openapi-spec-validator
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
use-agent-os/agent-os#3314 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
BasedHardware/omi#15662 · 1 bình luận ·
-
documentation help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
AiursoftWeb/AnduinOS-2#19 ·