# servers-defined

Source: https://api-genie.dev/docs/linter/asyncapi/rules/servers-defined

A rule of the AsyncAPI linter, which reads AsyncAPI 3 documents; the reader rejects AsyncAPI 2 documents. Since 0.9.0. In the rulesets: Recommended at warning, Strict at error, All at error.

This rule checks whether at least one server is defined in an AsyncAPI
document.

## Rule details

Servers tell consumers where the application's channels are available: which
broker to connect to, and with which protocol. Without them, the document
describes messages but not how to reach them.

The `servers-defined` rule reports `No servers defined` when the root
`servers` map is missing or empty. Servers defined only under
`components/servers` do not count.

Turn the rule off for documents that describe messages shared by several applications, and whose
servers are defined elsewhere.

## Examples

**Good**.

```yaml
asyncapi: 3.0.0
info:
  title: Pet Events
  version: 1.0.0
servers:
  production:
    host: broker.your-company.com:9092
    protocol: kafka
```

**Bad**.

```yaml
asyncapi: 3.0.0
info:
  title: Pet Events
  version: 1.0.0
channels:
  petAdopted:
    address: pets.adopted
```
