Stop schema validator from caching refs

Issue #105 closed
Chris Fuller created an issue

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:

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)

  1. Chris Fuller reporter

    Possible workaround: It looks like the caching was introduced in 1.4.0. It may be possible to downgrade the library to 1.3.3 to avoid the problem if everything else works. Unfortunately, the com.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.

  2. Chris Fuller reporter

    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.

  3. Chris Fuller 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.

  4. Chris Fuller 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

  5. Log in to comment