Skip to content

False positive diffs on identical files since version 1.12.0 #806

@SebastienDiter

Description

@SebastienDiter

Describe the bug
oasdiff diff reports changes between two byte-identical files when they are located at different paths.

To Reproduce
Steps to reproduce the behavior:

  1. download the example file https://raw.githubusercontent.com/oasdiff/oasdiff/main/data/openapi-test1.yaml
  2. copy it to openapi-test2.yaml
  3. oasdiff diff openapi-test1.yaml openapi-test2.yaml --fail-on-diff
  4. Output
paths:
    modified:
        /subscribe:
            operations:
                modified:
                    POST:
                        callbacks:
                            modified:
                                myEvent:
                                    modified:
                                        hi:
                                            operations:
                                                modified:
                                                    POST:
                                                        requestBody:
                                                            content:
                                                                modified:
                                                                    application/json:
                                                                        encoding:
                                                                            modified:
                                                                                __origin__:
                                                                                    extensions:
                                                                                        modified:
                                                                                            key:
                                                                                                - oldValue: openapi-test1.yaml
                                                                                                  value: openapi-test2.yaml
                                                                                                  op: replace
                                                                                                  from: ""
                                                                                                  path: /file
endpoints:
    modified:
        ?   method: POST
            path: /subscribe
        :   callbacks:
                modified:
                    myEvent:
                        modified:
                            hi:
                                operations:
                                    modified:
                                        POST:
                                            requestBody:
                                                content:
                                                    modified:
                                                        application/json:
                                                            encoding:
                                                                modified:
                                                                    __origin__:
                                                                        extensions:
                                                                            modified:
                                                                                key:
                                                                                    - oldValue: openapi-test1.yaml
                                                                                      value: openapi-test2.yaml
                                                                                      op: replace
                                                                                      from: ""
                                                                                      path: /file

Expected behavior
Two byte-identical files should always produce an empty diff.
It was the case in version 1.11.11, or when running the diff on the same file :
oasdiff diff openapi-test1.yaml openapi-test1.yaml --fail-on-diff

Desktop (please complete the following information):

  • OS: Ubuntu 24.04.4

Additional context
Add any other context about the problem here.

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