Open Leon0402 opened 2 years ago
Thanks for these ideas.
I haven't spent a lot of time thinking about exception-customization. I like your idea. Please issue a PR with an according change (also because I wouldn't know how to do it correctly).
Regarding constness, if there is something which is not const, but should be const, go ahead and make a PR. Especially if it improves the overall usage.
Hi,
I noticed that the library by default just throws std::invalid_argument here https://github.com/pboettch/json-schema-validator/blob/89ed13d76b95a8dc5de1a26af85231d7dff61e47/src/json-validator.cpp#L1302.
I don't want to catch std::invalid_argument. I know I can provide my own error handler, but it looks identical to the default one except that it throws a subclass of std::invalid_argument. So I wonder if the lib itself could not just do that by default?
A second thing I wondered: https://github.com/pboettch/json-schema-validator/blob/89ed13d76b95a8dc5de1a26af85231d7dff61e47/src/nlohmann/json-schema.hpp#L142
Couldn't this member function made const and therefore every argument of validate made const too? This would allow to pass RValue to validate().
So
validate(j, MyHandler {});