Add JsonRender and --json command line option #255
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 resultingChangedOpenApi
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.