$ref schemas are cached and do not update
Opened this issue · 0 comments
It's possible to set a schema to reference another JSON document. For example:
{
"$ref": "https://api.npoint.io/XYZ"
}
You might want this if you have saved several documents in npoint, and want them all to share the same schema.
However, if you do this, then update the referenced schema at XYZ, it will not work. The old schema saved at XYZ is cached, and the cached version will be used for validation.
I think this is happening because the json-schema
library caches external URL loads by default.
We call that from e.g here:
The library cache_schemas
setting seems to be here:
https://github.com/ruby-json-schema/json-schema/blob/ab1253a874f05a811fdb3280ca1f77ebc9af2902/lib/json-schema/validator.rb#L21
It looks like we simply need to set cache_schemas
to true.