You want to use the allOf
keyword, combined with $ref
:
{
"id": "/schemas/man.json",
"allOf": [{"$ref": "person.json"}],
...
}
(Note: This is v4. In v3, the same thing was called extends
.)
In plain English, it says "Every instance following Man schema must also follow the Person schema".
The bigger issue is in fact your use of additionalPropeties
. Since person.json
bans additional properties, any instance with a "beard"
property is actually not a valid Person. If you're going to be extending Person, I advise you remove the constraint banning additional properties.
(Note: this behaviour is the subject of some conflict in the JSON Schema community, but this is what's in the specs.)