[Schema Inaccuracy] example seemingly used as a pseudo-discriminator
@nickfloyd đang làm issue này rồi.
Từ ngày 6/11/2025.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
.components.schemas.environment.properties.protection_rules (and some other places I think) is defined as:
"anyOf": [
{
"type": "object",
"properties": {
"id": { "type": "integer", "example": 3515 },
"node_id": { "type": "string", "example": "MDQ6R2F0ZTM1MTU=" },
"type": { "type": "string", "example": "wait_timer" },
"wait_timer": { "$ref": "#/components/schemas/wait-timer" }
},
"required": [ "id", "node_id", "type" ]
},
{
"type": "object",
"properties": {
"id": { "type": "integer", "example": 3515 },
"node_id": { "type": "string", "example": "MDQ6R2F0ZTM1MTU=" },
"type": { "type": "string", "example": "required_reviewers" },
"reviewers": { ... }
},
"required": [ "id", "node_id", "type" ]
},
{
"type": "object",
"properties": {
"id": { "type": "integer", "example": 3515 },
"node_id": { "type": "string", "example": "MDQ6R2F0ZTM1MTU=" },
"type": { "type": "string", "example": "branch_policy" }
},
"required": [ "id", "node_id", "type" ]
}
The examples associated with the type property seem to be used as discriminator values (although without that being spelled out explicitely anywhere).
I understand OpenAPIv3 has a discriminator feature for exactly that use case.
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 1.6k
- Fork
- 342
- Merge trung bình
- 2 giờ 23 phút
- Pull request đã merge (30 ngày)
- 57
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 github/rest-api-description
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
github/rest-api-description#7220 ·
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
github/rest-api-description#7201 ·
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/rest-api-description#7163 ·
-
Runner deprecations: registration_deprecates_at is declared on the response but never returned Đang mởfeature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
github/rest-api-description#7162 ·
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
github/rest-api-description#7135 ·