| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #pragma once
- #include <string>
- #include <jvalidate/detail/string.h>
- #include <jvalidate/enum.h>
- #include <jvalidate/forward.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 {
- 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;
- schema::Version for_version;
- bool is_assertion;
- };
- }
|