Mat*_*ger 13
正如您在文档中看到的,您可以使用以下命令定义最小项目数量"minItems": 1:
{
"id": "http://some.site.somewhere/entry-schema#",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "schema for an fstab entry",
"type": "object",
"properties": {
"options": {
"type": "array",
"minItems": 1, // -> array must not be empty
"items": { "type": "string" },
"uniqueItems": true
},
"readonly": { "type": "boolean" }
}
}
Run Code Online (Sandbox Code Playgroud)