Accept integer as a number in a list of types

This commit is contained in:
ronen barzel 2017-01-31 14:12:46 +00:00
parent d0781a8a45
commit bdd239a9c7

View File

@ -133,9 +133,14 @@ void validate_type(const json &schema, const std::string &expected_type, const s
// any of the types in this array // any of the types in this array
if (type_instance.type() == json::value_t::array) { if (type_instance.type() == json::value_t::array) {
if (std::find(type_instance.begin(), if ((std::find(type_instance.begin(),
type_instance.end(), type_instance.end(),
expected_type) != type_instance.end()) expected_type) != type_instance.end())
||
(expected_type == "integer" &&
std::find(type_instance.begin(),
type_instance.end(),
"number") != type_instance.end()))
return; return;
std::ostringstream s; std::ostringstream s;