json-schema
json-schema copied to clipboard
JSON::Schema::SchemaError: Schema not found
I'm trying to validate a JSON payload that should conform to this schema but I can't get past this error:
#<JSON::Schema::SchemaError: Schema not found: http://json-schema.org/schema#>
I feel like I've tried everything but I must be missing something. I tried to tweak JSON::Validator.schema_reader
so it would accept a URI and fetch the document from the Internet. I also tried staging the schema on disk ahead of time, parsing it, and adding it with JSON::Validator.add_schema
and the http://json-schema.org/schema#
URL. I've tried with/without :strict
, :validate_schema
, :json
, etc. Any suggestions?
It seems support for version 1.0 final of the spec isn't ready yet, try with the default version of the spec, which is "$schema": "http://json-schema.org/draft-04/schema#"
.
I've tried with both and got the same error as you with the final 1.0 version of the spec; the last draft worked properly though.
I get the same error when using http://interagent.github.io/interagent-hyper-schema#
. Is it actually fetching the schema from the Internet, or just locally?
I had the same problem, but turns out it was related to a custom extension that didn't have a properly registered validator to it's url. The error description was misleading on validator.rb:346
. It's looking for a validator for a given uri and when that validator is not found it raises a Schema not found
error.
If any of you are using schema extensions, I think checking this is worth a shot.