networknt / json-schema-validator

A fast Java JSON schema validator that supports draft V4, V6, V7, V2019-09 and V2020-12
Apache License 2.0
822 stars 323 forks source link

Reduce memory usage and improve performance #966

Closed justin-tay closed 6 months ago

justin-tay commented 6 months ago

This reduces memory usage and improves performance in particular when a lot of assertions are generated, typically with a large input data set and with the use of oneOf. In such cases the application may hang as it attempts to repeatedly aggregate the assertions into the LinkedHashSet.

codecov-commenter commented 6 months ago

Codecov Report

Attention: 30 lines in your changes are missing coverage. Please review.

Comparison is base (c768bc1) 78.78% compared to head (5b30462) 78.63%.

Files Patch % Lines
.../main/java/com/networknt/schema/utils/SetView.java 76.92% 8 Missing and 10 partials :warning:
...va/com/networknt/schema/DependenciesValidator.java 80.00% 0 Missing and 2 partials :warning:
...in/java/com/networknt/schema/DependentSchemas.java 71.42% 0 Missing and 2 partials :warning:
...a/com/networknt/schema/PropertyNamesValidator.java 60.00% 0 Missing and 2 partials :warning:
...main/java/com/networknt/schema/AllOfValidator.java 83.33% 0 Missing and 1 partial :warning:
...main/java/com/networknt/schema/AnyOfValidator.java 94.73% 0 Missing and 1 partial :warning:
...ava/com/networknt/schema/ItemsValidator202012.java 80.00% 0 Missing and 1 partial :warning:
...main/java/com/networknt/schema/OneOfValidator.java 90.90% 0 Missing and 1 partial :warning:
...ava/com/networknt/schema/PrefixItemsValidator.java 80.00% 0 Missing and 1 partial :warning:
...java/com/networknt/schema/PropertiesValidator.java 92.85% 0 Missing and 1 partial :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #966 +/- ## ============================================ - Coverage 78.78% 78.63% -0.16% - Complexity 1768 1809 +41 ============================================ Files 160 161 +1 Lines 5798 5893 +95 Branches 1081 1116 +35 ============================================ + Hits 4568 4634 +66 - Misses 825 833 +8 - Partials 405 426 +21 ```

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