Skip to content

doubts about ref.json test. #634

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

You must be logged in to vote

It's kind of both part of the specification and convention. A reference will evaluate anything you point to as a schema. For example, this should work.

{
  "type": "object",
  "properties": {
    "aaa": { "$ref": "#/mydefs/foo" }
  },
  "mydefs": {
    "foo": { "type": "string" }
  }
}

However, the validator doesn't know the mydefs keyword and doesn't know that it's values are schemas. This example wouldn't work.

{
  "type": "object",
  "properties": {
    "aaa": { "$ref": "/foo" }
  },
  "mydefs": {
    "foo": {
      "id": "/foo",
      "type": "string"
    }
  }
}

The id isn't recognized as an identifier because the validator doesn't know that mydefs values should be processed as schem…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by redmitry
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 #633 on February 03, 2023 19:31.