openapi-diff icon indicating copy to clipboard operation
openapi-diff copied to clipboard

Removing a Query parameter is considered a breaking change while removing a Request Body parameter isn't

Open AdamBosseBS opened this issue 3 years ago • 1 comments

While testing this tool, we've noticed that removing a query parameter would give a API changes broke backward compatibility result while removing a request body parameter would return a API changes are backward compatible. Shouldn't both be breaking changes?

If this is expected, we'd be curious to understand why that is.

Here are the spec files we used to test this:

image

old_queryparameter.yml :

openapi: "3.0.1"
info:
  title: "Public Api"
  description: ""
  version: "2022-08-23T16:17:54Z"
servers:
  - url: "https://someurl"
    variables:
      basePath:
        default: "/v1"
paths:
  /auth:
    post:
      parameters:
        - name: "Username"
          in: "query"
          required: true
          schema:
            type: "string"
        - name: "Password"
          in: "query"
          required: true
          schema:
            type: "string"

new_queryparameter.yml :

openapi: "3.0.1"
info:
  title: "Public Api"
  description: ""
  version: "2022-08-23T16:17:54Z"
servers:
  - url: "https://someurl"
    variables:
      basePath:
        default: "/v1"
paths:
  /auth:
    post:
      parameters:
        - name: "Username"
          in: "query"
          required: true
          schema:
            type: "string"

image

old_requestbody.yml:

openapi: "3.0.1"
info:
  title: "Public Api"
  description: ""
  version: "2022-08-23T16:17:54Z"
servers:
  - url: "https://someurl"
    variables:
      basePath:
        default: "/v1"
paths:
  /auth:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AuthRequest"
        required: true

components:
  schemas:
    AuthRequest:
      required:
        - "Username"
        - "Password"
      type: "object"
      properties:
        Username:
          type: "string"
        Password:
          type: "string"

new_requestbody.yml:

openapi: "3.0.1"
info:
  title: "Public Api"
  description: ""
  version: "2022-08-23T16:17:54Z"
servers:
  - url: "https://someurl"
    variables:
      basePath:
        default: "/v1"
paths:
  /auth:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AuthRequest"
        required: true

components:
  schemas:
    AuthRequest:
      required:
        - "Username"
      type: "object"
      properties:
        Username:
          type: "string"

Thank you!

AdamBosseBS avatar Sep 15 '22 17:09 AdamBosseBS

It looks like in 2.1.0-beta.11 removing a query parameter is considered a breaking change regardless if the parameter was required or not. Shouldn't this be breaking change only in the former case?

raducotescu avatar Nov 04 '24 14:11 raducotescu