A meta-validator that allows to specify a custom validation function.
More...
#include <Validators.hpp>
|
template<typename Fn>
requires std::invocable<Fn, boost::json::value const&, std::string_view> |
| | CustomValidator (Fn &&fn) |
| | Constructs a custom validator from any supported callable.
|
| MaybeError | verify (boost::json::value const &value, std::string_view key) const |
| | Verify that the JSON value is valid according to the custom validation function stored.
|
A meta-validator that allows to specify a custom validation function.
◆ CustomValidator()
template<typename Fn>
requires std::invocable<Fn, boost::json::value const&, std::string_view>
| rpc::validation::CustomValidator::CustomValidator |
( |
Fn && | fn | ) |
|
|
inlineexplicit |
Constructs a custom validator from any supported callable.
- Template Parameters
-
- Parameters
-
| fn | The callable/function object |
◆ verify()
| MaybeError rpc::validation::CustomValidator::verify |
( |
boost::json::value const & | value, |
|
|
std::string_view | key ) const |
|
nodiscard |
Verify that the JSON value is valid according to the custom validation function stored.
- Parameters
-
| value | The JSON value representing the outer object |
| key | The key used to retrieve the tested value from the outer object |
- Returns
- Any compatible user-provided error if validation failed; otherwise no error is returned
The documentation for this class was generated from the following files:
- /__w/clio/clio/src/rpc/common/Validators.hpp
- /__w/clio/clio/src/rpc/common/Validators.cpp