Description
A path placeholder needs a name, such as {id}. An empty placeholder such as /users/{} leaves the expected value unclear and cannot be handled as a properly named path parameter.
Potential impact
- An unclear path definition can lead documentation and implementation to diverge.
- Generators or validators may reject the specification.
Remediation
Replace empty {} placeholders with names used by the actual API, such as {id} or {userId}. Define the matching in: path parameter at path or operation level and set required: true.
Examples
These OpenAPI 3.0 excerpts compare path names only. The info object and path parameter declaration are omitted; the actual document needs that declaration.
Before
yaml
openapi: 3.0.0
paths:
/users/{}:
get:
responses:
"200":
description: OK
After
yaml
openapi: 3.0.0
paths:
/users/{id}:
get:
responses:
"200":
description: OK
The first placeholder is empty. The second names it {id}, but a complete definition also needs the required path parameter of that name.