spectral:oas error on by default

path-params

Path parameters must be defined and valid.

Applies to
paths
Selects
$.paths
Function
oasPathParam
Specs
OpenAPI 2.0OpenAPI 3.0OpenAPI 3.1OpenAPI 3.2
Message
{{error}}

Use it

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

extends: spectral:oas
rules:
  path-params: error   # or off, or another severity

Definition

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

path-params:
  description: Path parameters must be defined and valid.
  message: '{{error}}'
  severity: 0
  recommended: true
  given: $.paths
  then:
    function: oasPathParam

About this rule

Path parameters are correct and valid.

  1. For every parameter referenced in the path string (i.e: /users/{userId}), the parameter must be defined in either path.parameters, or operation.parameters objects (non-standard HTTP operations will be silently ignored.)

  2. every path.parameters and operation.parameters parameter must be used in the path string.

Sources