calling JSON::Validator.validate!(schema, json, options) succeeds the first time and JSON::Validator.schemas.keys is:
["file:///redacted/schema.json#"]
calling JSON::Validator.validate!(schema, json, options) a second time raises an error:
JSON::Schema::ValidationError: The property '#/0' of type object did not match the following type: array in schema 7cb19a09-a7b6-55db-9163-2d1595d4f3e4
So it looks like passing :list => true on the second call caches the schema again, making it a list of the already cached list version of the original schema.json file..
For now I'm using :clear_cache => true in the options to prevent this from happening.
Hi,
Experiencing a strange issue with cached schema from file paths. If I have the following block of code:
and the schema.json file contains:
calling
JSON::Validator.validate!(schema, json, options)
succeeds the first time andJSON::Validator.schemas.keys
is:calling
JSON::Validator.validate!(schema, json, options)
a second time raises an error:JSON::Validator.schemas.keys
is:If I look at the two cached schemas in memory
schema.json
is:7cb19a09-a7b6-55db-9163-2d1595d4f3e4
is:So it looks like passing :list => true on the second call caches the schema again, making it a list of the already cached list version of the original schema.json file..
For now I'm using
:clear_cache => true
in the options to prevent this from happening.(json-schema 2.8.1 on ruby 1.9.3)