json/schema: add exclusiveMin/Max

This commit is contained in:
Danny Robson 2018-07-12 16:08:36 +10:00
parent d48e36ffd5
commit 0629ba07cd
11 changed files with 14 additions and 0 deletions

View File

@ -33,6 +33,8 @@ base::instantiate (std::string const &name, ::json::tree::node const &def)
if (name == "minLength") return std::make_unique<min_length> (def);
if (name == "maxLength") return std::make_unique<max_length> (def);
if (name == "minimum") return std::make_unique<minimum> (def);
if (name == "exclusiveMaximum") return std::make_unique<exclusive_maximum> (def);
if (name == "exclusiveMinimum") return std::make_unique<exclusive_minimum> (def);
if (name == "maximum") return std::make_unique<maximum> (def);
if (name == "properties") return std::make_unique<properties> (def);
if (name == "patternProperties") return std::make_unique<pattern_properties> (def);

View File

@ -73,3 +73,5 @@ inequality<ComparatorT>::describe (std::ostream &os) const
///////////////////////////////////////////////////////////////////////////////
template class util::json::schema::constraint::inequality<std::less_equal>;
template class util::json::schema::constraint::inequality<std::greater_equal>;
template class util::json::schema::constraint::inequality<std::less>;
template class util::json::schema::constraint::inequality<std::greater>;

View File

@ -46,4 +46,6 @@ namespace util::json::schema::constraint {
using minimum = inequality<std::greater_equal>;
using maximum = inequality<std::less_equal>;
using exclusive_minimum = inequality<std::greater>;
using exclusive_maximum = inequality<std::less>;
}

View File

@ -0,0 +1 @@
{ "type": "integer", "exclusiveMinimum": 3 }

View File

@ -0,0 +1 @@
{ "type": "integer", "exclusiveMaximum": 3 }