The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

[
{
"description": "$id must be evaluated before $ref to get the proper $ref destination (with $anchors)",
"schema": {
"$id": "/ref-and-id1/base.json",
"$ref": "#bigint",
"$defs": {
"bigint": {
"$comment": "canonical uri: /ref-and-id1/base.json/$defs/bigint; another valid uri for this location: /ref-and-id1/base.json#bigint",
"$anchor": "bigint",
"maximum": 10
},
"smallint": {
"$comment": "canonical uri: /ref-and-id1#/$defs/smallint; another valid uri for this location: /ref-and-id1/#bigint",
"$id": "/ref-and-id1/",
"$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": "$id must be evaluated before $ref to get the proper $ref destination (with uris)",
"schema": {
"$id": "/ref-and-id2/base.json",
"$ref": "int.json",
"$defs": {
"bigint": {
"$comment": "canonical uri: /ref-and-id2/int.json",
"$id": "int.json",
"maximum": 10
},
"smallint": {
"$comment": "canonical uri: /ref-and-id2-int.json",
"$id": "/ref-and-id2-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": "$id must be evaluated before $ref to get the proper $ref destination (with json pointers)",
"schema": {
"allOf": [
{
"$id": "allOf0/",
"$ref": "#/oneOf/0",
"oneOf": [
{ "type": "number" }
]
}
],
"oneOf": [
{ "type": "string" },
{ "type": "number" }
]
},
"tests": [
{
"description": "data is valid against innermost type check",
"data": 1,
"valid": true
},
{
"description": "data is invalid against innermost type check",
"data": "hello",
"valid": false
}
]
}
]