This one will likely also be my error, but I just cant figure it out.
In a nutshell: I am using $ref to refer to types defined in local files. If I structure the file as I've seen in examples, using a "definitions" section, I get an exception from urlopen when I run jsonschema, that says the file is not found. If I just put the definition of the type at the "top level", then the $ref works fine. Even putting in an absolute path (which I don't want to do anyway) doesn't fix my issue.
Here are some toy examples that illustrate my problem, starting with the one that works ok. I appreciate anyone's having a look.
good.schema.json
blah-flat.json
blah-example.json
Result - no errors
> jsonschema -i blah-example.json good.schema.json
>
So this works fine. Here's where I have a problem. I use a different file to define the type for "ablah":
blahdef.json
{
"definitions" : {
"Blah" : {
"type" : "string"
}
}
}
Then have the schema refer to it like this:
problem.schema.json
and I get this error from jsonschema -i blah-example.json problem.schema.json:
jsonschema.exceptions.RefResolutionError: <urlopen error [Errno 2] No such file or directory: '/blahdef.json'>
>