Link to one schema from another in json-schema

I have a json schema that defines some model and has links to common data types in a separate schema.

{
   "type": "object",
   "properties": {
      "address": {"$ref": "http://domain/commons.json#address"},
      "company": {"$ref": "http://domain/commons.json$company"},
   }
}

now this has a problem that I have to deliver a fully qualified response in all places, whereas I would like to specify the commons.json URL once and then link to it, for example:

{
   "type": "object",
   "properties": {
      "address": {"$ref": "#commons/address"},
      "company": {"$ref": "#commons/company"},
   }
   "commons": { "$ref": "http://domain/commons.json"
   }
}

Is it possible?

+4
source share
1 answer

I am afraid this will not work. A $refis a link to another document - in fact it is not the same as creating a clone of a remote document in place.

, - http://domain/..., ?

+1