Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions tests/draft-next/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,71 @@
"valid": false
}
]
},
{
"description": "ref to if",
"schema": {
"$ref": "http://example.com/ref/if",
"if": {
"$id": "http://example.com/ref/if",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
},
{
"description": "ref to then",
"schema": {
"$ref": "http://example.com/ref/then",
"then": {
"$id": "http://example.com/ref/then",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
},
{
"description": "ref to else",
"schema": {
"$ref": "http://example.com/ref/else",
"else": {
"$id": "http://example.com/ref/else",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
}
]
66 changes: 66 additions & 0 deletions tests/draft2019-09/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,71 @@
"valid": false
}
]
},
{
"description": "ref to if",
"schema": {
"$ref": "http://example.com/ref/if",
"if": {
"$id": "http://example.com/ref/if",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
},
{
"description": "ref to then",
"schema": {
"$ref": "http://example.com/ref/then",
"then": {
"$id": "http://example.com/ref/then",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
},
{
"description": "ref to else",
"schema": {
"$ref": "http://example.com/ref/else",
"else": {
"$id": "http://example.com/ref/else",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
}
]
66 changes: 66 additions & 0 deletions tests/draft2020-12/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,71 @@
"valid": false
}
]
},
{
"description": "ref to if",
"schema": {
"$ref": "http://example.com/ref/if",
"if": {
"$id": "http://example.com/ref/if",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
},
{
"description": "ref to then",
"schema": {
"$ref": "http://example.com/ref/then",
"then": {
"$id": "http://example.com/ref/then",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
},
{
"description": "ref to else",
"schema": {
"$ref": "http://example.com/ref/else",
"else": {
"$id": "http://example.com/ref/else",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
}
]
66 changes: 66 additions & 0 deletions tests/draft7/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -818,5 +818,71 @@
"valid": false
}
]
},
{
"description": "ref to if",
"schema": {
"$ref": "http://example.com/ref/if",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $refs for these need to be wrapped in allOf because it's draft-07.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, fixed, e4e1a22 thanks!

"if": {
"$id": "http://example.com/ref/if",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
},
{
"description": "ref to then",
"schema": {
"$ref": "http://example.com/ref/then",
"then": {
"$id": "http://example.com/ref/then",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
},
{
"description": "ref to else",
"schema": {
"$ref": "http://example.com/ref/else",
"else": {
"$id": "http://example.com/ref/else",
"type": "integer"
}
},
"tests": [
{
"description": "a non-integer is invalid due to the $ref",
"data": "foo",
"valid": false
},
{
"description": "an integer is valid",
"data": 12,
"valid": true
}
]
}
]