license-defined
Since 0.0.1 · In the rulesets: Strict at error, All at error
This rule checks that info.license is present, with a name and a url or an SPDX
identifier.
Rule details
The license says on which terms the API and its description may be used, and a client that cannot find it has to ask. The OpenAPI specification makes the whole object optional.
The rule reports License object is missing, License name is empty,
Both the license URL and identifier are missing or empty and
License identifier is not a valid SPDX identifier. Turn it off for APIs that never leave the
team.
Examples
Good. A name and a link to the text.
openapi: 3.1.0
info:
title: Inventory
version: 1.0.0
license:
name: Apache 2.0
url: https://your-company.com/api/LICENSE
paths: {}
Good. A name and an SPDX identifier (OpenAPI 3.1 and later).
openapi: 3.1.0
info:
title: Inventory
version: 1.0.0
license:
name: Apache 2.0
identifier: Apache-2.0
paths: {}
Bad. No license.
openapi: 3.1.0
info:
title: Inventory
version: 1.0.0
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.rules has the details.
commands:
lint:
rules:
license-defined: off