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.