38 {
39 SYS_ASSERT(snapshot.is_object(), snapshot_validation_exception,
40 "Variant snapshot is not an object");
42
44 "Variant snapshot has no version");
45
46 const auto&
version = o[
"version"];
48 "Variant snapshot version is not an integer");
49
51 "Variant snapshot is an unsuppored version. Expected : ${expected}, Got: ${actual}",
52 ("expected", current_snapshot_version)("actual",o["version"].as_uint64()));
53
55 "Variant snapshot has no sections");
56
57 const auto& sections = o["sections"];
58 SYS_ASSERT(sections.is_array(), snapshot_validation_exception,
"Variant snapshot sections is not an array");
59
60 const auto& section_array = sections.get_array();
61 for( const auto& section: section_array ) {
62 SYS_ASSERT(section.is_object(), snapshot_validation_exception,
"Variant snapshot section is not an object");
63
64 const auto& so = section.get_object();
65 SYS_ASSERT(so.contains(
"name"), snapshot_validation_exception,
66 "Variant snapshot section has no name");
67
68 SYS_ASSERT(so[
"name"].is_string(), snapshot_validation_exception,
69 "Variant snapshot section name is not a string");
70
71 SYS_ASSERT(so.contains(
"rows"), snapshot_validation_exception,
72 "Variant snapshot section has no rows");
73
74 SYS_ASSERT(so[
"rows"].is_array(), snapshot_validation_exception,
75 "Variant snapshot section rows is not an array");
76 }
77}
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
An order-preserving dictionary of variants.
bool contains(const char *key) const
unsigned __int64 uint64_t