Unknown Metaschema
Hi,
VERSION: 1.0.40
I've encountered a problem which I cannot solve.
Here is my json-schema validator.
{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "http://example.com/example.json", "type": "object", "title": "The root schema", "description": "The root schema comprises the entire JSON document.", "default": {}, "examples": [ { "id": "OneShop" } ], "required": [ "id" ], "additionalProperties": false, "properties": { "id": { "$id": "#/properties/id", "type": "string", "pattern":"(OneShop)", "title": "The id schema", "description": "An explanation about the purpose of this instance.", "default": "OneShop", "examples": [ "OneShop" ] } } }
Then I pass validation string listed above to create JsonSchema.
JsonSchema schema = factory.getSchema(schemaStr);
Unfortunately I get
java.util.concurrent.CompletionException: com.networknt.schema.JsonSchemaException: Unknown Metaschema: https://json-schema.org/draft-07/schema
As I saw in sources this should perform GET request for schema, address manually is responsible.
Does anyone know what is the problem?
Change the schema to https from http and it should work. The latest schema URL is https. Thanks.
"$schema": "https://json-schema.org/draft-07/schema#"
Hi, thanks for a quick response.
Unfortunately, the mentioned error remains. I've changed schema url as follows:
{
"$schema": "https://json-schema.org/draft-07/schema#",
"$id": "http://example.com/example.json",
"type": "object",
"title": "The root schema",
"description": "The root schema comprises the entire JSON document.",
"default": {},
"examples": [
{
"id": "OneShop"
}
],
"required": [
"id"
],
"additionalProperties": false,
"properties": {
"id": {
"$id": "#/properties/id",
"type": "string",
"pattern":"(OneShop)",
"title": "The id schema",
"description": "An explanation about the purpose of this instance.",
"default": "OneShop",
"examples": [
"OneShop"
]
}
}
}
Any hints?
Could you please submit a PR with your test case to reproduce the issue? Thanks.
I had the same problem because I was half-consciously following the quickstart and didn't change the VersionFlag from V4 to V7
JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7);
@gricey432 Thanks a lot for your answer. It makes sense and I never thought about this reason. @s16508pjwstk Could you please check your source code to see if this is the root cause?
Closed due to the lack of response from the OP.