voxpupuli / json-schema

Ruby JSON Schema Validator
MIT License
1.52k stars 242 forks source link

Load local copy of draft schemas #362

Closed iainbeeston closed 7 years ago

iainbeeston commented 7 years ago

If you refer to a draft schema in a $ref (as the common test suite does) json-schema will load it from json-schema.org even though the gem contains a local copy.

This change patches JSON::Validator#load_ref_schema to check whether a $ref refers to a draft schema before trying to load from the web, and if so parsing and serving up the local copy.

I've also replaced the local copy of draft3 with the exact version found online (only whitespace was different).

iainbeeston commented 7 years ago

This sounds like a minor change but it's necessary in order to clear the schema cache between tests in the common test suite.