Guide

Swagger 2.0 breaking changes: how to detect them

Last checked 2026-11-258 min read

A breaking change in a Swagger 2.0 spec is the same thing as in OpenAPI 3: a change after which a client built against the old version can fail. What differs is where it hides: in the in: body parameter, in definitions, in produces and consumes, and in basePath. Many .NET, Java and Go services still publish Swagger 2.0 (Swashbuckle set to 2.0, Springfox, swag), and many diff tools are written for OpenAPI 3, so teams convert first. This page shows what breaks in a 2.0 spec, how each part maps to OpenAPI 3.0, why a switch from 2.0 to a native 3.x spec can report changes that are not API changes, and how to get a 2.0 spec out of your build. 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.

Exampleopenapi.yaml · before → after
− before+ after
/orders/{id}:  get:    parameters:      - name: currency        in: query        schema: { type: string }-       required: false+       required: true    responses:      "200":        description: OK        content:          application/json:            schema:              type: object              properties:                id: { type: string }-               total: { type: number }
  • BreakingNew required parameter currency
  • BreakingResponse field total removed
GET /orders/{id}reaches checkout and mobile-app
A removed response field is a breaking change. Graphwake tells the teams that subscribed to the endpoint.
On this page
  1. Who still publishes Swagger 2.0
  2. What a breaking change looks like in a Swagger 2.0 spec
  3. How Swagger 2.0 maps to OpenAPI 3.0
  4. Why a switch from 2.0 to 3.x shows changes that are not API changes
  5. Get a Swagger 2.0 spec out of your build
  6. How Graphwake handles Swagger 2.0
  7. Next steps
  8. Questions

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:

StackGeneratorWhat it publishes
ASP.NET CoreSwashbuckleOpenAPI 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, SpringSpringfoxSwagger 2.0 at /v2/api-docs with @EnableSwagger2. Springfox 3 can also serve OpenAPI with @EnableOpenApi.
Java, Springspringdoc-openapiOpenAPI 3.0 or 3.1 at /v3/api-docs. The usual destination when a team leaves Springfox.
GoswagSwagger 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: body and a schema. A new required property in that schema, or required: true on a body that was optional, breaks every client that does not send it.
  • formData parameters. A new required formData parameter 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 basePath moves every endpoint, while the entries under paths stay the same. Review a change here by hand.
yaml
# 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
A removed response field in Swagger 2.0. Every operation whose response references #/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.0OpenAPI 3.0
A parameter with in: bodyrequestBody
formData parametersrequestBody with a form media type, one property per field
definitionscomponents/schemas
consumesthe media types under requestBody.content
producesthe media types under each response’s content
host, basePath and schemesa servers URL
securityDefinitionscomponents/securitySchemes
yaml
# 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"
One operation before and after conversion. 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 consumes converts to a */* request body. The new 3.x spec says application/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. host and basePath become a servers URL 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)

text
// Older Swashbuckle versions
app.UseSwagger(c =>
{
    c.SerializeAsV2 = true;
});

// Current Swashbuckle
app.UseSwagger(options =>
{
    options.OpenApiVersion = OpenApiSpecVersion.OpenApi2_0;
});
Serve the document as Swagger 2.0. Swashbuckle serves it at /swagger/v1/swagger.json by default.
bash
dotnet tool install -g Swashbuckle.AspNetCore.Cli
swagger tofile --openapiversion 2.0 --output swagger.json bin/Release/net8.0/MyApi.dll v1
Or write it at build time with the Swashbuckle CLI: the startup assembly, then the document name. --openapiversion is in the current CLI; swagger tofile --help lists the options of the version you have.

Springfox (Spring Boot)

bash
# with the app running in the job
curl -sf http://localhost:8080/v2/api-docs -o swagger.json
Springfox serves the document while the app runs, so start the app in the job and read the URL (use your app’s port). With springdoc the path is /v3/api-docs.

swag (Go)

bash
go install github.com/swaggo/swag/cmd/swag@latest
swag init
# writes docs/docs.go, docs/swagger.json and docs/swagger.yaml
swag 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.

See who your next breaking change reaches.Paste a spec URL or add one CI step. 7-day free trial. Cancel before day 7 and you pay nothing.
Start free trial

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.json or /v2/api-docs and 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-on behaves 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

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 trial

Sources and last verified

Sources checked on 2026-11-01.