Skip to content

Unknown tags and roundtripping #42

Description

@braingram

This issue is to discuss handling of unknown tags.

The specification has some description of implementation handling of unknown tags (either from unsupported asdf core schema versions or from custom extensions):
https://www.asdf-format.org/projects/asdf-standard/en/1.5.0/versioning.html#handling-version-mismatches
and near the end of:
https://www.asdf-format.org/projects/asdf-standard/en/1.5.0/tree.html#tags

Using the following example file:

#ASDF 1.0.0
#ASDF_STANDARD 1.6.0
%YAML 1.1
%TAG ! tag:stsci.edu:asdf/
--- !core/asdf-1.1.0
dict: !<asdf://example.com/foo/bar-1.0.0>
 key: 1
...

that contains a key "dict" with tag "asdf://example.com/foo/bar-1.0.0". Let's assume this tag comes from a custom extension registered by the user.

Reading the file using the current commit on main (3d5ef0c) with the following:

using ASDF
af = load("example.asdf")

produces an error:

ERROR: could not determine a constructor for the tag 'asdf://example.com/foo/bar-1.0.0'

Modifying the code to pass "extensions=true"

using ASDF
af = load("example.asdf"; extensions=true)

the file opens.

However is the tag lost?

If I write the file back out:

save("roundtrip.asdf", af)

the file no longer contains the tag:

#ASDF 1.0.0
#ASDF_STANDARD 1.2.0
# This is an ASDF file <https://asdf-standard.readthedocs.io/>
%YAML 1.1
%TAG ! tag:stsci.edu:asdf/
---
!core/asdf-1.1.0
dict:
  key: 1
asdf/library: !core/software-1.0.0
  name: "ASDF.jl"
  author: "Erik Schnetter <schnetter@gmail.com>"
  homepage: "https://github.com/JuliaAstro/ASDF.jl"
  version: "2.0.0"
...
#ASDF BLOCK INDEX
%YAML 1.1
---
[]
...

What would be required to:

  • present unknown (or known) tags to users (if not already supported)?
  • preserve unknown tags on read->write?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions