#pragma once #include #include #include namespace jvalidate::constraint { /** * @brief A constraint on the String type with the following characteristic(s): * @code{.cpp} * arg.size() >= value * @endcode * * https://json-schema.org/draft/2020-12/json-schema-validation#section-6.3.2 */ struct MinLengthConstraint { int64_t value; }; /** * @brief A constraint on the String type with the following characteristic(s): * @code{.cpp} * arg.size() <= value * @endcode * * https://json-schema.org/draft/2020-12/json-schema-validation#section-6.3.1 */ struct MaxLengthConstraint { int64_t value; }; /** * @brief A constraint on the String type with the following characteristic(s): * @code{.py} * re.match(regex, arg) * @endcode * * https://json-schema.org/draft/2020-12/json-schema-validation#section-6.3.3 */ struct PatternConstraint { std::string regex; }; /** * @brief A constraint on the String type that describes a string format using * a human friendly name. The implementation of the regular expression, ABNF * grammer, or state-machine parser that checks the validity of the string * (for the standard list of formats respected by the JSON schema RPC) is * implemented in {@see include/jvalidate/format.h}. * * https://json-schema.org/draft/2020-12/json-schema-validation#section-7 */ struct FormatConstraint { std::string format; bool is_assertion; }; }