I'm working on a json schema like this:
{
"$schema": "http://json-schema.org/schema#",
"title": "Layout",
"description": "The layout created by the user",
"type": "object",
"definitions": {
"stdAttribute": {
"type": "object",
"required": ["attributeName","attributeValue"],
"properties": {
"attributeValue": {
"type": "string"
},
"attributeName": {
"type": "string"
}
}
},
"stdItem": {
"type": "object",
"required" : ["stdType","stdAttributes"],
"properties": {
"stdType": {
"enum": [
"CONTAINER",
"TEXT",
"TEXTAREA",
"BUTTON",
"LABEL",
"IMAGE",
"MARCIMAGE",
"DATA",
"SELECT",
"TABLE"
]
},
"stdAttributes": {
"type": "array",
"items": {
"$ref": "#/definitions/stdAttribute"
},
"minItems": 1
},
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/stdItem"
}
}
}
}
},
"properties":{
"stdItem":{ "$ref": "#/definitions/stdItem" }
}
}
I'm trying to validate the following json with the above scheme:
{
"stdItem": {
"stdType": "CONTAINER",
"stdAttributes": [
{
"attributeName": "ola",
"attributeValue": "teste"
}
],
"children": [
{
"stdItem": {
"stdType": "TEXT",
"stdAttributes": [
{
"attributeName": "ola",
"attributeValue": "teste"
}
],
"children": []
}
}
]
}
}
I'm getting an error telling me that the require attributes stdType and stdAttributes are missing for the path stdItem/children/0. As you can see the attributes are there , they are not missing.
I tried to change the order fo the attributes but still doesnt work. I keep getting the following error:
--- BEGIN MESSAGES --- error: object has missing required properties (["stdAttributes","stdType"]) level: "error" schema: {"loadingURI":"#","pointer":"/definitions/stdItem"} instance: {"pointer":"/stdItem/children/0"} domain: "validation" keyword: "required" required: ["stdAttributes","stdType"] missing: ["stdAttributes","stdType"] --- END MESSAGES ---
Could anyone point me for what i'm doing wrong?