Skip to main content

path-declaration-must-exist

Requires at least one API path and disallows empty {} path parameters.

AttributeValue
CategoryOperations
MaturityBaseline
OpenAPISwagger 2.0; OpenAPI 3.0, 3.1, 3.2
StarterWarning
Lenient–CompleteError

Intent

An API contract needs an addressable operation surface, and every templated segment needs a parameter name.

Flags

  • A document with no parsed path entries.
  • Every path string containing the exact text {}.

Does not flag

A document with at least one path and no empty parameter declaration. Whether a path item contains an HTTP operation is outside this rule.

See it fail

paths:
/payments/{}:
get:
responses:
'200': {description: OK}

Diagnostic: Path parameter declarations must be non-empty. `{}` is invalid.

Fix it

paths:
/payments/{paymentId}:
get:
responses:
'200': {description: OK}

Also define the matching path parameter; path-parameters-defined checks that requirement.

Configure

profiles:
default:
rules:
extends: [recommended]
override:
path-declaration-must-exist: warn

Nearby: path-parameters-defined, no-ambiguous-paths.