spectral:oas warn on by default

path-declarations-must-exist

Applies to
paths
Selects
$.paths
Function
pattern
Specs
OpenAPI 2.0OpenAPI 3.0OpenAPI 3.1OpenAPI 3.2
Message
Path parameter declarations must not be empty, ex."/given/{}" is invalid.

Use it

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

extends: spectral:oas
rules:
  path-declarations-must-exist: warn   # or off, or another severity

Definition

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

path-declarations-must-exist:
  message: 'Path parameter declarations must not be empty, ex."/given/{}" is invalid.'
  recommended: true
  given: $.paths
  then:
    field: '@key'
    function: pattern
    functionOptions:
      notMatch: '{}'

About this rule

Path parameter declarations cannot be empty, ex./given/{} is invalid.

Sources