Disallow server variables without enum list defined.
| OAS | Compatibility |
|---|---|
| 2.0 | ❌ |
| 3.0 | ✅ |
| 3.1 | ✅ |
| 3.2 | ✅ |
If you use server variables, there are generally two kinds:
- tenant-driven
- environment-driven
In the case of environment-driven variables, you may want to predefine all of the possible values.
| Option | Type | Description |
|---|---|---|
| severity | string | Possible values: off, warn, error. Default error (in recommended configuration). |
An example configuration:
rules:
no-server-variables-empty-enum: errorGiven this configuration:
rules:
no-server-variables-empty-enum: errorExample of incorrect server variables:
servers:
- url: 'https://{env}.example.com/api/v1'
variables:
env:
default: api
description: EnvironmentExample of correct server:
servers:
- url: 'https://{env}.example.com/api/v1'
variables:
env:
default: api
description: Environment
enum:
- api
- sandbox
- qa
- test
- dev