API / Swagger Interview questions
What are operations in OpenAPI?
An operation is a single, specific combination of an HTTP method and a path — for example, GET /users/{userId} is one operation, and POST /users is a different operation, even though both live under paths that might share a common prefix.
Each operation object can define its own summary and description, a list of parameters, an optional request body (for methods like POST and PUT), a set of possible responses keyed by status code, security requirements, and tags used to group it with related operations in rendered documentation.
Operations are also commonly given a unique operationId, which isn't shown in the rendered UI by default but is what code generation tools use to name the corresponding method in a generated client SDK — a well-chosen operationId like getUserById produces a much more readable generated method name than an auto-derived one based purely on the path and HTTP verb.
More Related questions...