This rule ensures that for all parameter placeholders defined in path item URLs, there are path parameters defined in corresponding path items or their operations.
The path-parameters-defined
rule is designed to ensure that for all
parameter placeholders defined in path item URLs, there are corresponding path
parameters defined in the path items or their operations. This helps to
maintain consistency and clarity in the API’s structure.
None.
Good.
paths:
/users/{userId}:
parameters:
- name: userId
in: path
required: true
schema:
type: string
get:
summary: Get a user by ID
Bad. Definition of the userId
parameter is missing.
paths:
/users/{userId}:
get:
summary: Get a user by ID
If your API does not use path parameters or if you have other means of ensuring that all parameter placeholders have corresponding path parameters, you may not need to use this rule.
This rule is compatible with all OpenAPI 3.x versions.