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

Specmatic backward-compatibility check does not detect changes in included files #1647

Open
harikrishnan83 opened this issue Feb 28, 2025 · 1 comment · Fixed by #1666
Open
Labels
bug Something isn't working

Comments

@harikrishnan83
Copy link
Member

Discussed in #1643

Originally posted by mickle-ak February 27, 2025
Specmatic's "backward-compatibility-check" does not detect changes in included files if the "root" file is not modified.

=== changes in included files only

Given: The OAS file "OpenApi.yaml" includes references to other files (e.g., $ref: 'data.yaml#/schemas/Task'):

     ... 
     content:
       application/json:
         schema:
           $ref: 'data.yaml#/schemas/Task'
     ... 

When: A breaking change is made to the schema in the included file "data.yaml", while no changes are made in the "root" file "OpenApi.yaml".
And: The Specmatic "backward-compatibility-check" is executed:

java -jar specmatic.jar backward-compatibility-check

Then: Specmatic does not detect the changes and outputs the following:

Specmatic Version: 2.5.0
No specs were changed, skipping the check.
backwardCompatitbilityTest() has SUCCEEDED

=== changes in included files AND in main OAS file
same as above plus

When: Any change is made in the "root" file "OpenApi.yaml" (even adding a whitespace is sufficient).
And: The Specmatic "backward-compatibility-check" is executed:

java -jar specmatic.jar backward-compatibility-check

Then: Specmatic detects and reports the breaking change:

Specmatic Version: 2.5.0
Checking backward compatibility of the following specs:

  • Specs that have changed:
    1. OpenApi.yaml
      ...
      Verdict for spec OpenApi.yaml:
      (INCOMPATIBLE) The changes to the spec are NOT backward compatible with the corresponding spec from HEAD
      ...

Suggestion:
Since it is quite common in real-world scenarios to split OAS into multiple files, I believe Specmatic should also detect changes in included files and validate the entire API for backward compatibility.

@harikrishnan83 harikrishnan83 added question Further information is requested bug Something isn't working and removed question Further information is requested labels Feb 28, 2025
@harikrishnan83
Copy link
Member Author

#1660 may be a related question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant