0
在core/validation meta-schema,items
和type
属性定义如下:如果`items`和`type`被定义为阵列,而不anyOf属性
项
"items": {
"anyOf": [
{ "$ref": "#" },
{
"type": "array",
"minItems": 1,
"items": { "$ref": "#" }
}
],
"default": {}
},
类型
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
]
},
据我了解它:
items
可以是一个模式或阵列的至少一个模式type
可以是simpleType
或中的至少一个simpleType
除了阵列写作,我是否认为这些定义是等同的?
项
"items": {
"type": "array",
"items": { "$ref": "#" }
"default": [{}]
},
类型
"type": {
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"uniqueItems": true
},
换句话说,是有以下两种模式之间在解释的差:
模式#1
{
"type": "array",
"items": {
"type": "string"
}
}
模式#2
{
"type": ["array"],
"items": [
{
"type": "string"
}
]
}