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」:「字符串」}它按預期工作。我究竟做錯了什麼?
在此先感謝。