Skip to content

Conversation

@JustinPrivitera
Copy link
Member

@JustinPrivitera JustinPrivitera commented Dec 30, 2025

Resolves #1313

  • Additionally fixes a longstanding bug preventing explicit length 0 in yaml schema

  • Additionally fixes a longstanding bug where empty objects or lists were not written correctly to yaml schema.

  • TODO need to understand how to choose to save conduit bin yaml. Will this be a new protocol? Something we prefer? What do we use to make this choice?

  • TODO need to add tests in t_conduit_node_save_load.cpp

@JustinPrivitera JustinPrivitera marked this pull request as ready for review December 30, 2025 00:45
Copy link
Member

@cyrush cyrush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this! Please add a note to the changelog.

Question about detection logic:

Should we check if the json or yaml files exists before parsing to avoid an exception to detect the yaml case?

}
// support explicit length 0 in a schema
else if (fetch_yaml_node_from_object_by_name(yaml_doc, yaml_node, "number_of_elements"))
else if (! fetch_yaml_node_from_object_by_name(yaml_doc, yaml_node, "number_of_elements"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding this!

Schema s;
std::string ifschema = ibase + "_json";
std::string ifschema_json = ibase + "_json";
std::string ifschema_yaml = ibase + "_yaml";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we try to look for the file before parsing?

We may not have had the "file exists" helper when the json schema read was first implemented.

std::string error_message;

std::string ifschema_json = stream_path + "_json";
std::string ifschema_yaml = stream_path + "_yaml";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same q about checking if the file exists before trying to parse, to avoid exceptions in the case where we have yaml

size_t nchildren = children().size();
for(size_t i=0; i < nchildren;i++)
if (nchildren == 0)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing this

for(size_t i=0; i < nchildren;i++)
if (nchildren == 0)
{
os << "[]" << eoe;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and thanks for fixing this!

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 this pull request may close these issues.

YAML schema TODOs

3 participants