Swagger Viewer & Editor
All articles

Swagger and OpenAPI: History, Versions and Technical Differences

The history of Swagger and OpenAPI, who standardizes the specification, and the technical differences between Swagger 2.0, OpenAPI 3.0 and 3.1.

Split view of a glowing OpenAPI document in YAML next to rendered API endpoints with colored HTTP method badges

Introduction

Every HTTP API raises the same questions: which paths exist, which parameters do they accept, what do responses look like and how is the caller authenticated. Swagger — today formalized as the OpenAPI Specification — answers those questions with a machine-readable contract. The same YAML or JSON document drives interactive documentation, client and server code generation, request validation, mock servers and automated tests.

This article traces where Swagger came from, explains who standardizes OpenAPI today, and then goes deep into the technical differences between Swagger 2.0, OpenAPI 3.0 and OpenAPI 3.1 — including what you gain and what you lose when moving a document from one version to another.

You can follow along interactively: the utily.tools Swagger Viewer & Editor loads the classic Petstore contract, lets you edit it visually or as code, converts it between Swagger 2.0, OpenAPI 3.0 and 3.1 in either YAML or JSON, and even sends real requests to the described endpoints — all in the browser.

From Swagger to OpenAPI: a short history

Swagger was created around 2010–2011 by Tony Tam at Wordnik, an online dictionary company that needed a way to describe and document its own REST APIs. The specification was open-sourced together with a toolchain that made it popular far beyond Wordnik: Swagger UI rendered interactive documentation from the contract, and Swagger Codegen generated client and server code. Describing an API once and deriving documentation, SDKs and test consoles from that single source was the idea that made Swagger the de facto standard.

In 2015 SmartBear Software acquired the Swagger assets and, in November of the same year, donated the specification to the newly created OpenAPI Initiative, an open-governance project hosted by the Linux Foundation with founding members including Google, Microsoft, IBM, PayPal and others. The specification itself was renamed: Swagger 2.0 became the OpenAPI Specification, and the name "Swagger" now formally refers to SmartBear's tooling family (Swagger UI, Swagger Editor, SwaggerHub). In everyday conversation, however, "a swagger" still usually means "an OpenAPI document".

Under the OpenAPI Initiative the specification evolved in the open: OpenAPI 3.0.0 arrived in July 2017 with a restructured document model, OpenAPI 3.1.0 in February 2021 aligned schemas with modern JSON Schema, patch releases 3.0.4 and 3.1.1 in October 2024 clarified ambiguities, and OpenAPI 3.2.0 was released in September 2025. A special interest group known as "Moonwalk" explores what a future OpenAPI 4.0 could look like.

Technical foundations and behavior

All versions share the same core anatomy: an info block with metadata, a paths map from URL templates to HTTP operations, reusable definitions referenced through $ref pointers, and security scheme declarations. What changes between versions is how requests and responses are modeled, how much of JSON Schema is available, and how servers, content types and reusable components are expressed.

Swagger 2.0: one host, flat parameters

A Swagger 2.0 document declares swagger: "2.0" and describes exactly one API surface through host, basePath and schemes. Media types are listed globally or per operation with consumes and produces. Every input is a parameter with an in location of path, query, header, formData or body — the body parameter carries a schema, while all the others use a flattened, restricted subset of JSON Schema directly on the parameter object. Reusable schemas live under definitions, reusable parameters under parameters and security schemes under securityDefinitions.

This flat model is simple to read and generate, but it has hard limits: only one server, no way to describe different payloads per media type, no cookie parameters, at most one body, and no oneOf/anyOf composition, which makes polymorphic payloads difficult to express.

OpenAPI 3.0: servers, content maps and components

OpenAPI 3.0 declares openapi: 3.0.x and replaces host/basePath/schemes with a servers array whose URLs support templated variables — multiple environments and parameterized hosts become first-class. The body parameter disappears: operations gain a requestBody whose content map associates each media type (application/json, multipart/form-data, text/csv…) with its own schema, and responses adopt the same content structure, replacing produces/consumes entirely.

