contact-defined
Since 0.9.0 · In the rulesets: Strict at error, All at error
This rule checks whether complete contact information is present in a Swagger 2.0 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 missingwhen there is noinfo.contactobject,Contact name is missing or emptywhennameis missing or empty,Contact email is missingwhenemailis missing or empty,Contact URL is missingwhenurlis missing or empty.
The OpenAPI and AsyncAPI linters have rules of the same name, contact-defined and contact-defined.
Turn the rule off for APIs used only by the team that owns them.
Examples
Good.
swagger: '2.0'
info:
title: Pet Store
version: 1.0.0
contact:
name: Pet Platform Team
email: pets@your-company.com
url: https://your-company.com/teams/pets
paths: {}
Bad. The contact object is present, but it is not possible to reach the team by email.
swagger: '2.0'
info:
title: Pet Store
version: 1.0.0
contact:
name: Pet Platform Team
url: https://your-company.com/teams/pets
paths: {}
Turn it off or change its severity
In apigenie.yaml, off turns the rule off and warning or error sets its severity; a rule with options takes the severity and the options as a pair, [warning, options]. lint.swagger has the details.
commands:
lint:
swagger:
rules:
contact-defined: off