-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
test when $dynamicRef references a boolean schema #701
Conversation
d4af8ee
to
ad51b5c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the things that's changing for $dynamicRef
in the next version is that it's a completely separate referencing system from $ref
. Only anchor-like referencing will be allowed, which means it is simply incapable of referencing a boolean schema.
So these tests don't apply for draft/next
.
Edit: I reference the conversation here but I think the bulk of it may have happened in slack and I can't find it.
}, | ||
{ | ||
"description": "false schema", | ||
"data": { "false": 1 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch of the test seems "uninteresting" / unrelated to this test case -- I assume it fails both before and after whatever bugfix you made. It seems more likely to be interesting/relevant if you put it behind a dynamic ref itself? i.e. #/$defs/true
and #/$defs/false
and fail when you hit false
via the dynamicRef.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent is to show a way to a 'valid' state. Otherwise, a naive interpretation of the test should be that this input should always cause a validation failure. Do you have a suggestion for a better way to provide a valid data input?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent is to show a way to a 'valid' state.
(I was commenting on the invalid branch, which fails simply because it's equivalent to {"properties": {"foo": false}}
)
What I was trying to suggest instead above (albeit I don't know whether it exercises your specific bug you were targeting, but it seems like it should be the same) was to use this schema:
{
"$defs": {
"true": true,
"false": false
},
"properties": {
"true": {
"$dynamicRef": "#/$defs/true"
},
"false": { "$dynamicRef": "#/$defs/false" }
}
}
and to then have the two instances (and outcomes) be exactly the ones you have now I think.
Has that change already landed, or is it planned to be done in the future? |
It hasn't yet. We have a task in the opening comment of the issue I linked, but that's it. |
ad51b5c
to
dd27751
Compare
dd27751
to
4e9640c
Compare
Ok, I fixed the tests to make the true and false branches look more alike, as you suggested. I also added I left the draft-next tests alone, as the specified behaviour of $dynamicRef has not yet changed; when it does, this test (along with some others I'm sure) will start failing in the test suite and we can fix/remove them then. |
I'm happy with that. |
This was an interesting one in my implementation - when looking for a
$dynamicAnchor
keyword at the destination schema, it threw an exception when that schema wasn't an object, but rather a boolean.