Skip to content
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

Tree containing id causes reference resolution failure. #1715

Closed
braingram opened this issue Dec 21, 2023 · 1 comment · Fixed by #1716
Closed

Tree containing id causes reference resolution failure. #1715

braingram opened this issue Dec 21, 2023 · 1 comment · Fixed by #1716
Milestone

Comments

@braingram
Copy link
Contributor

Description of the problem

The existence of a dictionary with a key id anywhere "higher" in the tree than a reference causes the reference to fail to resolve.

Example of the problem

import asdf


other_tree = {
    'thing': 42,
}

tree = {
    'myref': {
        '$ref': 'external.asdf#/thing'
    }
}

asdf.AsdfFile(other_tree).write_to('external.asdf')

uri=asdf.util.filepath_to_url(os.path.abspath('main.asdf'))
af = asdf.AsdfFile(tree, uri=uri)
af.resolve_references()
assert af['myref'] == 42

tree['id'] = 'bogus'
af = asdf.AsdfFile(tree, uri=uri)
af.resolve_references()  # raises ValueError

System information

asdf version: main
python version: 3.10
operating system: mac osx

@WilliamJamieson
Copy link
Contributor

Issues like this are probably one of the reasons the more recent JSON-schema drafts have moved to using $id instead of id, see https://json-schema.org/draft-06/draft-wright-json-schema-01#rfc.section.9.2

This might indicate that ASDF should move towards moving its schema specification draft forward to a later draft.

@braingram braingram modified the milestones: 3.1.0, 3.2.0 Feb 27, 2024
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 a pull request may close this issue.

2 participants