# servers-defined

Source: https://apigenie.pl/docs/linter/asyncapi/rules/servers-defined

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.

## Configuration

None.

## 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
```

## When Not to Use It

You may disable this rule for documents that describe messages shared by
several applications, and whose servers are defined elsewhere.

## Compatibility

This rule is compatible with AsyncAPI 3.x documents. AsyncAPI 2.x documents
are rejected by the reader and are not linted.
