API / Swagger Interview questions
What is the purpose of the info object in OpenAPI?
The info object holds metadata that describes the API as a whole, rather than any specific endpoint — its title, version, description, contact information, and license — and it's a required top-level field in every valid OpenAPI document.
info: title: Bookstore API description: Manage books, authors, and orders. version: 2.1.0 contact: name: API Support email: api-support@example.com license: name: Apache 2.0
The version field here refers specifically to the version of this particular API definition/document, not the version of the OpenAPI Specification itself (which is declared separately via the top-level openapi field, e.g. openapi: 3.0.3) — a distinction that trips up newcomers writing their first spec.
Tools like Swagger UI display this metadata prominently at the top of the rendered documentation page, so it's often the first thing an API consumer sees, making a clear title and description worth getting right even before diving into individual endpoint documentation.
More Related questions...