Skip to content

Deceptive error message when declaring unused server variables #1107

@musa11971

Description

@musa11971

Example:

servers:
  - url: https://api.example.com/v1
    description: Production server
    variables:
      region:
        default: us-east
        enum:
          - us-east
          - eu-west
        description: API region endpoint

In the above case, "region" has been declared as a variable, but it is unused. kin-openapi gives the following error when validating:

invalid servers: server has undeclared variables

This is deceptive, since the variable is in fact declared, however it is unused. A more fitting error message would be:

invalid servers: server has unused variable(s)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions