22#include <boost/json/array.hpp>
23#include <boost/json/object.hpp>
24#include <boost/json/value.hpp>
29namespace rpc::validation {
38template <
typename Expected>
39[[nodiscard]]
static bool
40checkType(boost::json::value
const& value)
42 auto hasError =
false;
43 if constexpr (std::is_same_v<Expected, bool>) {
44 if (not value.is_bool())
46 }
else if constexpr (std::is_same_v<Expected, std::string>) {
47 if (not value.is_string())
49 }
else if constexpr (std::is_same_v<Expected, double> or std::is_same_v<Expected, float>) {
50 if (not value.is_double())
52 }
else if constexpr (std::is_same_v<Expected, boost::json::array>) {
53 if (not value.is_array())
55 }
else if constexpr (std::is_same_v<Expected, boost::json::object>) {
56 if (not value.is_object())
58 }
else if constexpr (std::is_convertible_v<Expected, uint64_t> or std::is_convertible_v<Expected, int64_t>) {
59 if (not value.is_int64() && not value.is_uint64())
62 if constexpr (std::is_unsigned_v<Expected>) {
63 if (value.is_int64() and value.as_int64() < 0)