Skip to content

test weird $dynamicRef/$dynamicAnchor bookending case #463

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

Conversation

ryangalamb
Copy link
Contributor

This case comes from a slack conversation with @jdesrosiers .

Copy link
Member

@ssilverman ssilverman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ssilverman ssilverman requested a review from jdesrosiers March 14, 2021 05:40
@jdesrosiers
Copy link
Member

jdesrosiers commented Mar 15, 2021

This looks to me like it's testing the normal case of looking for the bookend in the initially resolved schema, which is covered in #462. The weird case (to me at least) is when a $dynamicRef ends up behaving like a $ref if it isn't used properly.

{
    "$dynamicAnchor": "foo",
    "type": "object",
    "properties": {
        "foo": { "$dynamicRef": "dynamic.json#foo" },
        "bar": { "$dynamicRef": "not-dynamic.json#foo" },
        "baz": { "$dynamicRef": "wtf.json" },
    },
    "$defs": {
        "dynamic": {
            "$id": "dynamic.json",
            "$dynamicAnchor": "foo",
            "not": true
        },
        "not-dynamic": {
            "$id": "not-dynamic.json",
            "$anchor": "foo",
            "not": true
        },
        "wtf": {
            "$id": "wtf.json",
            "not": true
        }
    }
}
  • /foo is weird because it references a schema that will never be used for anything other than checking if it has a dynamic anchor.
  • /bar is weird because it's a dynamic reference to a non-dynamic anchor, which is only valid because it reverts to behaving like $ref if used improperly. (This is covered in Add tests for $dynamicRef/$dynamicAnchor #462)
  • /baz is the weirdest because it doesn't even reference an anchor. It's not even pretending to be dynamic. Again, it's only valid because it reverts to behaving like $ref if used improperly. (@amosonn brought up this case in Add tests for refs with relative uris #457, but decided to make a separate issue to cover this case.)

@Julian
Copy link
Member

Julian commented Jan 8, 2022

@jdesrosiers I take the above as you suggesting to close this PR (with thanks to you @rjmill) but let me know if I misunderstood.

@Julian Julian closed this Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants