spectral:oas warn off by default

contact-properties

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

Applies to
emailnameurl
Selects
$.info.contact
Function
truthy
Specs
OpenAPI 2.0OpenAPI 3.0OpenAPI 3.1OpenAPI 3.2

Use it

This rule ships with OpenLint in spectral:oas. It's off by default, so turn it on by name:

extends: spectral:oas
rules:
  contact-properties: true

Definition

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

contact-properties:
  description: 'Contact object must have "name", "url" and "email".'
  recommended: false
  given: $.info.contact
  then:
    - field: name
      function: truthy
    - field: url
      function: truthy
    - field: email
      function: truthy

About this rule

The 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

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

Sources