This is one more motivation to change the definition of the "required" keyword!
As was already explained earlier, the "required" keyword has no role
in the schema is it attached to, it only makes sense to its containing
"properties". In draft v4, this keyword will change and your schema
will become:
{
"name": "Invoice",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"delivery": {
"$ref": "Delivery.json"
}
},
"required": [ "delivery" ]
}
Basically, it means that when validating a "properties" schema at the
moment, you have to lookup all "required" keywords in property schemas
to build the list of required properties for an object instance. With
draft v4 it will no longer be the case.
As such, "$ref" replacement doesn't really matter. But "required" as
defined in draft v3 is certainly confusing.
Hope this helps,
--
Francis Galiegue,
fgal...@gmail.com
"It seems obvious [...] that at least some 'business intelligence'
tools invest so much intelligence on the business side that they have
nothing left for generating SQL queries" (Stéphane Faroult, in "The
Art of SQL", ISBN 0-596-00894-5)