@@ -429,26 +429,25 @@ enum logical_combination_types {
429
429
class logical_combination_error_handler : public error_handler
430
430
{
431
431
public:
432
- struct error_entry
433
- {
432
+ struct error_entry {
434
433
json::json_pointer ptr_;
435
434
json instance_;
436
435
std::string message_;
437
436
};
438
437
439
438
std::vector<error_entry> error_entry_list_;
440
-
439
+
441
440
void error (const json::json_pointer &ptr, const json &instance, const std::string &message) override
442
441
{
443
- error_entry_list_.push_back (error_entry{ ptr, instance, message });
442
+ error_entry_list_.push_back (error_entry{ptr, instance, message});
444
443
}
445
444
446
- void propagate (error_handler& e, const std::string& prefix) const
445
+ void propagate (error_handler & e, const std::string & prefix) const
447
446
{
448
- for (const error_entry& entry : error_entry_list_)
447
+ for (const error_entry & entry : error_entry_list_)
449
448
e.error (entry.ptr_ , entry.instance_ , prefix + entry.message_ );
450
449
}
451
-
450
+
452
451
operator bool () const { return !error_entry_list_.empty (); }
453
452
};
454
453
@@ -463,7 +462,7 @@ class logical_combination : public schema
463
462
logical_combination_error_handler error_summary;
464
463
465
464
for (std::size_t index = 0 ; index < subschemata_.size (); ++index ) {
466
- const std::shared_ptr<schema>& s = subschemata_[index ];
465
+ const std::shared_ptr<schema> & s = subschemata_[index ];
467
466
logical_combination_error_handler esub;
468
467
auto oldPatchSize = patch.get_json ().size ();
469
468
s->validate (ptr, instance, patch, esub);
@@ -513,8 +512,7 @@ const std::string logical_combination<oneOf>::key = "oneOf";
513
512
template <>
514
513
bool logical_combination<allOf>::is_validate_complete(const json &, const json::json_pointer &, error_handler &e, const logical_combination_error_handler &esub, size_t , size_t current_schema_index)
515
514
{
516
- if (esub)
517
- {
515
+ if (esub) {
518
516
e.error (esub.error_entry_list_ .front ().ptr_ , esub.error_entry_list_ .front ().instance_ , " at least one subschema has failed, but all of them are required to validate - " + esub.error_entry_list_ .front ().message_ );
519
517
esub.propagate (e, " [combination: allOf / case#" + std::to_string (current_schema_index) + " ] " );
520
518
}
@@ -568,12 +566,12 @@ class type_schema : public schema
568
566
}
569
567
570
568
if (!seen_in_enum)
571
- e.error (ptr, instance, " instance not found in required enum" );
569
+ e.error (ptr, instance, " instance not found in required enum " + enum_. second . dump () );
572
570
}
573
571
574
572
if (const_.first &&
575
573
const_.second != instance)
576
- e.error (ptr, instance, " instance not const" );
574
+ e.error (ptr, instance, " instance not const value ' " + const_. second . dump () + " ' " );
577
575
578
576
for (auto l : logic_)
579
577
l->validate (ptr, instance, patch, e);
0 commit comments