Canonicalise `oneOf` sub-schemas to exclude shared types
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with the not sub-schema handling and the referenced test case in tests/test_from_schema.py; the corpus example is in tests/corpus-suite-schemas.json. Compare canonicalising oneOf branches to include type: object with lowering oneOf to anyOf using not. Done means the supplied case generates values without excessive filtering and the tests catch plausible semantic mistakes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Consider the schema {"oneOf": [{"required": ["foo"]}, {"required": ["bar"]}]}
What values could match this? Because the two sub-schemas only constrain objects, all values of any other type will be valid against both sub-schemas... and therefore invalid against the oneOf schema.
This tends to result in a lot of filtering, so we have a workaround in our tests for this test case.
Obviously it would be nicer to support such schemas properly, by canonicalising them to include type: object (i.e. exclude other types) and therefore translate them to a Hypothesis strategy which doesn't have to filter out so much.
The semantics are a bit too tricky for me to tag this good first issue, though the tests will catch any plausible mistakes you could make. We have some prior art in the handling of "not" sub-schemas, which might provide a good starting point; you might even move shared logic to a new helper function.
Alternatively, 'lowering' oneOf: [a, b, c] to anyOf: [{**a, not: {anyOf: [b, c]}}, ...] would automatically share any improvements to not-logic, which would be nice. Just a question of balancing that against the less elegant canonical form.
- Ngôn ngữ chính
- Python
- Star
- 281
- Fork
- 35
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc 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-jsonschema/hypothesis-jsonschema
-
Missing test files in Pypi releaseCó thể đã có người làm @blouirts123 đã nhận 49 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
-
Shouldn't PKG-INFO Homepage point to https://github.com/python-jsonschema/hypothesis-jsonschema ?Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 58/100
python-jsonschema/hypothesis-jsonschema#114 · 1 bình luận ·
-
Push release tags to github?Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 55/100
python-jsonschema/hypothesis-jsonschema#113 · 1 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
python-jsonschema/hypothesis-jsonschema#104 · 3 reaction ·
Tất cả issue của python-jsonschema/hypothesis-jsonschema
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
web-push-libs/pywebpush#216 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
AgriciDaniel/claude-seo#572 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
area:print-dispatch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: docs domain: technical-writing good first issue type: documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Deepak3699/Ai_Mentor#919 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày