OpenAPI & Swagger 3.0 / 3.1 Validator & Formatter: Free OpenAPI & Swagger 3.0 / 3.1 Validator & Formatter tool: validate, lint, and format OpenAPI 3.0, 3.1, and Swagger 2.0 specifications online. Check.
What is the OpenAPI Specification?
The OpenAPI Specification (OAS)—formerly recognized as the Swagger Specification—is the world's most widely adopted open-source standard for describing RESTful HTTP APIs. An OpenAPI document describes an entire API surface in machine-readable JSON or YAML, detailing available endpoints, request payload schemas, HTTP status codes, security schemes (OAuth2, JWT, API Keys), and parameter constraints.
Mandatory Core Elements of OpenAPI 3.x
openapi: A semantic version string declaring the specification version (e.g.3.0.3or3.1.0).info: An object containing human-readable API metadata includingtitleandversion.paths: A map defining the available URL paths and their supported HTTP operations (get,post,put,delete,patch).components: A centralized registry of reusable schemas, responses, parameters, and security schemes.
The OpenAPI Object Hierarchy & Data Model
An OpenAPI 3.0 document is structured as a hierarchical tree of interconnected objects:
- Servers Object: An array of target deployment hosts (e.g. production, staging, development) with support for URL variables (e.g.
https://{tenant}.api.example.com/v1). - Paths & Operations: Maps relative URI paths to HTTP methods. Each operation must define input parameters (path, query, header, cookie) and explicit response payloads keyed by HTTP status code (e.g.
200 OK,400 Bad Request,404 Not Found). - Request Bodies: Defines payload schemas using JSON Schema specification, detailing required fields, data types (string, integer, boolean, array), and validation regex patterns.
- Components & Reusability: Centralized repository for reusable components (
schemas,responses,parameters,examples,securitySchemes) referenced across endpoints via JSON Pointers ($ref: '#/components/schemas/Pet').
OpenAPI Best Practices for Engineering Teams
- API-First Design: Draft and validate OpenAPI specifications before writing backend application code. This enables client teams to generate mock servers and strongly typed SDKs (via TypeScript, Go, or Java code generators) simultaneously with backend engineering.
- Semantic Versioning: Follow SemVer in the
info.versionstring. Increment patch versions for backward-compatible bugfixes, minor versions for new optional endpoints, and major versions for breaking contract changes.