Seemingly valid schema and input results in an error I do not understand
Closed this issue · 2 comments
c11z commented
Hi, love this library by the way. This schema is my first attempt with an array of objects.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"name": {
"type": "string"
},
"comics": {
"type": "array",
"items": {
"type": "object",
"properties": {
"comic_id": {
"type": "string",
"pattern": "^[0-9a-f]{24}$"
},
"cron": {
"type": "string"
},
"mark": {
"type": "integer",
"minimum": 1
},
"step": {
"type": "integer",
"minimum": 1,
"maximum": 50
}
},
"required": [
"comic_id",
"cron",
"mark",
"step"
],
"additionalProperties": false
}
}
},
"required": [
"name",
"comics"
],
"additionalProperties": false
}
My JSON test case works here: http://www.jsonschemavalidator.net/
{
"name": "glorious horse",
"comics": [
{
"comic_id": "57341408de7af93a83733280",
"mark": 1,
"cron": "0 0 8 1/1 * ? *",
"step": 10
}
]
}
But when I try to validate it I get this error response:
[ {
"schemaPath" : "n/a",
"errors" : { },
"msgs" : [ "error.path.missing" ],
"value" : {
"name" : "glorious horse",
"comics" : [ {
"comic_id" : "57341408de7af93a83733280",
"cron" : "0 0 8 1/1 * ? *",
"mark" : 1,
"step" : 10
} ]
},
"instancePath" : "/id"
} ]
It is late at night, so maybe I am tired, but I don't understand what is wrong.
c11z commented
Well, exactly 5 minutes after posting this I figured it out. I guess I am tired.
edgarmueller commented
Glad you figured it out, if there's anything else, let me know.