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.
-
For every parameter referenced in the path string (i.e:
/users/{userId}), the parameter must be defined in eitherpath.parameters, oroperation.parametersobjects (non-standard HTTP operations will be silently ignored.) -
every
path.parametersandoperation.parametersparameter must be used in the path string.