Skip to content

[Bug] Do not detect breaking change #160

Closed
@Ulashlo

Description

@Ulashlo

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
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions