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

Remove JSON Pointer from the standard #444

Open
braingram opened this issue Sep 26, 2024 · 0 comments
Open

Remove JSON Pointer from the standard #444

braingram opened this issue Sep 26, 2024 · 0 comments
Assignees

Comments

@braingram
Copy link
Contributor

braingram commented Sep 26, 2024

The current standard includes internal and external references implemented using JSON pointers:
https://github.com/asdf-format/asdf-standard/blob/4f88f68abbb333f3b39207d63d89b3378644f729/docs/source/tree.rst#references

Internal references

Internal references are more easily and robustly handled using YAML anchors and aliases.

a: [1, 2, 3]
ref_a: {$ref: "#a"}

can be implemented with an anchor and alias (without the need for a JSON pointer)

a: &id001 [1, 2, 3]
ref_a: *id001

External references

Let's say we have have a file available as uri (where uri is some valid resolvable URI) that contains a (as above).

ref_a: {$ref: "uri#a"}

Note that there is no tag. This is a deviation from the typical annotation that ASDF uses to denote custom constructs (things that are not basic YAML).

Instead, an extension to the standard could implement an external reference (using it's own logic) via a tagged object:

ref_a !external_ref-1.0.0:
    uri: uri
    path: a

Summary

Internal references can already be made using the YAML standard. External references can be implemented via a custom tag (which more closely matches how other custom objects are handled in ASDF).

I propose that we remove JSON pointer from the standard. This would mean that files written with the new standard (let's say 2.0.0) would not be able to produce external references unless we:

  • add a new tag to the standard
  • implement and extension that provides a tag for external references

I think either approach could work and if we decide that dropping JSON pointer is worthwhile can weight the pros and cons of each.

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

No branches or pull requests

2 participants