json/schema: additionalProperties, patternProperties
This commit is contained in:
parent
90552732d7
commit
0318c70709
@ -63,15 +63,27 @@ validate (json::tree::object &node,
|
|||||||
continue;
|
continue;
|
||||||
} catch (const json::key_error&)
|
} catch (const json::key_error&)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
if (additional != schema.cend ()) {
|
||||||
|
if (additional->second->is_boolean () && !additional->second->as_bool ())
|
||||||
|
throw json::schema_error ("additionalProperties");
|
||||||
|
|
||||||
|
validate (*p->second, additional->second->as_object ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pattern != schema.cend ())
|
if (pattern != schema.cend ()) {
|
||||||
not_implemented ();
|
for (auto &cond: pattern->second->as_object ()) {
|
||||||
|
std::regex expr (cond.first, std::regex_constants::ECMAScript);
|
||||||
|
|
||||||
if (additional != schema.cend ())
|
for (auto &props: node) {
|
||||||
not_implemented ();
|
if (std::regex_search (props.first, expr))
|
||||||
|
validate (*props.second, cond.second->as_object ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (schema.has ("dependencies"))
|
if (schema.has ("dependencies"))
|
||||||
not_implemented ();
|
not_implemented ();
|
||||||
|
Loading…
Reference in New Issue
Block a user