Description
Give every path placeholder a name. In /users/{}, a client has no parameter name to bind to the user ID.
Potential impact
Validators and client generators can reject a path with an empty placeholder.
Remediation
Use the same name in the path and its parameter declaration. For /users/{id}, define name: id, in: path and required: true on the path or operation.
Examples
The excerpts show the path change. Add the parameter declaration and the document’s info object.
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