30 auto ew = schemavalidator->try_validate(schema);
37 auto ew = validator->try_validate(value);
38 if (validator->try_validate(value)) {
44 TEST(JSONSchemaTest, TestMultipleOfInt) {
53 TEST(JSONSchemaTest, TestMultipleOfDouble) {
65 TEST(JSONSchemaTest, TestMinimumIntInclusive) {
75 TEST(JSONSchemaTest, TestMinimumIntExclusive) {
80 TEST(JSONSchemaTest, TestMaximumIntInclusive) {
90 TEST(JSONSchemaTest, TestMaximumIntExclusive) {
95 TEST(JSONSchemaTest, TestMinimumDoubleInclusive) {
105 TEST(JSONSchemaTest, TestMinimumDoubleExclusive) {
110 TEST(JSONSchemaTest, TestMaximumDoubleInclusive) {
120 TEST(JSONSchemaTest, TestMaximumDoubleExclusive) {
125 TEST(JSONSchemaTest, TestInvalidSchema) {
133 schema =
dynamic::object(
"minLength",
"invalid")(
"maxLength",
"invalid");
138 TEST(JSONSchemaTest, TestMinimumStringLength) {
145 TEST(JSONSchemaTest, TestMaximumStringLength) {
152 TEST(JSONSchemaTest, TestStringPattern) {
158 TEST(JSONSchemaTest, TestMinimumArrayItems) {
165 TEST(JSONSchemaTest, TestMaximumArrayItems) {
173 TEST(JSONSchemaTest, TestArrayUniqueItems) {
187 TEST(JSONSchemaTest, TestArrayItems) {
193 TEST(JSONSchemaTest, TestArrayAdditionalItems) {
203 TEST(JSONSchemaTest, TestArrayNoAdditionalItems) {
206 "additionalItems",
false);
210 TEST(JSONSchemaTest, TestArrayItemsNotPresent) {
215 TEST(JSONSchemaTest, TestRef) {
225 TEST(JSONSchemaTest, TestRecursiveRef) {
238 TEST(JSONSchemaTest, TestDoubleRecursiveRef) {
253 TEST(JSONSchemaTest, TestInfinitelyRecursiveRef) {
259 TEST(JSONSchemaTest, TestRequired) {
266 TEST(JSONSchemaTest, TestMinMaxProperties) {
280 TEST(JSONSchemaTest, TestProperties) {
292 TEST(JSONSchemaTest, TestPropertyAndPattern) {
302 TEST(JSONSchemaTest, TestPropertyDependency) {
310 TEST(JSONSchemaTest, TestSchemaDependency) {
326 TEST(JSONSchemaTest, TestType) {
332 TEST(JSONSchemaTest, TestTypeArray) {
339 TEST(JSONSchemaTest, TestAllOf) {
349 TEST(JSONSchemaTest, TestAnyOf) {
360 TEST(JSONSchemaTest, TestOneOf) {
371 TEST(JSONSchemaTest, TestNot) {
381 TEST(JSONSchemaTest, TestMetaSchema) {
382 const char* example1 =
385 \"title\": \"Example Schema\", \ 386 \"type\": \"object\", \ 389 \"type\": \"string\" \ 392 \"type\": \"string\" \ 395 \"description\": \"Age in years\", \ 396 \"type\": \"integer\", \ 400 \"required\": [\"firstName\", \"lastName\"] \ 409 TEST(JSONSchemaTest, TestProductSchema) {
410 const char* productSchema =
413 \"$schema\": \"http://json-schema.org/draft-04/schema#\", \ 414 \"title\": \"Product\", \ 415 \"description\": \"A product from Acme's catalog\", \ 416 \"type\": \"object\", \ 419 \"description\": \"The unique identifier for a product\", \ 420 \"type\": \"integer\" \ 423 \"description\": \"Name of the product\", \ 424 \"type\": \"string\" \ 427 \"type\": \"number\", \ 429 \"exclusiveMinimum\": true \ 432 \"type\": \"array\", \ 434 \"type\": \"string\" \ 437 \"uniqueItems\": true \ 440 \"required\": [\"id\", \"name\", \"price\"] \ 446 \"name\": \"A green door\", \ 448 \"tags\": [\"home\", \"green\"] \
static ObjectMaker object()
dynamic parseJson(StringPiece range)
std::shared_ptr< Validator > makeSchemaValidator()
std::unique_ptr< Validator > makeValidator(const dynamic &schema)
#define ASSERT_THROW(statement, expected_exception)
static void array(EmptyArrayTag)
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
#define ASSERT_FALSE(condition)
#define ASSERT_TRUE(condition)
TEST(SequencedExecutor, CPUThreadPoolExecutor)
bool check(const dynamic &schema, const dynamic &value, bool check=true)