pb33f / libopenapi

libopenapi is a fully featured, high performance OpenAPI 3.1, 3.0 and Swagger parser, library, validator and toolkit for golang applications.
https://pb33f.io/libopenapi/
Other
482 stars 64 forks source link

Added a high level cache. #342

Closed daveshanley closed 1 month ago

daveshanley commented 1 month ago

high memory use is a problem in libopenapi, this change moves us a step closer to fixing that. Very reference heavy specs can create an ungodly number of schema proxy calls when the model is being walked.

For example the docusign spec (which has been added to the test suite) creates 4m proxy calls. This is not required as it’s the same ref being called over and over and we already have it after it’s been done once. This change adds a high level cache to prevent the over production of schemas.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.62%. Comparing base (96eaabe) to head (7acbf1f). Report is 5 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #342 +/- ## ======================================= Coverage 99.62% 99.62% ======================================= Files 164 165 +1 Lines 20972 21050 +78 ======================================= + Hits 20893 20971 +78 Misses 74 74 Partials 5 5 ``` | [Flag](https://app.codecov.io/gh/pb33f/libopenapi/pull/342/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pb33f) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/pb33f/libopenapi/pull/342/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pb33f) | `99.62% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pb33f#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.