Open
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.