Ниже схемы Json и Json Document оба действительны json. Его просто, что я не могу получить действительный документ Json по отношению к json-схеме.Документ JSON не прошел проверку на схеме JSON
Я получаю сообщение об ошибке сказав: НЕ должны иметь дополнительные свойства
Json Схема
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Movies Schema",
"description": "Movies schema containing ratings and genres",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "number"
},
"title": {
"type": "string"
},
"release_date": {
"type": "string"
},
"video": {
"type": "string"
},
"IMDBURL": {
"type": "string"
},
"genres": {
"type": "array"
}
},
"required": [
"id",
"title",
"release_date",
"video",
"IMDBURL",
"genres"
]
},
"users": {
"type": "object",
"additionalProperties": false,
"properties": {
"user_id": {
"type": "number"
},
"ratings": {
"type": "number"
},
"timestamps": {
"type": "string"
}
},
"required": [
"user_id",
"ratings",
"timestamps"
]
}
}
JSON Документ
[
{
"id": 1,
"title": "Kung Fu Panda",
"release_date": "01-01-2001",
"video": "",
"IMDBURL": "link.com",
"genres": [
"abc",
"def"
],
"users": {
"user_id": 2,
"ratings": 3,
"timestamps": "2342478"
}
}
]
Проверьте, что он существует, прокрутите страницу внизу. –
в вашем объекте JSON, «пользователь» является частью «фильма», поэтому в вашей схеме вы должны добавить «пользователь» в качестве поля в вашей схеме видео –