User parameter value json fix (#44420)
* UserParameterValue transforms wrapped to properly escape string vals The `json-in` and `json-out` functions used for toucan model transforms do not perform any string escaping logic. This makes sense as we don't want to make assumptions about the shape of data flowing in/out of the db. But, this did mean that for the User paramter values table, string values were causing an error to be logged. This doesn't break anything, as the function will still correctly return the string, but it can clutter up logs. So, this PR wraps all incoming values in a map and unwraps it for outgoing values. * Add migration to wrap existing user param values with ::wrapper key Since the in/out transform for UserParameterValues is updated, we need to migrate any existing values to have this wrapping. * Simplify the solution to the problem. Since we're already getting what we need from the json-in/json-out *except* that it's logging a parse error, we can create a json-out that works the same way (tries to parse and returns the string as-is if it fails) without logging an error at all. * take away the arg and keywordize inside the json-out fn * remove irrelevant comment Signed-off-by:Adam James <adam.vermeer2@gmail.com> * Add a little more test coverage for different value types * faster test thanks to Dan! * Add a comment about the data being tested --------- Signed-off-by:
Adam James <adam.vermeer2@gmail.com>
Please register or sign in to comment