Skip to content

Commit

Permalink
jsonschema context first
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Jan 23, 2024
1 parent 5132d55 commit 0ba5111
Show file tree
Hide file tree
Showing 17 changed files with 219 additions and 226 deletions.
2 changes: 1 addition & 1 deletion doc/ref/jsonpath/json_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public:
}
return Json(arg0.as<double>() / arg1.as<double>());
}
);
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion doc/ref/jsonpath/jsonpath.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public:
}
return Json(arg0.as<double>() / arg1.as<double>());
}
);
);
}
};

Expand Down
2 changes: 1 addition & 1 deletion doc/ref/jsonpath/make_expression.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public:
}
return Json(arg0.as<double>() / arg1.as<double>());
}
);
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion examples/src/jsonpath_examples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ class my_custom_functions : public jsonpath::custom_functions<Json>
}
return Json(arg0.template as<double>() / arg1.template as<double>());
}
);
);
}
};

Expand Down
2 changes: 1 addition & 1 deletion include/jsoncons/json_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ namespace jsoncons {
forward<U2>(std::get<I2>(
std::declval<std::tuple<U2...>&>()))...)))
: key_(std::forward<U1>(std::get<I1>(a))...)
, value_(std::forward<U2>(std::get<I2>(b))...) {
, value_(std::forward<U2>(std::get<I2>(b))...) {
// make visual studio compiler happy about warning about unused a & b.
// Visual studio's key_value implementation disables warning 4100.
(void)a;
Expand Down
4 changes: 2 additions & 2 deletions include/jsoncons/source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ namespace jsoncons {
typename std::enable_if<std::is_convertible<value_type,typename Container::value_type>::value &&
extension_traits::has_reserve<Container>::value &&
extension_traits::has_data_exact<value_type*,Container>::value
, std::size_t>::type
, std::size_t>::type
read(Source& source, Container& v, std::size_t length)
{
std::size_t unread = length;
Expand All @@ -754,7 +754,7 @@ namespace jsoncons {
typename std::enable_if<std::is_convertible<value_type,typename Container::value_type>::value &&
extension_traits::has_reserve<Container>::value &&
!extension_traits::has_data_exact<value_type*, Container>::value
, std::size_t>::type
, std::size_t>::type
read(Source& source, Container& v, std::size_t length)
{
std::size_t unread = length;
Expand Down
2 changes: 1 addition & 1 deletion include/jsoncons_ext/jsonschema/common/keywords.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ namespace jsonschema {
type_validator(std::string&& schema_path,
std::vector<keyword_validator_type>&& type_mapping,
std::vector<std::string>&& expected_types
)
)
: keyword_validator_base<Json>(std::move(schema_path)),
type_mapping_(std::move(type_mapping)),
expected_types_(std::move(expected_types))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ namespace draft201909 {
},
"default": true
}
)");
)");

return sch;
}
Expand Down
204 changes: 101 additions & 103 deletions include/jsoncons_ext/jsonschema/draft201909/schema_parser_impl.hpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/jsoncons_ext/jsonschema/draft7/schema_draft7.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ namespace draft7 {
},
"default": true
}
)");
)");

return sch;
}
Expand Down
203 changes: 99 additions & 104 deletions include/jsoncons_ext/jsonschema/draft7/schema_parser_impl.hpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/jsoncons_ext/msgpack/msgpack_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ class basic_msgpack_parser : public ser_context
default:
if ((type > 0x8f && type <= 0x9f) // fixarray
|| (type > 0x7f && type <= 0x8f) // fixmap
)
)
{
return type & 0x0f;
}
Expand Down
2 changes: 1 addition & 1 deletion test/corelib/src/json_object_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ TEST_CASE("test_count")

json b = json::parse(
"{\"key1\":\"a value\",\"key1\":\"another value\"}"
);
);
CHECK(1 == b.count("key1"));
}

Expand Down
4 changes: 2 additions & 2 deletions test/corelib/src/json_traits_macro_functional_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ JSONCONS_ALL_MEMBER_NAME_TRAITS(ns::Company_AMN,
JSONCONS_N_GETTER_SETTER_NAME_TRAITS(ns::Employee_NGSN, 2,
(getName, setName, "employee_name"),
(getSurname, setSurname, "employee_surname")
)
)

JSONCONS_N_GETTER_SETTER_NAME_TRAITS(ns::Company_NGSN, 2,
(getName, setName, "company"),
Expand All @@ -1038,7 +1038,7 @@ JSONCONS_ALL_GETTER_SETTER_NAME_TRAITS(ns::Company_AGSN,
JSONCONS_N_CTOR_GETTER_NAME_TRAITS(ns::Employee_NCGN, 2,
(getName, "employee_name"),
(getSurname, "employee_surname")
)
)

JSONCONS_N_CTOR_GETTER_NAME_TRAITS(ns::Company_NCGN, 2,
(getName, "company"),
Expand Down
4 changes: 2 additions & 2 deletions test/jsonpath/src/jsonpath_stateful_allocator_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ TEST_CASE("jsonpath stateful allocator test")
{
CHECK((title.as<jsoncons::string_view>() == "Sword of Honour"));
}
);
);
}

SECTION("json_replace 1")
Expand Down Expand Up @@ -147,7 +147,7 @@ TEST_CASE("jsonpath stateful allocator test")
{
price = std::round(price.as<double>() - 1.0);
}
);
);

CHECK(8.0 == Approx(j["store"]["book"][0]["price"].as<double>()).epsilon(0.001));
CHECK(12.0 == Approx(j["store"]["book"][1]["price"].as<double>()).epsilon(0.001));
Expand Down
2 changes: 1 addition & 1 deletion test/jsonschema/src/jsonschema_defaults_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ TEST_CASE("jsonschema defaults tests")

json expected = json::parse(R"(
{"bar":"bad"}
)");
)");

CHECK(data == expected);
}
Expand Down
4 changes: 2 additions & 2 deletions test/jsonschema/src/jsonschema_draft7_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ TEST_CASE("jsonschema draft7 tests")
"minItems": 3,
"maxItems": 1
}
)");
)");

jsoncons::json instance = jsoncons::json::parse(R"(
[
Expand All @@ -201,7 +201,7 @@ TEST_CASE("jsonschema draft7 tests")
"z": 6.7
}
]
)");
)");

auto sch = jsoncons::jsonschema::make_schema(schema);
jsoncons::jsonschema::json_validator<jsoncons::json> validator(sch);
Expand Down

0 comments on commit 0ba5111

Please sign in to comment.