All reusable pieces are consolidated under components (schemas, parameters, responses, requestBodies, headers, examples, links, callbacks, securitySchemes), $ref paths change accordingly (#/definitions/Pet becomes #/components/schemas/Pet), and the schema object grows: oneOf, anyOf, not and discriminator enable real polymorphism, nullable marks optional null values, and callbacks plus links describe asynchronous notifications and workflow relations between operations. Security also improves, with http bearer, openIdConnect and structured OAuth2 flows.

OpenAPI 3.1: full JSON Schema alignment

OpenAPI 3.0 used an "extended subset" of JSON Schema Draft 4, which meant a schema valid for an OpenAPI validator could be invalid for a standard JSON Schema validator and vice versa. OpenAPI 3.1 ended that divergence: its schema object is a full JSON Schema 2020-12 dialect. nullable: true disappears in favor of type: ["string", "null"], exclusiveMinimum/exclusiveMaximum become numeric values instead of booleans, const, if/then/else, prefixItems and $dynamicRef become available, and examples follows JSON Schema semantics.

Version 3.1 also adds top-level webhooks for event callbacks the API sends to consumers, makes paths optional (a document can describe only webhooks or only components), and permits license identification by SPDX identifier. Although the version number suggests a patch-level change, 3.1 is effectively a breaking release for tooling — which is exactly why many generators took years to support it.

Gains and losses when converting between versions

Upgrading 2.0 → 3.0 is mostly mechanical and lossless: hosts map to servers, body and formData parameters map to requestBody content, definitions move under components and $refs are rewritten. What you gain is expressiveness — multiple servers, per-media-type schemas, cookie parameters, polymorphism, callbacks and links. Upgrading 3.0 → 3.1 rewrites nullable and the exclusive bounds and unlocks the full JSON Schema vocabulary.

Downgrading is where losses appear. Going 3.1 → 3.0 must approximate type arrays back to nullable, turn const into a single-value enum and drop webhooks. Going 3.0 → 2.0 collapses multiple servers into one host, keeps only one media type per body, loses cookie parameters, oneOf/anyOf composition, callbacks and links, and approximates modern security schemes — HTTP bearer authentication, for example, has no 2.0 equivalent and is usually emulated as an apiKey header. Converters, including the one built into the utily.tools Swagger Viewer & Editor, are best-effort adaptations: always review a downgraded contract before publishing it.

Real-world applications

Design-first development

Teams write the OpenAPI contract before any code, review it like source code, and generate servers, clients and tests from it — keeping frontend and backend aligned from day one.

Interactive documentation and onboarding

A rendered contract with a try-it-out console lets consumers explore endpoints and send real requests without reading source code or importing collections.

Legacy migration and audits

Converting a Swagger 2.0 contract to OpenAPI 3.1 exposes implicit assumptions — single host, single content type, informal null handling — and prepares the API description for modern validation and generation pipelines.

Standards and deeper technical reference

Who standardizes OpenAPI and how releases happen

The OpenAPI Specification is governed by the OpenAPI Initiative (OAI), an open-source project under the Linux Foundation created in November 2015 when SmartBear donated the Swagger 2.0 specification. A Technical Steering Committee maintains the specification in a public GitHub repository (OAI/OpenAPI-Specification); changes are proposed, discussed and merged as pull requests, and formal releases are published at spec.openapis.org. Membership includes major API producers and tooling vendors, which keeps the specification vendor-neutral.

Releases follow a deliberate cadence rather than strict semantic versioning. Patch releases such as 3.0.4 and 3.1.1 (both October 2024) only clarify wording for implementers — documents do not need to change. Minor releases can add features: OpenAPI 3.2.0 (September 2025) added hierarchical tags, streaming media type support, the additionalOperations keyword for non-standard HTTP methods and the OAuth2 device flow, while remaining a compatible evolution of 3.1. In parallel, the "Moonwalk" special interest group explores a possible OpenAPI 4.0 with no committed date, so 3.x remains the recommended line for production contracts.

Specification timeline
VersionDateMilestone
Swagger 1.0–1.22011–2014Created by Tony Tam at Wordnik; specification plus Swagger UI and Codegen
Swagger 2.0September 2014Single-file contract; consolidated parameters model; wide tooling adoption
OpenAPI 3.0.0July 2017First OAI release: servers, components, requestBody, content maps, links, callbacks
OpenAPI 3.1.0February 2021Full JSON Schema 2020-12 alignment; webhooks; optional paths
OpenAPI 3.0.4 / 3.1.1October 2024Clarification patch releases for implementers
OpenAPI 3.2.0September 2025Hierarchical tags, streaming support, additional HTTP methods, OAuth2 device flow

Swagger 2.0 → OpenAPI 3.0: the structural mapping

The 2.0 → 3.0 conversion is a systematic restructuring. The single host/basePath/schemes triple expands into a servers array of URL templates with variables. The five parameter locations shrink to four (path, query, header, cookie): body parameters become the operation-level requestBody, and formData parameters become properties of an application/x-www-form-urlencoded or multipart/form-data request body schema. produces and consumes disappear because every request body and response now carries an explicit content map keyed by media type, each entry with its own schema, examples and encoding rules.

Reusable definitions consolidate under components, and every $ref must be rewritten (#/definitions/X → #/components/schemas/X, and similarly for parameters and responses). Security definitions become securitySchemes: type basic becomes type http with scheme basic, OAuth2 gains a flows object that can describe several flows in one scheme, and two new scheme types appear — http bearer and openIdConnect — that have no 2.0 representation. File uploads change from the non-standard type: file to type: string with format: binary inside a multipart body.

Field-by-field mapping between Swagger 2.0 and OpenAPI 3.0
Swagger 2.0OpenAPI 3.0Notes
host + basePath + schemesservers[].url3.0 supports multiple servers and templated variables
parameter in: bodyrequestBody.content.<media>.schemaDescription and required move to the requestBody object
parameter in: formDatarequestBody with form/multipart contentEach field becomes a schema property
consumes / producescontent maps on requestBody and responsesMedia type becomes explicit per payload
definitionscomponents.schemasAll $ref paths must be rewritten
securityDefinitionscomponents.securitySchemesbasic → http/basic; OAuth2 gains flows; bearer and OIDC are new
type: filetype: string + format: binaryOnly meaningful inside multipart or binary content
(not available)callbacks, links, cookie parametersNew expressive power in 3.0

OpenAPI 3.0 → 3.1: JSON Schema 2020-12 alignment

OpenAPI 3.0 schemas were an "extended subset" of JSON Schema Draft 4: keywords such as nullable, discriminator and example existed only in OpenAPI, while standard keywords such as const, if/then/else and patternProperties were missing. OpenAPI 3.1 declares its schema object to be a superset dialect of JSON Schema 2020-12, so any compliant JSON Schema validator can process OpenAPI 3.1 schemas directly. This is the single most important change — and the reason 3.1 broke most 3.0 tooling despite the minor version number.

Concretely: nullable: true is replaced by type arrays such as type: ["string", "null"]; exclusiveMinimum and exclusiveMaximum change from booleans that modify minimum/maximum into standalone numeric bounds; example (singular) is deprecated in favor of the JSON Schema examples array; and schemas may use $schema, $dynamicRef, prefixItems, const, contentEncoding and the full 2020-12 vocabulary. At the document level, 3.1 adds top-level webhooks (operations the API invokes on subscribers), makes paths optional so a document may describe only webhooks or shared components, allows SPDX license identifiers and permits summary in the info object.

Schema keyword changes between OpenAPI 3.0 and 3.1
ConcernOpenAPI 3.0OpenAPI 3.1
Null valuesnullable: true beside a single typetype: ["T", "null"] arrays
Exclusive boundsexclusiveMinimum: true + minimum: nexclusiveMinimum: n (numeric)
Examplesexample (OpenAPI-specific)examples array with JSON Schema semantics
Schema dialectExtended subset of Draft 4Full JSON Schema 2020-12 superset
Conditional schemasNot availableif / then / else, dependentSchemas
Event deliverycallbacks onlycallbacks and top-level webhooks
Minimum documentpaths requiredpaths, webhooks or components suffice

Conversion strategy: what survives a round trip

Upgrades preserve meaning almost completely; downgrades cannot. Converting 3.x → 2.0 collapses the servers array into a single host/basePath/schemes triple (additional servers are dropped), keeps only one media type where several were described, discards cookie parameters, callbacks, links and webhooks, flattens oneOf/anyOf composition that 2.0 cannot express, and approximates security: http bearer typically degrades to an apiKey in the Authorization header. Converting 3.1 → 3.0 must reverse the null-type and exclusive-bound encodings, replace const with a single-value enum and drop webhooks entirely.

A practical migration workflow: convert upward mechanically, then review the result for idioms the converter cannot infer — server variables, per-media-type schemas that were implicit in produces lists, and security schemes that deserve the richer 3.x types. Keep the highest version as the source of truth and generate lower versions only for consumers that require them, treating those artifacts as disposable build outputs. The utily.tools Swagger Viewer & Editor implements exactly this kind of best-effort bidirectional conversion in the browser, which makes it convenient for inspecting what a version change does to a real contract before committing to it.

Primary specifications and references

Conclusion

Swagger started as one company's internal documentation tool and became, as OpenAPI, the neutral standard that the entire HTTP API ecosystem builds on. Knowing the differences between 2.0, 3.0 and 3.1 is not trivia: it determines which features you can express, which tools can consume your contract and what breaks when a document moves between versions.

My practical advice: author new contracts in OpenAPI 3.1, keep 3.0 output available while any consumer tooling lags behind, and treat any remaining Swagger 2.0 documents as migration candidates. Use the utily.tools Swagger Viewer & Editor to paste a contract in YAML or JSON, convert it across versions, edit it visually with + and − controls, call the real endpoints and export the result — including a standalone HTML documentation page you can share with your team.

Open Swagger Viewer & Editor Read more articles