spectral:asyncapi warn on by default

asyncapi-unused-components-schema

Potentially unused components schema has been detected.

Applies to
schemas
Selects
$.components.schemas
Function
unreferencedReusableObject
Specs
AsyncAPI 2.xAsyncAPI 3.x

Use it

This rule ships with OpenLint in spectral:asyncapi. Extending the ruleset turns it on:

extends: spectral:asyncapi
rules:
  asyncapi-unused-components-schema: warn   # or off, or another severity

Definition

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

asyncapi-unused-components-schema:
  description: Potentially unused components schema has been detected.
  recommended: true
  formats:
    - AsyncAPI 2.x
    - AsyncAPI 3.x
  given: $.components.schemas
  resolved: false
  then:
    function: unreferencedReusableObject
    functionOptions:
      reusableObjectsLocation: '#/components/schemas'

About this rule

Potential unused reusable schema entry has been detected.

Warning: This rule may identify false positives when linting a specification that acts as a library (a container storing reusable objects, leveraged by other specifications that reference those objects).

Sources