[Schema Inaccuracy] example seemingly used as a pseudo-discriminator
@nickfloyd is already working on this.
Since Nov 6, 2025.
Assessment
This issue has not been assessed yet.
Description
.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.
- Dominant language
- No language data
- Stars
- 1.6k
- Forks
- 342
- Avg merge
- 2h 23m
- Merged PRs (30d)
- 57
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from github/rest-api-description
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
github/rest-api-description#7220 ·
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
github/rest-api-description#7201 ·
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
github/rest-api-description#7163 ·
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/rest-api-description#7162 ·
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/rest-api-description#7135 ·