spectral:asyncapi warn on by default

asyncapi-info-contact-properties

Contact object must have "name", "url" and "email".

Applies to
emailnameurl
Selects
$.info.contact
Function
truthy
Specs
AsyncAPI 2.xAsyncAPI 3.x

Use it

This rule ships with OpenLint in spectral:asyncapi. Extending the ruleset turns it on:

extends: spectral:asyncapi
rules:
  asyncapi-info-contact-properties: warn   # or off, or another severity

Definition

As defined in @openlint/openlint-rulesets. Functions show by name.

asyncapi-info-contact-properties:
  description: 'Contact object must have "name", "url" and "email".'
  recommended: true
  formats:
    - AsyncAPI 2.x
    - AsyncAPI 3.x
  given: $.info.contact
  then:
    - field: name
      function: truthy
    - field: url
      function: truthy
    - field: email
      function: truthy

About this rule

The asyncapi-info-contact rule will ask you to put in a contact object, and this rule will make sure it’s full of the most useful properties: name, url, and email.

Putting in the name of the developer/team/department/company responsible for the API, along with the support email and help-desk/GitHub Issues/whatever URL means people know where to go for help. This can mean more money in the bank, instead of developers just wandering off or complaining online.

Good Example

asyncapi: "2.0.0"
info:
  title: Awesome API
  description: A very well-defined API
  version: "1.0"
  contact:
    name: A-Team
    email: a-team@goarmy.com
    url: https://goarmy.com/apis/support

Sources