0
我有非常基本的模式,表现出奇怪的行为。不同类型数组的JSON模式
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties":
{
"$out":
{
"type": "array",
"minItems": 1,
"items": {
"oneOf": [
{ "type": "string" },
{ "$ref": "#/definitions/alias" }
]
}
}
},
"definitions":
{
"alias":
{
"properties":
{
"$source": { "type": "string" },
"$alias": { "type": "string" }
},
"required": [ "$source", "$alias" ],
"additionalProperties": false
}
}
}
如果我用下面的JSON进行测试:
{
"$out": [
"12w",
{ "$source": "WH.Code", "$alias": "WarehouseCode"}
]
}
它失败(sample)说在数组字符串元素是有效的agains更是一个模式。如果我改变引用'别名'与只是{“type”:“字符串”}它按预期工作。我究竟做错了什么?
在此先感谢。