json_parameter_converter keeps
std::unordered_map<std::type_index, reader_fn> m_readers; // io/json_parameter_converter.h:82
vector_newton's zero_blocks and weighted_sum's terms are both std::vector<std::pair<std::string, std::string>>, so they resolve to the same reader. A malformed weighted_sum term reports
zero_blocks: each entry must be a [row, column] pair
which names a parameter of a different material.
Any future pair of parameters sharing a C++ type hits the same thing, and a reader cannot validate per parameter.
Fix
The reader already receives key; build the message from it rather than hard-coding zero_blocks. If per-parameter validation is wanted, key the registry on (type_index, key) with a fallback to the type-only reader.
All references are to main at 91bd26f.
json_parameter_converterkeepsstd::unordered_map<std::type_index, reader_fn> m_readers; // io/json_parameter_converter.h:82vector_newton'szero_blocksandweighted_sum'stermsare bothstd::vector<std::pair<std::string, std::string>>, so they resolve to the same reader. A malformedweighted_sumterm reportswhich names a parameter of a different material.
Any future pair of parameters sharing a C++ type hits the same thing, and a reader cannot validate per parameter.
Fix
The reader already receives
key; build the message from it rather than hard-codingzero_blocks. If per-parameter validation is wanted, key the registry on(type_index, key)with a fallback to the type-only reader.All references are to
mainat 91bd26f.