Requires the servers list is defined in your API.
| OAS | Compatibility |
|---|---|
| 2.0 | ❌ |
| 3.0 | ✅ |
| 3.1 | ✅ |
An empty servers list defaults to localhost, which is not practical for your API consumers. An API cannot be used without a server. Define servers so that the Try it and code sample generator features in OpenAPI tools (including Redocly) can produce functional API requests.
If you don't have a server because the consumer is responsible for setting up their own server, you can still describe the server with server variables. The following code sample shows declaration of a server variable.
servers:
- url: 'https://{tenant}/api/v1'
variables:
tenant:
default: api.example.com
description: Your server host| Option | Type | Description |
|---|---|---|
| severity | string | Possible values: off, warn, error. Default error (in recommended configuration). |
An example configuration:
rules:
no-empty-servers: errorGiven this configuration:
rules:
no-empty-servers: errorExample of incorrect empty servers:
server: []Example of correct servers:
servers:
- url: https://development.gigantic-server.com/v1
description: Development server