tgockel / json-voorhees

A killer modern C++ library for interacting with JSON.
http://tgockel.github.io/json-voorhees/
Apache License 2.0
128 stars 18 forks source link

Type adapter `post_extract` should provide source JSON #134

Open tgockel opened 4 years ago

tgockel commented 4 years ago

The post_extract function on serialization DSL adapters currently only takes the jsonv::extraction_context and the extracted T. If the post-extract function needs to do something like throw an exception, it is common to want to include the source JSON in the message. Since adapter_builder<T>::adapter_impl::create has access to the source JSON anyway, this should be easy to provide.

adapter_builder<T>::post_extract_func should be changed to std::function<T (const extraction_context&, T&&, const value&)>.