Open
Description
Hi,
I'm having an issue where a function taking parameters of int, std::tuple<double, double, double> seems like it is getting detected as int, json-object instead of int, json-array.
nlohmann-json maps std::pair and std::tuple to json-array.
Example:
When sending a jsonrpc request like
{"jsonrpc":"2.0","id":1,"method":"method","params":{"x":0, "y":[1.0, 2.0, 3.0]}}
to a C++ method with signature
bool method(const int x, const std::tuple<double, double, double>& y);
I get an error:
{"error":{"code":-32602,"message":"invalid parameter: must be object, but is array for parameter \"y\""},"id":1,"jsonrpc":"2.0"}
Adding this to typemapper.hpp to map std::tuples to json::value_t::array
template <typename... T>
constexpr json::value_t GetType(type<std::tuple<T...>>) {
return json::value_t::array;
}
Seemed to work, and the call was accepted.
Metadata
Metadata
Assignees
Labels
No labels