[
{
"name": "John",
"surname": "Smith",
"lastCheck": "Tue 23rd August 2016"
},
{
"name": "John",
"surname": "Doe",
"lastCheck": "Wed 24th August 2016"
},
{
"name": "Mary",
"surname": "Jones",
"lastCheck": "Tue 23rd August 2016"
}
]
{
"type": "array",
"items": { "$ref": "#/definitions/PersonEntry" },
"uniqueItems": true,
"definitions": {
"PersonEntry": {
"type": "object",
"required": ["name", "surname", "lastCheck"],
"properties": {
"name": { "type": "string" },
"surname": { "type": "string" },
"lastCheck": { "type": "string" }
}
}
}
}
[
{
"name": "John",
"surname": "Smith",
"lastCheck": "Tue 23rd August 2016"
},
{
"name": "John",
"surname": "Smith",
"lastCheck": "Wed 24th August 2016"
}
]
{
"allOf": [
{
"type": "array",
"items": { "$ref": "#/definitions/PersonName" },
"uniqueItems": true
},
{
"type": "array",
"items": { "$ref": "#/definitions/PersonCheck" }
}
],
"definitions": {
"PersonName": {
"type": "object",
"required": ["name", "surname"],
"properties": {
"name": { "type": "string" },
"surname": { "type": "string" }
}
},
"PersonCheck": {
"type": "object",
"required": ["lastCheck"],
"properties": {
"lastCheck": { "type": "string" }
}
}
}
}
{
"type": "array",
"items": {
"allOf": [
{"$ref": "#/definitions/PersonName" },
{ "$ref": "#/definitions/PersonCheck" }
]
}
}
([...] Definition of equality [...] for objects [...])
- have the same set of members (keys), and
- member values of both objects, for the same member, are equal according to this definition.
If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique.
{
"type": "array",
"items": { "$ref": "#/definitions/PersonName" },
"uniqueItems": true
}
[
{ "name": "John", "surname": "Smith", "lastCheck": "Tue 23rd August 2016" },
{ "name": "John", "surname": "Smith", "lastCheck": "Wed 24th August 2016" }
]
Hi Henry,
Although I understand the intention, and would very much like this to be true, I don't see anything in a spec that would support your claim of "uniquness based on schema". Instead, what I see is "uniquness based on data" on wiki[1]:([...] Definition of equality [...] for objects [...])
- have the same set of members (keys), and
- member values of both objects, for the same member, are equal according to this definition.
or "uniquness is axiomatic" in a spec[2]:If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique.