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

[Bug] Do not detect breaking change #160

Open
Ulashlo opened this issue Sep 18, 2024 · 0 comments
Open

[Bug] Do not detect breaking change #160

Ulashlo opened this issue Sep 18, 2024 · 0 comments

Comments

@Ulashlo
Copy link

Ulashlo commented Sep 18, 2024

Under certain conditions, breaking change is not detected:

Schema old.json:
old.json

Schema new.json:
new.json

The difference:

  • In TestResult entity field resultType renamed to testResultType
  • In TestResult entity field test was added

Expected results:
3 changes, one breaking change:

  • field testResultType was added
  • field test was added
  • field resultType was deleted (breaking)

Actual result:

openapi-changes report ./old.json ./new.json
{
  "reportSummary": {
    "components": {
      "totalChanges": 2,
      "breakingChanges": 0
    }
  },
  "changes": [
    {
      "breaking": false,
      "change": 3,
      "changeHash": "VMePO-HloQp2n7CFp8rj0EV60TIPsQ1RneJRnwpYTAA=",
      "changeText": "object_added",
      "context": {
        "newColumn": 11,
        "newLine": 80
      },
      "new": "test",
      "original": "",
      "property": "properties"
    },
    {
      "breaking": false,
      "change": 3,
      "changeHash": "AGK7dojIA4fx7E_gkgJ0KP-J9YZpNyct28IjRbaO3vE=",
      "changeText": "object_added",
      "context": {
        "newColumn": 11,
        "newLine": 77
      },
      "new": "testResultType",
      "original": "",
      "property": "properties"
    }
  ],
  "commitDetails": {
    "commitHash": "18a46e",
    "message": "New: ./new.json, Original: ./old.json",
    "author": "",
    "authorEmail": "",
    "committed": "2024-09-18T16:09:28.656168054+03:00",
    "changeReport": null
  }
}

If we just rename field resultType to testResultType, we will have correct result with breaking change:

openapi-changes report ./old.json ./new.json
{
  "reportSummary": {
    "components": {
      "totalChanges": 2,
      "breakingChanges": 1
    }
  },
  "changes": [
    {
      "breaking": false,
      "change": 3,
      "changeHash": "AGK7dojIA4fx7E_gkgJ0KP-J9YZpNyct28IjRbaO3vE=",
      "changeText": "object_added",
      "context": {
        "newColumn": 11,
        "newLine": 77
      },
      "new": "testResultType",
      "original": "",
      "property": "properties"
    },
    {
      "breaking": true,
      "change": 4,
      "changeHash": "0wYw40wu77CMYJOvUyA6ov1L3B6lIoODPxmyNkK2iw8=",
      "changeText": "object_removed",
      "context": {
        "originalColumn": 11,
        "originalLine": 77
      },
      "new": "",
      "original": "resultType",
      "property": "properties"
    }
  ],
  "commitDetails": {
    "commitHash": "4246ba",
    "message": "New: ./new.json, Original: ./old.json",
    "author": "",
    "authorEmail": "",
    "committed": "2024-09-18T16:15:33.685694174+03:00",
    "changeReport": null
  }
}
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

1 participant