Skip to main content

no-undefined-server-variable

Requires every server URL placeholder to be defined and, by default, every defined variable to be used.

AttributeValue
CategoryMetadata
MaturityBaseline
OpenAPIOpenAPI 3.0, 3.1, 3.2
StarterWarning
Lenient–CompleteError

Intent

Server URL templates and their variable definitions must stay synchronized for reliable URL expansion.

Flags

  • Each {name} found in a server URL with no exactly matching variable definition.
  • Unless allowed, each defined variable not present in the URL.

All parsed server locations are inspected; matching is case-sensitive.

Does not flag

Synchronized variables. With allowUnusedVariables: true, unused definitions are accepted, but undefined URL placeholders are still reported.

See it fail

servers:
- url: https://{environment}.example.test
variables:
region:
default: us

This reports undefined environment and unused region.

Fix it

servers:
- url: https://{environment}.example.test
variables:
environment:
default: production

Configure

profiles:
default:
rules:
extends: [recommended]
override:
no-undefined-server-variable:
severity: error
allowUnusedVariables: true

Nearby: no-server-variables-empty-enum.