Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleted or renamed properties are marked as backwards compatible #673

Open
Patrick-Bayer opened this issue Jun 14, 2024 · 5 comments
Open

Comments

@Patrick-Bayer
Copy link

Hello folks,

i am testing your library as a maven plugin with version: 'org.openapitools.openapidiff:openapi-diff-core:2.1.0-beta.11' and discovered that the following changes do not result in failure due to backwards incompatibility even though they should, right?

  1. Removing properties from schemas
  2. Renaming properties
@Sanady
Copy link

Sanady commented Jul 18, 2024

Hello @Patrick-Bayer , I am facing same issue.

@DrSatyr
Copy link
Collaborator

DrSatyr commented Jan 24, 2025

Hello folks, mostly all incompatibility rules are collected in BackwardIncompatibleProp. As you can see it has:

  • RESPONSE_REQUIRED_DECREASED
  • REQUEST_BODY_REQUIRED_INCREASED.

Seems, author decided to only treat new required props on request and missing required props on response as incompatible. So it depends on the point of view.
From my perspective - removing any payload property is a breaking change as API consumer can depend on it.

So the openapi-diff as a library should be smart enough to allow to configure of what is considered compatible change, and what is not. This behavior is configurable through the config file, but frankly speaking, it does not cover all possible cases. Good point to extend and review all the rules.

@DrSatyr
Copy link
Collaborator

DrSatyr commented Jan 24, 2025

BTW - REQUEST_BODY_REQUIRED_INCREASED is never used. Looks like a bug.

@DrSatyr DrSatyr added bug and removed bug labels Jan 27, 2025
@nakulshukla08
Copy link

Is there an update on this issue? I am also facing the same issue where a compatibility break in terms of schema change in response doesn't mark the diff as incompatible. Below is the example -

Original Spec

openapi: "3.0.0"
info:
  title: Sample API
  version: "1.0.0"
paths:
  /users:
    get:
      summary: Get all users
      responses:
        "200":
          description: A list of users
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    name:
                      type: string

Updated spec

openapi: "3.0.0"
info:
  title: Sample API
  version: "2.0.0"
paths:
  /users:
    get:
      summary: Get all users
      responses:
        "200":
          description: A list of users
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    fullname:  # Breaking change (renamed `name` → `fullname`)
                      type: string

This looks like a bug to me, but let me know if there is a configuration which would evaluate this diff as incompatible.

@DrSatyr
Copy link
Collaborator

DrSatyr commented Feb 26, 2025

@nakulshukla08 there is an idea to solve this problem within the scope of discussion. But the first priority at the moment is to get 2.1.0 release happen.

Anyway, any contributions to discussion and related issues are appreciated, feel free to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants