Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions include/rfl/yaml/Reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,19 @@ struct Reader {
return Error("Recursive YAML alias detected.");
}
for (const auto& p : _obj.node_) {
std::string_view key;
try {
const auto k = p.first.as<std::string>();
_object_reader.read(std::string_view(k), InputVarType(p.second));
} catch (std::exception& e) {
continue;
if (p.first.IsScalar()) {
key = p.first.Scalar();
} else if (p.first.IsNull()) {
key = "null";
} else {
return Error("YAML mapping key must be a scalar.");
}
} catch (const std::exception& e) {
return Error(e.what());
}
_object_reader.read(key, InputVarType(p.second));
}
return std::nullopt;
}
Expand Down
Loading