A project of mine accepts “plugins”. These plugins need to provide a special JSON file which contains some meta information and also describes event objects with JSON Schema. For example:
{
"name": "My component",
"description": "My super awesome component",
"documentation": "docs/main.md",
"maintainer": "john.doe@example.com",
"events": [{
"name": "click",
"description": "Occurs when the element is clicked.",
"data": [{
"name": "xPos",
"description": "The horizontal position of the click.",
"schema": {
"type": "integer",
"minimum": 0
}
}
]
}]
}
This meta file will be validated against a JSON Schema. Now my question is, how could I validate the contents of the events[0].data[0].schema
entry? In this case, the expected field is an integer, but it could be any other type, too. Is there a "type":"schema"
or something similar defined in JSON Schema?
(For what it’s worth, I’m using ajv as validator.)