Skip to content

Support core/constant schema #217

Description

@embray

The ASDF Standard provides a core/constant schema: https://www.asdf-format.org/projects/asdf-standard/en/latest/generated/stsci.edu/asdf/core/constant-1.0.0.html

I'm a little unclear on its use case, though it appears to be primarily informational. The Python asdf package implements it as a Constant type which provides a "read-only" wrapper around the tagged value. The use of scare-quotes comes from the fact that any YAML value can be tagged !core/constant-X.Y-Z, including sequences and mappings, though the Python implementation does not make any effort to convert these to read-only types (e.g. a tuple and frozendict respectively). It probably should do that, though in practice this is probably most often used in conjunction with scalar values.

The important thing here is that libasdf supports round-tripping a value tagged !core/constant when reading in the tree and writing it back out again, as well as inserting constants into the tree. Most likely as a thin wrapper around an asdf_value_t; schematically:

typedef struct {
    const asdf_value_t value;
} asdf_constant_t;

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood first issueGood for newcomersstandard-complianceMissing feature required to meet fully compliance with the ASDF standard

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions