voxpupuli / json-schema

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

Documentation for controlling how $refs followed seems incorrect #400

Open notjames opened 6 years ago

notjames commented 6 years ago

My use-case:

We have a complex schema set of files which use $refs extensively. Currently, the schema files' $refs reference a private URL, which only works under certain conditions. I have a local copy of the schema files. I need the validation to disregard the URL $ref and instead replace the URL with the file path identified in my code.

According to the documentation I found here, the methods described do not seem to work. Anything I try fails and the validation seems to always try and follow the URL.

Perhaps a feature request: if the schema parameter passed into JSON::Validator.validate is an absolute path or a URL, then $refs automatically resolve to the File.dirname(schema) or Addressable::URI.parse(schema).