diff --git a/src/json-schema-validator.hpp b/src/json-schema-validator.hpp index a27ac4a..d15a11e 100644 --- a/src/json-schema-validator.hpp +++ b/src/json-schema-validator.hpp @@ -4,7 +4,7 @@ #include #include -#include +#include // make yourself a home - welcome to nlohmann's namespace namespace nlohmann @@ -198,9 +198,13 @@ class json_validator const auto &uniqueItems = schema.find("uniqueItems"); if (uniqueItems != schema.end()) if (uniqueItems.value() == true) { - std::unordered_set array_to_set; + std::set array_to_set; for (auto v : instance) { - array_to_set.insert(v); + auto ret = array_to_set.insert(v); + if (ret.second == false) + throw std::out_of_range(name + " should have only unique items."); + } + } } if (instance.size() != array_to_set.size())