Skip to content

YAML doesn't round-trip generics #715

Description

@zewt
    string s = rfl::yaml::write("On"s);
    auto g = rfl::yaml::read<rfl::Generic>(s);
    printf("%s\n", rfl::json::write(g).c_str());

This prints true instead of "On", and the generic contains a bool instead of the string. This happens at least with bool-looking strings and strings containing numbers.

This makes rfl::Generic mostly unusable with yaml, since random strings deserialize to a different type than went in.

I don't know if this is a problem with yaml-cpp itself or how reflect-cpp is using it. Since I only know about this from the reflect-cpp side (I don't know anything about yaml-cpp) I figured this was the better place to bring it up. It's a bit of an ugly surprise waiting for anyone using rfl::Generic with YAML--not sure if I have any real workaround other than switching to JSON.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions