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

Feature Request: Provide a visual way to compare example diffs #404

Open
skyellin opened this issue Oct 24, 2023 · 3 comments
Open

Feature Request: Provide a visual way to compare example diffs #404

skyellin opened this issue Oct 24, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@skyellin
Copy link

skyellin commented Oct 24, 2023

Is your feature request related to a problem? Please describe.
When discussing proposed contract changes, it can be very useful to visualize the differences in the examples. This provides a more intuitive way of understanding the changes than does comparing schema differences one by one.

Currently, when viewing diffs in text or html format, the example diffs remove all structure and indentation. Diffs are presented simply as long lines of text such as:

 - Examples changed
       - Modified example: successfulResponse
           - Value changed from map[. . . ] to map[. . . ]

It's very challenging if not impossible to make sense of this, when dealing with large, nested, request and response examples.

Describe the solution you'd like
At a minimum, the examples should be reproduced without removing formatting (preserving line breaks and indentation). In the future, color coding could be added to highlight the changes.

@skyellin skyellin changed the title Provide a visual way to compare example diffs Feature Request: Provide a visual way to compare example diffs Oct 24, 2023
@reuvenharrison
Copy link
Collaborator

Hi @skyellin
I would recommend to check the changelog output (example below), it is much easier to understand than the low-level diff.
Could you please share your feedback:

  • Does the changelog output provide sufficient context?
  • Do you perhaps want to see the changes within the context of the original json/yaml file, and if so, could you explain the use-case?
image

@reuvenharrison reuvenharrison added the enhancement New feature or request label Oct 31, 2023
@skyellin
Copy link
Author

I'm looking specifically for a way to compare examples, rather than the schemas themselves. The changelog command you suggested does not compare examples at all, while the diff command produces diffs that are completely unreadable, due to the fact that json is displayed all on a single line, without any line breaks or indentation.

As for why I'd like to have diffs of examples, this is because it can provide an easier way for humans to get an overview of API changes, because they can visually compare two json objects and quickly see the difference. This is especially useful when the structure of these objects changes in subtle ways. For example, consider the following two example responses from a fake flight booking API:

Screenshot 2023-11-22 at 09 30 04

I don't believe that oasdiff currently provides any reasonable way for a human to view such differences, because the json output in general is not very human readable, and the text output seems to remove all formatting from the examples.

@reuvenharrison
Copy link
Collaborator

Thanks for the clarification.
We're quite busy now with various tasks to improve oasdiff but we can definitely consider this enhancement ,meanwhile I'd be happy to learn more about your use case.
Please join our slack community and let's discuss there: https://join.slack.com/t/oasdiff/shared_invite/zt-1wvo7wois-ttncNBmyjyRXqBzyg~P6oA

Thanks,
Reuven

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

No branches or pull requests

2 participants