-
-
Notifications
You must be signed in to change notification settings - Fork 220
some tests of the interactions between $id, $anchor and $ref #383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,67 @@ | |
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "non-schema object containing a plain-name $id property", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind opening an issue, I'll remove them if someone doesn't get to it first There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix in #562 |
||
"schema": { | ||
"$defs": { | ||
"const_not_anchor": { | ||
"const": { | ||
"$id": "#not_a_real_anchor" | ||
} | ||
} | ||
}, | ||
"if": { | ||
"const": "skip not_a_real_anchor" | ||
}, | ||
"then": true, | ||
"else" : { | ||
"$ref": "#/$defs/const_not_anchor" | ||
} | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "skip traversing definition for a valid result", | ||
"data": "skip not_a_real_anchor", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "const at const_not_anchor does not match", | ||
"data": 1, | ||
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "non-schema object containing an $id property", | ||
"schema": { | ||
"$defs": { | ||
"const_not_id": { | ||
"const": { | ||
"$id": "not_a_real_id" | ||
} | ||
} | ||
}, | ||
"if": { | ||
"const": "skip not_a_real_id" | ||
}, | ||
"then": true, | ||
"else" : { | ||
"$ref": "#/$defs/const_not_id" | ||
} | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "skip traversing definition for a valid result", | ||
"data": "skip not_a_real_id", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "const at const_not_id does not match", | ||
"data": 1, | ||
"valid": false | ||
} | ||
] | ||
} | ||
|
||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -644,5 +644,69 @@ | |
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "order of evaluation: $id and $ref", | ||
"schema": { | ||
"$comment": "$id must be evaluated before $ref to get the proper $ref destination", | ||
"$id": "/base/base.json", | ||
"$ref": "int.json", | ||
"$defs": { | ||
"bigint": { | ||
"$comment": "canonical uri: /base/int.json", | ||
"$id": "int.json", | ||
"maximum": 10 | ||
}, | ||
"smallint": { | ||
"$comment": "canonical uri: /int.json", | ||
"$id": "/int.json", | ||
"maximum": 2 | ||
} | ||
} | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is wrong. It looks like I copied this test erroneously from draft2019-09, and it was never tested. |
||
"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: plain-name $id and $ref", | ||
"schema": { | ||
"$comment": "$id must be evaluated before $ref to get the proper $ref destination", | ||
"$id": "/base.json", | ||
"$ref": "#bigint", | ||
"$defs": { | ||
"bigint": { | ||
"$comment": "canonical uri: /base.json#/$defs/bigint; another valid uri for this location: /base.json#bigint", | ||
"$id": "#bigint", | ||
"maximum": 10 | ||
}, | ||
"smallint": { | ||
"$comment": "canonical uri: /#/$defs/smallint; another valid uri for this location: /#bigint", | ||
"$id": "/#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 | ||
} | ||
] | ||
} | ||
] |
Uh oh!
There was an error while loading. Please reload this page.