Closed omar-mohamed-khallaf closed 1 week ago
Would it be possible to implement the missing function in the trait definition?
Extending,
Also it seems we are missing this function as a requirement for the json array
Is front()
the missing function for the second issue, or something else?
Yes, front()
Should be checked.
Might also be worth checking if the unit tests are missing a case 🤔 we just dint run the unit tests with JSON libraries https://github.com/Thalhammer/jwt-cpp/blob/83703d718a180b178bfecac0f12355358d04181b/.github/workflows/traits.yml#L59
Notes:
https://github.com/Thalhammer/jwt-cpp/blob/83703d718a180b178bfecac0f12355358d04181b/example/jwks-verify.cpp#L111 https://github.com/Thalhammer/jwt-cpp/blob/83703d718a180b178bfecac0f12355358d04181b/tests/JwksTest.cpp#L117
Yes,
front()
Should be checked.
I added this line !std::is_same<decltype(std::declval<array_type>().front()), void>::value
to is_valid_json_array
, is it ok?
std::is_member_function_pointer
had problems resolving the overloaded front
function, and I had no idea how to solve it.
Looks like a type error in the Danieljson changes from the CI
Something is wrong in the current implementation.
static object_type as_object(const json& val) {
if (val.type() != jsoncons::json_type::object_value) throw std::bad_cast();
return object_type(val.object_value());
}
static array_type as_array(const json& val) {
if (val.type() != jsoncons::json_type::array_value) throw std::bad_cast();
return val.array_value();
}
These two functions use val.object_value()
and val.array_value()
, but I can't find any reference to these functions in the jsoncons library.
The problem existed before the current modifications. Should it be fixed in a new PR?
Replace
front()
with[0]
inget_x5c_key_value
as front is not supported by jsoncpp on array types.