[Schema Inaccuracy] example seemingly used as a pseudo-discriminator
@nickfloyd 已经在做这个了。
开始于 2025年11月6日。
评估
这个 Issue 还没有评估数据。
描述
.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.
- 主要语言
- 没有语言数据
- 星标
- 1.6k
- 派生
- 342
- 平均合并
- 2 小时 23 分钟
- 30 天内合并 PR
- 57
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/rest-api-description 的其他 Issue
-
feature
难度 2/5 1-3 小时 新手友好度 85/100
github/rest-api-description#7220 ·
-
feature
难度 2/5 1-3 小时 新手友好度 82/100
github/rest-api-description#7201 ·
-
feature
难度 2/5 1-3 小时 新手友好度 72/100
github/rest-api-description#7163 ·
-
feature
难度 2/5 1-3 小时 新手友好度 68/100
github/rest-api-description#7162 ·
-
feature
难度 2/5 1-3 小时 新手友好度 68/100
github/rest-api-description#7135 ·