Skip to content

JSON reader registry is keyed on type_index, so parameters of the same C++ type share a reader and its error text #66

Description

@petlenz

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.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions