What this error means
Writing /users/{id} as a path key declares a path parameter named id. Declaring is not defining: OpenAPI also requires a matching entry in a parameters array with in: path, required: true, and a schema. Swagger Editor's semantic validation checks that every {placeholder} in the template has that matching definition, on the path item or on each operation, and raises this error for each one that does not.
Why the validator emits it
- The parameter block was never written. The path template came first and the parameters were left for later.
- The names differ. Matching is exact and case-sensitive, so
{userId}against a parameter nameduseridfails. - The parameter exists with the wrong
in. A parameter namedidwithin: querydoes not satisfy a path placeholder.
openapi: 3.0.3
info:
title: Example API
version: "1.0"
paths:
/users/{id}:
get:
summary: Get a user
responses:
'200':
description: OKopenapi: 3.0.3
info:
title: Example API
version: "1.0"
paths:
/users/{id}:
parameters:
- name: id # matches {id} exactly
in: path
required: true # mandatory for path parameters
schema:
type: string
get:
summary: Get a user
responses:
'200':
description: OKDefining the parameter on the path item covers every operation under that path, which is why the error message offers "either the path or operation level". Move the block inside get only if different operations need different descriptions for the same parameter.
How to catch it earlier
Swagger Editor only tells you about the file you happen to have open. To sweep a whole spec, paste it into the free OpenAPI validator, which reports every template placeholder without a matching parameter in one pass, alongside the inverse mistake (a defined in: path parameter with no placeholder). Running the OpenAPI linter in CI keeps renamed placeholders from drifting apart from their parameter blocks over time.
Frequently asked questions
Path level or operation level: which is right?
Either satisfies the validator. Path level is the usual choice: the parameter applies to every operation on the path, so one definition covers get, put, and delete without repetition.
I defined it. Why the error?
Check the exact spelling and case against the placeholder, then confirm in: path and required: true. Any of the three being off produces the same message.
Why must path parameters be required?
A URL cannot omit a segment of its own path, so an optional path parameter cannot exist. The specification makes required: true mandatory for in: path, and validators enforce it.