The Response object's `default` field is confusing and inconsistently interpreted
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 28/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- openapi
- Lĩnh vực
- api, documentation
Hướng nghiên cứu
Bắt đầu bằng việc xem xét examples/v3.0/petstore-expanded.yaml và các định nghĩa đối tượng Response cho OpenAPI 3.0 và 3.1. So sánh ý nghĩa được tài liệu hóa của default với cách xử lý lỗi mà ví dụ hướng đến, sau đó xác định việc làm rõ hoặc cập nhật ví dụ nào là khả thi; để hoàn tất sẽ cần có một thay đổi được thống nhất đối với đặc tả hoặc các ví dụ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
According both 3.0 and 3.1, in theResponse object there MUST be at least one response code and it SHOULD be the response for a successful operation call. In addition the default describes “responses other than the ones declared for specific HTTP response codes”.
This means that if we had a 200 response and default, the latter would cover everything except for 200. Many seem to interpret default to mean something like response categories not covered by explicit response codes. Consider this example from the OAI org:
responses:
'200':
description: pet response
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/petstore-expanded.yaml
This implies that default covers error types when in fact it covers non-error responses as well. In fact, the consumer wouldn't necessarily know if the API might reply with another success code such as a 204. A more precise example might look like this:
responses:
'200':
description: pet response
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
4xx:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
5xx:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
I would suggest the following actions:
- Update the example to interpret the spec more literally
- Clarify
defaultsince this confusion is not limited to this example, but extends to APIs in the wild - Consider in 3.2 or 4.0 eliminating
default - Consider in 3.2 or 4.0 adding a new named
errorcategory that means "both 4xx and 5xx". This could be used in the way thatdefaultis often misused today
- Ngôn ngữ chính
- Markdown
- Star
- 31.2k
- Fork
- 9.2k
- Merge trung bình
- 2 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- 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 OAI/OpenAPI-Specification
-
Housekeeping
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 45/100
OAI/OpenAPI-Specification#5566 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Housekeeping
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 35/100
OAI/OpenAPI-Specification#5562 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Housekeeping
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
OAI/OpenAPI-Specification#5556 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
v3.2.1 releaseCó thể làm lại được @lornajane đã nhận 33 ngày trước và không có pull request nào đang mở. Đang mở
OAI/OpenAPI-Specification#5460 · 11 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
param serialization
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
OAI/OpenAPI-Specification#5366 · 12 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của OAI/OpenAPI-Specification
Issue tương tự
-
effort: low prio: low ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
digitalfabrik/integreat-cms#4616 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
refactor topic-map
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add an EPUB parserĐang mởarea: core good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
openapi/gknowledge#21 ·
-
get() for StrEnumCó thể đã có người làm @FeJo5952 đã nhận hôm nay. Đang mởgood first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
collective/icalendar#1921 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ETQ admin, le select de condition d'une annotation répétable liste les champs publics deux foisĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
demarche-numerique/demarche.numerique.gouv.fr#14301 ·
Maintainer thường phản hồi trong vòng 1 ngày