This rule checks whether the contact object is present in an OpenAPI schema.
The contact-defined
rule is designed to ensure that the contact object is
defined in an OpenAPI schema. This object is important as it provides contact
information for the exposed API.
The rule requires the contact object to have the name
attribute, and one or
both the url
and email
attributes.
None.
Bad. In case of the following API, clients do not know whom to contact in case of problems.
openapi: 3.1.0
info:
title: A public API
version: 0.2.0
paths: ...
Good. The following private API defines a contact by specifying a team name and a Slack channel.
openapi: 3.1.0
info:
title: A private API
version: 12.4.0
contact:
name: team-one
url: https://your-company.slack.com/archives/C0278047U8G
paths: ...
You may skip this rule if the point of contact is well known and does not change with time.
This rule is compatible with all OpenAPI 3.x version.