OpenAPITools / openapi-diff

Utility for comparing two OpenAPI specifications.
Apache License 2.0
812 stars 154 forks source link

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

Closed eacolina closed 2 years ago

eacolina commented 2 years ago

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[bot] commented 2 years ago