spectral:asyncapi warn on by default

asyncapi-server-no-empty-variable

Server URL must not have empty variable substitution pattern.

Applies to
url
Selects
$.servers[*].url
Function
pattern
Specs
AsyncAPI 2.x

Use it

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

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

Definition

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

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

About this rule

Server URL variable declarations cannot be empty, ex.gigantic-server.com/{} is invalid.

Sources