Linter rulesAsyncAPIlicense-defined
license-defined
Since 0.9.0
This rule checks whether the licensing information is present in an AsyncAPI document.
Rule Details
The license-defined rule is designed to ensure that the info.license
object is defined, and that both its name and its url are provided. This
information is crucial as it specifies the terms under which the API can be
used.
The rationale behind this rule is to enforce the inclusion of licensing information in the API specification. This helps users of the API to understand the terms of use and any restrictions that may apply.
The rule reports:
License object is missingwhen there is noinfo.licenseobject,License name is emptywhennameis empty,License URL is missing or emptywhenurlis missing or empty.
Unlike OpenAPI 3.1, AsyncAPI license objects have no SPDX identifier field,
so the rule always requires a URL.
Configuration
None.
Examples
Good. The document provides a link to its license, thus making it easier to understand how the API can be used.
asyncapi: 3.0.0
info:
title: Pet Events
version: 1.0.0
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
Bad. The license has a name, but no link to its terms.
asyncapi: 3.0.0
info:
title: Pet Events
version: 1.0.0
license:
name: Proprietary
When Not to Use It
You may skip licensing information for team-level APIs.
Compatibility
This rule is compatible with AsyncAPI 3.x documents. AsyncAPI 2.x documents are rejected by the reader and are not linted.