asdf icon indicating copy to clipboard operation
asdf copied to clipboard

Resolve JSON references that point to things in-tree automatically

Open Cadair opened this issue 1 year ago • 4 comments

The standard says:

The YAML 1.1 standard itself also provides a method for internal references called “anchors” and “aliases”. It does not, however, support external references. While ASDF does not explicitly disallow YAML anchors and aliases, since it explicitly supports all of YAML 1.1, their use is discouraged in favor of the more flexible JSON Pointer/JSON Reference standard described above.

however, the Python library makes this pretty hard to follow. If you use JSON References then they will not be resolved automatically making their use in things which get passed to a Converter class pretty troublesome. It would be good if in-tree references were automatically resolved and then it would be transparent to the converter.

cc @seanhess

Cadair avatar Sep 26 '24 14:09 Cadair

Can you use an anchor and alias? These are automatically resolved.

braingram avatar Sep 26 '24 15:09 braingram

Hey there, yeah the plan is to switch to use anchors instead. How closely tied is the asdf python library to the standard? If references aren't fully supported by the python lib (which I imagine is by far the most used) it might make sense to change that paragraph in the standard docs, and encourage reference use only for external references?

seanhess avatar Sep 26 '24 15:09 seanhess

Thanks!

At the moment the python library and standard are pretty tied together (since the python library is the most complete implementation of the standard).

I'm surprised to see the standard discourage anchors and aliases. I opened a PR to remove that statement.

braingram avatar Sep 26 '24 15:09 braingram

Sounds good, thanks!

seanhess avatar Sep 26 '24 15:09 seanhess