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

Fix: Crashes when parsing diff for very large specs #388

Merged
merged 2 commits into from
Jun 22, 2022

Conversation

eacolina
Copy link
Contributor

Issue:
When calculating diffs between two large Swagger specs(~123k loc) the tool will crash when writing the output to a JSON file. As shown in the screenshot this is due to the tool, first converting the ChangedOpenAPI object to a JSON string and then writing this string to a file. Because this string is massive it violates the max UTF16 string size.

Screen Shot 2022-06-22 at 13 55 50

Solution:
Write the diff directly to a the output file and also omit the oldSpecOpenApi and newSpecOpenApi when writing the output as an optimization. These fields are irrelevant for the diff output.

@gitpod-io
Copy link

gitpod-io bot commented Jun 22, 2022

@joschi joschi added this to the 2.1.0 milestone Jun 22, 2022
Comment on lines +12 to +13
@JsonIgnore private OpenAPI oldSpecOpenApi;
@JsonIgnore private OpenAPI newSpecOpenApi;
Copy link
Contributor

Choose a reason for hiding this comment

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

This would change the output of the JSON renderer and remove the copy of the old and new OpenAPI specifications from the document.

Was this intentional?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with removing/ignoring these fields since none of the other output renderers is using them, but I want to make sure this was intentional on your end. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it was. IMO that information is redundant as they are the inputs to the tool. Plus in the case of large files it makes the output unnecessarily large.

@eacolina eacolina requested a review from joschi June 22, 2022 18:34
@joschi joschi merged commit 31c4f09 into OpenAPITools:master Jun 22, 2022
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.

2 participants