JSON项中的每个键都出现了"Additional properties are not allowed"错误。
模式:
{
"additionalProperties": false,
"category": {
"admin": {"type": "boolean"}
},
"username": {"type": "string"},
"password": {"type": "string"},
"name": {"type": "string"},
"email": {"type": "string", "format": "email"},
"phone": {"type": "string"},
"hours": {
"type": "array",
"items": {
"start": {"type": "string", "format": "date-time"},
"end": {"type": "string", "format": "date-time"}
}
}
}
项目:
{
"username": "emanb29",
"password": "$2a$10$THISISAPASSWORDHASH",
"name": "Application User",
"email": "user@email.com",
"phone": "5555555555",
"hours": [
{
"start": "1998-05-05T04:00:00Z",
"end": "1999-05-05T04:00:00Z"
},
{
"start": "2001-05-29T10:20:00Z",
"end": "2001-05-29T22:20:00Z"
}
],
"category": {
"admin": true
}
}
1条答案
按热度按时间jdgnovmf1#
根据www.example.com上的示例,jsonschemalint.com我在根目录中为属性创建了一个
properties
容器,在根目录中添加了description
和type
,并将additionalProperties
移动到根目录中。这将验证您在www.example.com上的项目jsonschemalint.com: