Check JSON Schema which is syntactically correct, but not semantically

Viewed 346

I want to check the JSON schema itself which is syntactically correct, but not semantically .

e.g

{
      "$schema": "http://json-schema.org/draft-07/schema#",
      "$id": "http://example.com/root.json",
      "type": "object",
      "required": [
        "checked"
      ],
      "properties": {
        "checked": {
          "$id": "#/properties/checked",
          "type_invalid":"string"
        }
      }
    }

In the above example has type_invalid key which is incorrect it should be type. Is there any way to validate JSON schema itself?

for reference:I am using ajv to validate JSON against JSON schema.

1 Answers

You could copy the existing meta-schema, and modify it to not allow additional properties, and then use that to validate your schemas.

Related