Skip to content

Question: $id keyword and dereferencing #55

Answered by jdesrosiers
char0n asked this question in Q&A
Discussion options

You must be logged in to vote

That's mostly correct, although there's a lot more to $id than that.

only if not found in current document, we resolve the URL [] and assume that the JSON Schema is the result of fetching this URL?

That depends on what you mean by "fetch". In JSON Schema, references are never expected to be fetch other the network or filesystem. An implementation could do that, but most don't. Generally, you load any external schemas into the validator and then the implementation uses that to fetch schemas. So, some pseudocode for an OpenAPI parser might look something like this,

OasParser.addSchema({
  "$id": "https://very-arbitrary-url.com/path",
  "properties": {
    "firstName": { "type": "string" },

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by char0n
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #54 on September 22, 2021 07:54.