I'm trying to figure out how to set a global-level array required in schema. My example JSON file is:
[
{
"firstname": "Paul",
"lastname": "McCartney"
},
{
"firstname": "John",
"lastname": "Lennon"
},
{
"firstname": "George",
"lastname": "Harrison"
},
{
"firstname": "Ringo",
"lastname": "Starr"
}
]
As seen above, I want the top-level structure to be an array, not an object. The schema I've got from jsonschema.net is (with slight modifications):
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "/",
"type": "array",
"items": {
"id": "elements",
"type": "object",
"properties": {
"firstname": {
"id": "firstname",
"type": "string"
},
"lastname": {
"id": "lastname",
"type": "string"
}
},
"required": [
"firstname",
"lastname"
]
},
"required": [
"/"
]
}
But it fails with the jsonschema validator. Can you please help me with providing correct JSON schema for top-level array?
minItems.