-
-
Notifications
You must be signed in to change notification settings - Fork 217
add tests for $dynamicAnchor in multiple branches of propertyDependencies #617
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
add tests for $dynamicAnchor in multiple branches of propertyDependencies #617
Conversation
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.
As noted in the issue, this scenario has undefined behavior. I'd be happier if it did not, but we have not been able to agree on such a change.
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.
Never mind, as noted in the issue this was my mistake reading things too quickly.
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 should be in draft-next. propertyDependencies
doesn't exist in 2020-12.
Also, the schema isn't right. The dynamic anchors in "east" and "west" need to be in a definition or something where it doesn't get evaluated. This should fix it so it does what you intended.
{
"$schema": "https://json-schema.org/draft/next/schema",
"$id": "http://localhost:1234/draft2020-12/dynamicanchor-in-propertydependencies.json",
"$defs": {
"inner": {
"$id": "inner",
"type": "object",
"additionalProperties": {
"$dynamicRef": "#foo"
}
}
},
"propertyDependencies": {
"expectedTypes": {
"strings": {
"$id": "east",
"$ref": "inner",
"$defs": {
"foo": {
"$dynamicAnchor": "foo",
"type": "string"
}
}
},
"integers": {
"$id": "west",
"$ref": "inner",
"$defs": {
"foo": {
"$dynamicAnchor": "foo",
"type": "integer"
}
}
}
}
}
}
Yep. My bad. That's what I meant.
The goal of this test is to check whether the implementation can resolve to the right anchor. I don't see how burying the anchors inside
Yes, the anchor and the associated |
🤔 @jdesrosiers I do see a problem with what I have that your approach solves: having I'll update. |
I'm not sure I see the loop. The problem I saw was much more fundamental than that. In order for the sub-schemas to apply, the instance must be an object, but the |
Resolves #615