spectral:asyncapi warn on by default

asyncapi-unused-components-server

Potentially unused components server has been detected.

Applies to
servers
Selects
$.components.servers
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-server: warn   # or off, or another severity

Definition

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

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

About this rule

Potential unused reusable server 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