pb33f / openapi-changes

The world's sexiest OpenAPI breaking changes detector. Discover what changed between two OpenAPI specs, or a single spec over time. Supports OpenAPI 3.1, 3.0 and Swagger
https://pb33f.io/openapi-changes/
Other
180 stars 16 forks source link

Addition of optional query parameters should not be considered as BREAKING CHANGE #87

Closed dloibl closed 9 months ago

dloibl commented 9 months ago

Hi,

adding optional query parameters, i.e. required: false is considered as breaking change, but it shouldn't. Here is a minimal example to reproduce:

original.yaml

openapi: 3.1.0
paths:
  /api/foo:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string

changed.yaml

paths:
  /api/foo:
    parameters:
      - foo:
          in: query
          name: foo
          schema:
            type: string
          required: false
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string

output:

openapi-changes version: 0.0.52 | compiled: Fri, 05 Jan 2024 13:54:26 UTC

SPEC extracted 2 commits from history
DONE completed

└─┬Paths └─┬/api/foo └──[+] parameters (5:7)❌

Date: 01/15/24 | Commit: New: ./changed.yaml, Original: ./original.yaml Document Element | Total Changes | Breaking Changes paths | 1 | 1

❌ 1 Breaking changes out of 1 INFO Additions: 1 INFO Breaking Additions: 1

ERROR breaking changes discovered Error: breaking changes discovered

daveshanley commented 9 months ago

resolved in v0.0.53