From 8a87818965443ca2e635063193e0aeb86a1b3216 Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Wed, 28 Dec 2016 13:47:48 +0100 Subject: [PATCH] validator: handle special case of an integer is a number --- src/json-validator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/json-validator.cpp b/src/json-validator.cpp index 71fa26d..2668ce1 100644 --- a/src/json-validator.cpp +++ b/src/json-validator.cpp @@ -142,7 +142,8 @@ void validate_type(const json &schema, const std::string &expected_type, const s throw std::invalid_argument(s.str()); } else { // type_instance is a string - if (type_instance == expected_type) + if (type_instance == expected_type || + (type_instance == "number" && expected_type == "integer")) return; throw std::invalid_argument(type_instance.get() + " is not a " + expected_type + " for " + name);