spectral:oas warn off by default

info-license

Info object must have "license" object.

Applies to
license
Selects
$
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:
  info-license: true

Definition

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

info-license:
  description: Info object must have "license" object.
  recommended: false
  given: $
  then:
    field: info.license
    function: truthy

About this rule

The info object should have a license key.

It can be hard to pick a license, so if you don’t have a lawyer around you can use TLDRLegal and Choose a License to help give you an idea.

How useful this is in court is not entirely known, but having a license is better than not having a license.

Good Example

openapi: "3.0.2"
info:
  license:
    name: MIT

Sources