1
我试图创建以下列方式为JSON模式:JSON模式要求节点
{
"$schema": "http://json-schema.org/schema#",
"title": "Layout",
"description": "The layout created by the user",
"type": "object",
"definitions": {
"stdAttribute": {
"type": "object",
"properties": {
"attributeValue": {
"type": "object"
},
"attributeName": {
"type": "string"
}
}
},
"stdItem": {
"type": "object",
"required" : ["stdAttributes"],
"properties": {
"stdType": {
"enum": [
"CONTAINER",
"TEXT",
"TEXTAREA",
"BUTTON",
"LABEL",
"IMAGE",
"MARCIMAGE",
"DATA",
"SELECT",
"TABLE"
]
},
"stdAttributes": {
"type": "array",
"items": {
"$ref": "#/definitions/stdAttribute"
}
},
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/stdItem"
}
}
}
}
},
"properties": {
"layoutItem": {
"$ref": "#/definitions/stdItem"
}
}
}
我确认以下JSON反对:
{
"layoutItem": {
"stdItem": {
"stdType": "CONTAINER",
"stdAttributes": [],
"children": []
}
}
}
问题是当我运行java验证程序时出现错误,因为我按照“stdItem”的要求指定了“stdAtrributes”节点,验证程序无法对其进行鉴别。
我试图在属性中定义所需的数组,但模式被取消。
如果我把 “stdAttributes” 外 “stdItem”,它的工作原理。
有谁知道我该如何定义这个要求“stdItem”?
它的工作原理!非常感谢你。 – Jeyvison