Skip to content

Commit

Permalink
issue #521 bignum.json tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Jun 6, 2024
1 parent 5da01d5 commit f7024ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
18 changes: 12 additions & 6 deletions include/jsoncons_ext/jsonschema/common/keyword_validators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2175,7 +2175,7 @@ namespace jsonschema {
}
break;
case json_schema_type::string: // OK
if (instance.is_string())
if (instance.is_string() && instance.tag() != semantic_tag::bigint)
{
is_type_found = true;
}
Expand All @@ -2187,12 +2187,18 @@ namespace jsonschema {
}
break;
case json_schema_type::integer:
if (instance.is_number())
std::cout << instance << ", " << instance.tag() << "\n";
if (instance.is_int64() || instance.is_uint64())
{
if (instance.template is_integer<int64_t>() || (instance.is_double() && static_cast<double>(instance.template as<int64_t>()) == instance.template as<double>()))
{
is_type_found = true;
}
is_type_found = true;
}
else if (instance.is_double() && static_cast<double>(instance.template as<int64_t>()) == instance.template as<double>())
{
is_type_found = true;
}
else if (instance.is_string() && instance.tag() == semantic_tag::bigint)
{
is_type_found = true;
}
break;
case json_schema_type::number:
Expand Down
1 change: 1 addition & 0 deletions test/jsonschema/src/jsonschema_draft202012_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ TEST_CASE("jsonschema draft2020-12 tests")
// jsonschema::evaluation_options{}.default_version(jsonschema::schema_version::draft202012()).
// require_format_validation(true));
//jsonschema_tests("./jsonschema/JSON-Schema-Test-Suite/tests/draft2020-12/vocabulary.json");
jsonschema_tests("./jsonschema/JSON-Schema-Test-Suite/tests/draft2020-12/optional/bignum.json");
}
//#if 0
SECTION("more_tests")
Expand Down

0 comments on commit f7024ec

Please sign in to comment.