[
{
"description": "order of evaluation: $id and $ref",
"schema": {
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
"$id": "/ref1/base.json",
"$ref": "int.json",
"$defs": {
"bigint": {
"$comment": "canonical uri: /ref1/int.json",
"$id": "int.json",
"maximum": 10
},
"smallint": {
"$comment": "canonical uri: /int.json",
"$id": "/int.json",
"maximum": 2
}
}
},
"tests": [
{
"description": "data is valid against first definition",
"data": 5,
"valid": true
},
{
"description": "data is invalid against first definition",
"data": 50,
"valid": false
}
]
},
{
"description": "order of evaluation: $id and $anchor and $ref",
"schema": {
"$comment": "$id must be evaluated before $ref to get the proper $ref destination",
"$id": "/ref2/base.json",
"$ref": "#bigint",
"$defs": {
"bigint": {
"$comment": "canonical uri: /ref2/base.json#/$defs/bigint; another valid uri for this location: /ref2/base.json#bigint",
"$anchor": "bigint",
"maximum": 10
},
"smallint": {
"$comment": "canonical uri: /ref2/#/$defs/smallint; another valid uri for this location: /ref2/#bigint",
"$id": "/ref2/",
"$anchor": "bigint",
"maximum": 2
}
}
},
"tests": [
{
"description": "data is valid against first definition",
"data": 5,
"valid": true
},
{
"description": "data is invalid against first definition",
"data": 50,
"valid": false
}
]
},
{
"description": "naive replacement of $ref with its destination is not correct",
"schema": {
"$defs": {
"a_string": { "type": "string" }
},
"enum": [
{ "$ref": "#/$defs/a_string" }
]
},
"tests": [
{
"description": "do not evaluate the $ref inside the enum",
"data": "this is a string",
"valid": false
},
{
"description": "match the enum exactly",
"data": { "$ref": "#/$defs/a_string" },
"valid": true
}
]
}
]