spectral:asyncapi warn on by default

asyncapi-3-server-no-empty-variable

Server host and pathname must not have empty variable substitution pattern.

Applies to
hostpathname
Selects
$.servers[*].host
$.servers[*].pathname
Function
pattern
Specs
AsyncAPI 3.x

Use it

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

extends: spectral:asyncapi
rules:
  asyncapi-3-server-no-empty-variable: warn   # or off, or another severity

Definition

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

asyncapi-3-server-no-empty-variable:
  description: Server host and pathname must not have empty variable substitution pattern.
  recommended: true
  formats:
    - AsyncAPI 3.x
  given:
    - '$.servers[*].host'
    - '$.servers[*].pathname'
  then:
    function: pattern
    functionOptions:
      notMatch: '{}'

About this rule

Server host and pathname variable declarations cannot be empty, ex.gigantic-server.com{} is invalid.

Sources