Skip to main content

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.

PropertyValue
EnabledYes
Maximum SeverityError
MessageThe definition for path parameter used in the path URL does not exist.
CodeOPENAPI3STANDARDS_V036
TypeValidation
Rule SystemSemantic
Broad CategoryPaths
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 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