On this page
Who still publishes Swagger 2.0
Swagger 2.0 is the version of the spec that came before OpenAPI 3.0. Plenty of services still publish it, usually because the generator they set up years ago does:
| Stack | Generator | What it publishes |
|---|---|---|
| ASP.NET Core | Swashbuckle | OpenAPI 3.0 by default. Swagger 2.0 when it is set to 2.0 (SerializeAsV2 in older versions, OpenApiVersion today), often kept that way for an older client. |
| Java, Spring | Springfox | Swagger 2.0 at /v2/api-docs with @EnableSwagger2. Springfox 3 can also serve OpenAPI with @EnableOpenApi. |
| Java, Spring | springdoc-openapi | OpenAPI 3.0 or 3.1 at /v3/api-docs. The usual destination when a team leaves Springfox. |
| Go | swag | Swagger 2.0 in docs/swagger.json and docs/swagger.yaml. |
If your diff tool or linter is written for OpenAPI 3, check whether it reads 2.0 as it is. If it does not, convert first, and convert both sides of the comparison the same way. Comparing a converted spec with one converted by a different tool reports differences that come from the converters, not from your API.
What a breaking change looks like in a Swagger 2.0 spec
The cases are the ones in OpenAPI breaking changes: removing things, adding requirements and narrowing what is accepted. In a 2.0 spec they sit in these places:
- The body parameter. A 2.0 request body is a parameter with
in: bodyand aschema. A new required property in that schema, orrequired: trueon a body that was optional, breaks every client that does not send it. - formData parameters. A new required
formDataparameter breaks clients that post the form without it. - definitions. Shared schemas live under
definitions. Removing or retyping a property there changes every operation that references it, so one edit can break many endpoints. - produces and consumes. These list the media types an operation returns and accepts. Dropping one a client sends or asks for breaks that client.
- host, basePath and schemes. Together they make the base URL. A new
basePathmoves every endpoint, while the entries underpathsstay the same. Review a change here by hand.
# Before
definitions:
Order:
type: object
required: [id]
properties:
id:
type: string
total:
type: number
---
# After: total is gone from every response that returns an Order
definitions:
Order:
type: object
required: [id]
properties:
id:
type: string#/definitions/Order loses total.How Swagger 2.0 maps to OpenAPI 3.0
Converting a 2.0 spec to OpenAPI 3.0 moves each part to its new place. The API it describes stays the same:
| Swagger 2.0 | OpenAPI 3.0 |
|---|---|
A parameter with in: body | requestBody |
formData parameters | requestBody with a form media type, one property per field |
definitions | components/schemas |
consumes | the media types under requestBody.content |
produces | the media types under each response’s content |
host, basePath and schemes | a servers URL |
securityDefinitions | components/securitySchemes |
# Swagger 2.0
swagger: "2.0"
host: api.example.com
basePath: /v1
schemes: [https]
produces: [application/json]
paths:
/orders:
post:
parameters:
- in: body
name: body
required: true
schema:
$ref: "#/definitions/Order"
responses:
"201":
description: Created
schema:
$ref: "#/definitions/Order"
---
# Converted to OpenAPI 3.0 (excerpt)
openapi: 3.0.3
servers:
- url: https://api.example.com/v1
paths:
/orders:
post:
requestBody:
required: true
content:
"*/*":
schema:
$ref: "#/components/schemas/Order"
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: "#/components/schemas/Order"produces became the response’s application/json. The spec has no consumes, so the request body became */*.Why a switch from 2.0 to 3.x shows changes that are not API changes
Sooner or later a team moves from Swagger 2.0 to a native OpenAPI 3 spec: Springfox to springdoc, or Swashbuckle back to its 3.0 default. The next diff then compares a converted 2.0 spec with a spec written as 3.x, and some of what it reports comes from the format, not from the API:
- Request media types. A 2.0 spec without
consumesconverts to a*/*request body. The new 3.x spec saysapplication/json. A diff can report that as a narrower request body, though clients send JSON either way. - Schema and parameter names. A new generator may name schemas or the body differently. A renamed schema with the same shape is not an API change.
- Servers.
hostandbasePathbecome aserversURL on one side, while the new generator may write a different one or none at all.
Make the format switch its own pull request, with no API change in it. Then everything the diff reports there is about the format, and you can review it once. Real breaking changes can still hide in that pull request, so read each one before you dismiss it.
Get a Swagger 2.0 spec out of your build
A diff in CI needs the spec as a file or a URL on every build. The options, paths and commands below are from each project’s own documentation; the file names, ports and versions in them are examples:
Swashbuckle (ASP.NET Core)
// Older Swashbuckle versions
app.UseSwagger(c =>
{
c.SerializeAsV2 = true;
});
// Current Swashbuckle
app.UseSwagger(options =>
{
options.OpenApiVersion = OpenApiSpecVersion.OpenApi2_0;
});/swagger/v1/swagger.json by default.dotnet tool install -g Swashbuckle.AspNetCore.Cli
swagger tofile --openapiversion 2.0 --output swagger.json bin/Release/net8.0/MyApi.dll v1--openapiversion is in the current CLI; swagger tofile --help lists the options of the version you have.Springfox (Spring Boot)
# with the app running in the job
curl -sf http://localhost:8080/v2/api-docs -o swagger.json/v3/api-docs.swag (Go)
go install github.com/swaggo/swag/cmd/swag@latest
swag init
# writes docs/docs.go, docs/swagger.json and docs/swagger.yamlswag init writes Swagger 2.0 to ./docs; --output changes the folder.To look at one change before you touch the pipeline, paste the old and the new spec into the free OpenAPI diff. It takes Swagger 2.0 or OpenAPI 3 on either side, converts a 2.0 spec to OpenAPI 3.0 before it compares, and lets you download the converted file. It runs in your browser.
How Graphwake handles Swagger 2.0
Graphwake watches OpenAPI 3.x and Swagger 2.0 specs. Swagger 2.0 is converted to OpenAPI 3.0 when it arrives; nothing to do on your side. It finds the breaking changes, then alerts only the teams subscribed to each changed endpoint, in Slack, Microsoft Teams or email.
Send 2.0 as it is
From the CI step, a spec URL checked every 30 minutes, or the impact preview your AI assistant runs over MCP. Point the CI step at
docs/swagger.jsonor/v2/api-docsand it works.Labelled in the dashboard
A service whose live spec came in as 2.0 shows “Converted from Swagger 2.0” next to it.
A note on a format switch
When a spec moves from Swagger 2.0 to OpenAPI 3, the alert and the pull request comment say: “This spec moved from Swagger 2.0 to OpenAPI 3. Some of these changes may come from the format change, not from the API.” A spec that moves back from OpenAPI 3 to Swagger 2.0 gets a matching note.
Nothing is hidden
The note never mutes an alert. Every breaking change is still sent, and
--fail-onbehaves the same as on any other pull request.
Two limits. A spec that points to other files with external $refs must be bundled into one file first. And the diff in the dashboard shows the converted OpenAPI 3.0 text, not your original 2.0 file. Swagger 2.0 input is in every plan; see pricing.
Next steps
- Every common breaking change, with before and after snippets: OpenAPI breaking changes.
- Run a spec diff on every pull request without stopping the build: OpenAPI diff in CI.
- How the CI step finds the build type and sends the spec: the Graphwake CI agent.
- Who to tell once a breaking change is found: API breaking change alerts.
Questions
How do I detect breaking changes in a Swagger 2.0 spec?
Compare the old and the new spec with a diff tool that reads Swagger 2.0, or convert both to OpenAPI 3.0 the same way and compare those. Look closest at the in: body parameter, definitions, produces and consumes, and basePath. Graphwake takes the 2.0 spec as it is, from CI or a URL, and alerts the teams that use each changed endpoint.
Can I diff a Swagger 2.0 spec against an OpenAPI 3 spec?
Yes, once the 2.0 side is converted to OpenAPI 3.0. Expect some changes that come from the format, such as a */* request body that the 3.x spec writes as application/json. The free OpenAPI diff converts the 2.0 side for you.
Does Swashbuckle generate Swagger 2.0 or OpenAPI 3?
OpenAPI 3.0 by default. It serves Swagger 2.0 when SerializeAsV2 = true (older versions) or OpenApiVersion = OpenApiSpecVersion.OpenApi2_0 (current versions) is set in UseSwagger, and the CLI writes 2.0 with --openapiversion 2.0.
Does Springfox generate OpenAPI 3?
With @EnableSwagger2 Springfox serves Swagger 2.0 at /v2/api-docs; Springfox 3 can also serve OpenAPI with @EnableOpenApi. springdoc-openapi serves OpenAPI 3 at /v3/api-docs.
Does Graphwake support Swagger 2.0?
Yes. Graphwake watches OpenAPI 3.x and Swagger 2.0 specs. Swagger 2.0 is converted to OpenAPI 3.0 when it arrives; nothing to do on your side. It is in every plan.
Pick an endpoint. See who it reaches. 7-day free trial. Cancel before day 7 and you pay nothing.
Start free trialSources and last verified
- github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/master/docs/configure-and-customize-swagger.md
- github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/master/docs/configure-and-customize-cli.md
- github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/v6.5.0/README.md
- github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/master/README.md
- springfox.github.io/springfox/docs/current/
- springdoc.org/
- github.com/swaggo/swag
Sources checked on 2026-11-01.