Skip to content

Assumed tag for file metadata leads to error #2063

Description

@braingram

The following file:

#ASDF 1.0.0
#ASDF_STANDARD 1.6.0
%YAML 1.1
%TAG ! tag:stsci.edu:asdf/
--- !core/asdf-1.1.0
history:
  extensions:
    - extension_class: "asdf.extension._manifest.ManifestExtension"
      extension_uri: "asdf://asdf-format.org/core/extensions/core-1.6.0"
      manifest_software:
        name: "asdf_standard"
        version: "1.1.1"
      software:
        name: "asdf"
        version: "4.1.0"
...

is valid as the asdf-1.1.0 schema:
https://github.com/asdf-format/asdf-standard/blob/main/resources/stable/schemas/stsci.edu/asdf/core/asdf-1.1.0.yaml
doesn't require that the history/extensions items have a specific tag (even if we ignore asdf-format/asdf-standard#436). This can be seen by loading and validating the above file (example.asdf) via:

import asdf
asdf.schema.validate(asdf.util.load_yaml("example.asdf", tagged=True))

However if we try to load the file with asdf.open we encounter an error:

File ~/projects/src/asdf/asdf/_asdf.py:278, in AsdfFile._check_extensions(self, tree, strict)
    276 installed = None
    277 for ext in self._user_extensions + self._plugin_extensions:
--> 278     if (extension.extension_uri is not None and extension.extension_uri == ext.extension_uri) or (
    279         extension.extension_uri is None and extension.extension_class in ext.legacy_class_names
    280     ):
    281         installed = ext
    282         break

AttributeError: 'dict' object has no attribute 'extension_uri'

since the python library assumes the extension objects are tagged (and then deserialized to a custom object).

This might extend to other objects/tags in the standard which are linked to the asdf object schema (which uses refs) including:

  • history_entry
  • software (which is also referenced in history_entry)

The expectation here is that these are valid files and the python library shouldn't produce an error on loading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions