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

Add JsonRender and --json command line option #255

Merged
merged 1 commit into from
Sep 30, 2021

Conversation

kimsey0
Copy link
Contributor

@kimsey0 kimsey0 commented Aug 9, 2021

We use OpenAPI-diff in a non-Java environment where we want to be able to inspect the generated diff. We currently use a tiny wrapper program that runs OpenApiCompare.fromLocations, then serializes the resulting ChangedOpenApi to JSON using Jackson. It would be useful to us to drop the wrapper and have this functionality built into OpenAPI-diff instead, similar to the built-in Markdown and HTML rendering.

This pull request adds a new JsonRender class and a --json <file> command line option which works similarly to the existing --html, --markdown, and --text commands.

The generated JSON is quite large, and it could be useful to clean-up, for example removing newSpecOpenApi, oldSpecOpenApi, but it's still useful, as long as you parse out the specific parts you need instead of read through the whole thing.

Feel free to make or suggest any needed edits. I do not work too often in Java, so there may be some non-idiomatic parts in the pull request.

@eacolina
Copy link
Contributor

BUMP!💯

Copy link
Contributor

@joschi joschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kimsey0 Thanks for your contribution! ❤️

@joschi joschi added this to the Release 2.0.0 milestone Sep 30, 2021
@joschi joschi merged commit bda81cc into OpenAPITools:master Sep 30, 2021
@kimsey0 kimsey0 deleted the JsonRender branch September 30, 2021 09:12
@kimsey0
Copy link
Contributor Author

kimsey0 commented Oct 20, 2021

@joschi: Might this be released in a beta to Docker Hub sometime? :-)

@joschi
Copy link
Contributor

joschi commented Oct 20, 2021

@joschi: Might this be released in a beta to Docker Hub sometime? :-)

See here:

@kimsey0
Copy link
Contributor Author

kimsey0 commented Oct 20, 2021

Thanks. I hope you find a solution, whether it's applying for the Docker Open Source program, building images here in GitHub Actions, or something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants