Stop schema validator from caching refs
Discussion thread (Atlassian-internal): https://atlassian.slack.com/archives/C061YKF5E2V/p1717707776861939
Short version: The library tries to cache the resolution of schema references so that it can look them up faster, but with structures like anyOf
around a bunch of different references, the fan-out is ridiculous. It also looks like the cached supplier is capturing the validation context, which could hold on to all kinds of things.
Related info from the library:
- https://github.com/networknt/json-schema-validator/issues/1016
- https://github.com/networknt/json-schema-validator/pull/1018
The new option to disable the caching is not in the version of the library that we are currently using, so it will need to be bumped to take advantage of it.
Comments (10)
-
reporter -
reporter
-
reporter - edited description
-
reporter Possible workaround: It looks like the caching was introduced in
1.4.0
. It may be possible to downgrade the library to1.3.3
to avoid the problem if everything else works. Unfortunately, thecom.ethlo.time:itu
dependency cannot be excluded for that version, so we’d have to start pulling in that dependency even though we don’t actually need it. Its license is Apache 2.0, and it has no transitives of its own, so we should be okay on the legal front. -
reporter - changed status to resolved
Fixed in
0.41.0
The schema validator library was downgraded to work around the issue, but this should be revisited once the library support for disabling the cache has been released.
-
reporter - changed status to closed
-
reporter - changed status to open
Reopening because we will eventually want to fix this The Right Way on a later version of the library, but can't do that just yet because it hasn't been released yet.
-
reporter It looks like the downgrade was not effective in addressing this.
Fortunately, we were able to roll forward. We are now on version
1.5.0
of the networknt json-schema-validator and are using settings that disable this cache, which should fully address the issue.Fixed in
0.43.0
-
reporter - changed status to resolved
-
reporter - changed status to closed
- Log in to comment
Unfortunately, the option to disable the caching hasn’t actually been included in a release, yet. Following up here: https://github.com/networknt/json-schema-validator/pull/1018#issuecomment-2159448954