I have created a JSON schema following the draft v7 specifications. Schema looks like this:
{
"type": "object",
"properties": {
"songs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"composition": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"publishing": {
"type": "array",
"items": {
"type": "object",
"required": ["publisherId","territory"],
"definitions": {
"categoryList": {
"type": "object",
"properties": {
"BR": {
"type": "number"
}
}
}
},
"properties": {
"publisherId": {
"type": "integer"
},
"territory": {
"$ref": "#/definitions/categoryList"
}
}
}
}
}
},
"recordings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"songVersion": {
"type": "string"
},
"album": {
"type": "object",
"properties": {
"title": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
but got error Could not resolve schema reference '#/definitions/categoryList'. Path 'properties.songs.items.properties.composition.properties.publishing.items.properties.territory', line 40, position 24. If I omit the definitionpart it works perfectly
definitionsat the root level based on the reference you have provided. Your reference URI is relative to the document root, not the current object. - Relequestual