| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #pragma once
- #include <cstdlib>
- #include <string>
- #include <jvalidate/enum.h>
- 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 {
- size_t value = 0;
- };
- /**
- * @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 {
- size_t value = 0;
- };
- /**
- * @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;
- schema::Version for_version;
- bool is_assertion = false;
- };
- }
|