Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Schema Inaccuracy] example seemingly used as a pseudo-discriminator #368

Open
masklinn opened this issue May 31, 2021 · 0 comments
Open

Comments

@masklinn
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants