Linter rulesAsyncAPIcontact-defined

contact-defined

Since 0.9.0

This rule checks whether complete contact information is present in an AsyncAPI document.

Rule Details

The contact-defined rule ensures that the info.contact object is defined and that its name, email and url properties are all present and not empty. Contact information tells consumers of the API whom to ask for help, report problems to, or notify about their use of the API.

The rule reports:

  • Contact object is missing when there is no info.contact object,
  • Contact name is missing or empty when name is missing or empty,
  • Contact email is missing when email is missing or empty,
  • Contact URL is missing when url is missing or empty.

Configuration

None.

Examples

Good.

asyncapi: 3.0.0
info:
  title: Pet Events
  version: 1.0.0
  contact:
    name: Pet Platform Team
    email: pets@your-company.com
    url: https://your-company.com/teams/pets

Bad. The contact object is present, but it is not possible to reach the team by email.

asyncapi: 3.0.0
info:
  title: Pet Events
  version: 1.0.0
  contact:
    name: Pet Platform Team
    url: https://your-company.com/teams/pets

When Not to Use It

You may skip contact information for APIs that are used only by the team that owns them.

Compatibility

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

Related rules