Skip to content

[Schema Inaccuracy] Type of code-scanning-alert-dismissed-reason could be simplified #167

Closed
@pluehne

Description

@pluehne

Schema Inaccuracy

The code-scanning-alert-dismissed-reason schema component of the specification of api.github.com is defined as follows:

code-scanning-alert-dismissed-reason:
  type: string
  description: "**Required when the state is dismissed.** The reason for dismissing
    or closing the alert. Can be one of: `false positive`, `won't fix`, and `used
    in tests`."
  nullable: true
  oneOf:
  - enum:
    - false positive
    - won't fix
    - used in tests
  - enum:
    - ""

First, the two enums that are joined by oneOf could be joined into one for the sake of simplicity. Second, I’m not sure whether the empty string is actually intended to be allowed as a value, considering that the field is already nullable. To me, it looks like that enum value can be dropped.

Expected

Unless there’s a good reason to keep allowing "" as a value, I’d suggest to adjust the schema component as follows:

code-scanning-alert-dismissed-reason:
  type: string
  description: "**Required when the state is dismissed.** The reason for dismissing
    or closing the alert. Can be one of: `false positive`, `won't fix`, and `used
    in tests`."
  nullable: true
  enum:
  - false positive
  - won't fix
  - used in tests

Edit (2020-01-18): The empty string enum value is syntactically correct in recent versions (was - and now is - ""), so that doesn’t need fixing anymore.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions