![]() |
boost::taar::handler::constraints — Declarative validation rules for one argument.
// In header: <boost/taar/handler/constrained.hpp> struct constraints { // public member functions void apply_to(boost::json::object &) const; // public data members std::optional< double > minimum; std::optional< double > maximum; std::optional< double > exclusive_minimum; std::optional< double > exclusive_maximum; std::optional< std::size_t > min_length; std::optional< std::size_t > max_length; std::optional< std::size_t > min_items; std::optional< std::size_t > max_items; std::string pattern; // ECMAScript regular expression the whole string must match. std::vector< std::string > one_of; // Allowed string values (enum). std::string format; // JSON Schemaformat, e.g. "email" or "date-time". boost::json::value example; // Rendered asexamples: [example]when not null. };
Checked at request time against the converted value (after the cast to the callable's parameter type) and emitted as JSON Schema keywords in OpenAPI parameters and MCP inputSchema. Rules that do not apply to the value's type are ignored: numeric bounds for numbers, length and pattern and one_of for strings, item counts for sequences. format and example are documentation only.