API / Swagger Interview questions
What is a parameter in OpenAPI, and what are its types?
A parameter is an input to an operation supplied outside the request body — part of the URL, headers, or query string — and OpenAPI defines exactly where each parameter is expected using its in field.
| Type (in) | Location |
| path | Part of the URL path itself, e.g. /users/{id} |
| query | Appended after ? in the URL, e.g. ?page=2 |
| header | An HTTP request header, e.g. X-Request-ID |
| cookie | A value sent in the Cookie header |
Every parameter also declares a name, whether it's required (path parameters are always required by definition), and a schema describing its expected type and constraints, which is what lets tools validate a request or generate correctly typed client method signatures rather than treating every parameter as an untyped string.
More Related questions...