Например, если есть свойство с именем «Описание», то, если я проверяю полезную нагрузку json по схеме json и добавляю 2 раза «Описание», тогда должно появиться сообщение об ошибке, так как есть 2 поля с одинаковым именем ключа.
Схема Json:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "http://example.com/test1.schema.json",
"title": "test1",
"description": "Schema for test1",
"additionalProperties": false,
"definitions":{
"link":
{
"type": "object",
"additionalProperties": false,
"required":
[
"customer2"
],
"properties":{
"customer2":
{
"$ref": "#/definitions/customer"
}
}
},
"customer":{
"type": "object",
"additionalProperties": false,
"required":
[
"Code",
"Description",
"OrderID"
],
"properties":{
"Code": {
"type": "number"
},
"Description": {
"type": "string"
},
"OrderID": {
"type": "string"
}
}
}
},
"type": "object",
"properties": {
"customer1":{
"$ref": "#/definitions/link"
},
"chocolates": {
"type": "string"
}
}
}
Полезная нагрузка Json:
{
"customer1": {
"customer2": {
"Code": 0.1,
"Description": "a",
"Description": "a",
"OrderID": "a"
}
},
"chocolates": "a"
}
Следующая полезная нагрузка Json проверяется по схеме Json, когда я хочу, чтобы она выдавала ошибкутак как есть 2 тега «Описание».