pre-defined-path-parameter-for-path-url-template-expression
Overview
This rule belongs to the openapi-v3-standards-validation
ruleset and states that:
A path parameter referenced in the path URL must be defined within every Operation Object associated with the Path Item Object, or defined once globally in the Path Item Object parameters. An exception is if the path item is empty, for example due to ACL constraints, matching path parameters are not required.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | The definition for path parameter used in the path URL does not exist. |
Code | OPENAPI3STANDARDS_V036 |
Type | Validation |
Rule System | Semantic |
Broad Category | Paths |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation path parameter parameter path template url |
Suggested Fixes
- If you have a variable defined in your path URL, ensure that a corresponding definition for it exists in the
parameters
property of the Operation Object or Path Item Object. - In the path URL the content used between two curly braces { } is considered a path parameter name.
- Make sure that the name assigned to the definition of parameter matches the name of the parameter used in the path URL. Names are compared in a case-sensitive manner.
- If the curly braces are not intended to be treated as path parameters, ensure that the specified path URL is properly escaped.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-templating
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#path-templating
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#path-item-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/