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

Metadata missing from the serialisation schema #954

Closed
aborgna-q opened this issue Apr 19, 2024 · 0 comments · Fixed by #1038
Closed

Metadata missing from the serialisation schema #954

aborgna-q opened this issue Apr 19, 2024 · 0 comments · Fixed by #1038
Assignees

Comments

@aborgna-q
Copy link
Collaborator

Rust defines a field for node metadata.

// TODO: Update to Vec<Option<Map<String,Value>>> to more closely
// match the internal representation.
#[serde(default)]
metadata: Vec<serde_json::Value>,

But this is missing from the schema.

"""A serializable representation of a Hugr."""
version: Literal["v1"] = "v1"
nodes: list[OpType]
edges: list[Edge]

While we are fixing this, we should probably address the TODO on the rust definition, and make the each node's metadata an Option<HashMap<String, _>>.

@doug-q doug-q self-assigned this May 1, 2024
@doug-q doug-q self-assigned this May 14, 2024
github-merge-queue bot pushed a commit that referenced this issue May 14, 2024
fixes #954.

We support deserializing HUGRs that do not have a `metadata` field.

We could optimise a little by not serializing a `metadata` field when
all node metadata fields are null, but for now we don't bother.

---------

Co-authored-by: Agustín Borgna <121866228+aborgna-q@users.noreply.github.com>
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

Successfully merging a pull request may close this issue.

2 participants