-
Schema example with blog post that have recursive comments tree: {
"$id": "https://example.com/BlogPost",
"type": "object",
"properties": {
"comments": {
"type": "array",
"items": { "$ref": "#comment" }
}
},
"$defs": {
"comment": {
"$anchor": "comment",
"type": "object",
"properties": {
"text": { "type": "string" },
"replies": {
"type": "array",
"items": { "$ref": "#" }
}
}
}
}
} The question is at It seems like it should reference to the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It references |
Beta Was this translation helpful? Give feedback.
It references
https://example.com/BlogPost
. The base URI is set by$id
and ishttps://example.com/BlogPost
so the"$ref": "#"
resolves to"$ref": "https://example.com/BlogPost#"
.$anchor
does not change the base URI at all, because base URIs are absolute-URIs (with a scheme and without a fragment).