kin-openapi icon indicating copy to clipboard operation
kin-openapi copied to clipboard

Deceptive error message when declaring unused server variables

Open musa11971 opened this issue 3 months ago • 0 comments

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)

musa11971 avatar Nov 08 '25 09:11 musa11971