What is the OpenAPI 3.0 specification structure?
Answer
An OpenAPI 3.0 document is a YAML or JSON file with these top-level sections. openapi: "3.0.3" declares the spec version. info contains the API title, version, description, contact, and license. servers lists the base URLs (dev, staging, production). paths is the core section — each path key (/users/{id}) has operation objects (get, post, put, delete) with parameters, request bodies, responses, security requirements, and tags. components holds reusable definitions: schemas (data models), responses (common response objects), parameters (reusable params), securitySchemes (Bearer JWT, API key, OAuth2 flows). security sets global security requirements. tags groups operations for documentation organization. Tools like Swagger UI render this into interactive documentation automatically.
Previous
What is an idempotency key for POST requests?
Next
What are the best practices for designing API SDKs?
More REST API Design Questions
View all →- Intermediate What is HATEOAS and how is it implemented?
- Intermediate What are the main API versioning strategies in REST and what are their tradeoffs?
- Intermediate What are the pagination strategies in REST APIs?
- Intermediate What is rate limiting and how is it communicated in REST APIs?
- Intermediate How does HTTP caching work in REST APIs with ETag and Cache-Control?