New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow override decode semantics through decode middleware #192
Comments
PS! As for what to do with the existing hook types, and functions, they would still work, but it would make sense (to me) to document them as deprecated; they really just do half the job, and they add complexity... |
Implementation wise it's probably not exactly as straight-farward as to wrap the entire Line 423 in 14428cd
Put the switch-case inside a new function, and pass it to the middlware func before calling. |
Thanks for the suggestion. I believe everything you want to do would be possible by composing decode hooks using the new #183 PR (I saw you responded there as well). In general, I'm a fan of middleware, but the aforementioned PR fits the existing "shape" of this project so I wanted to give that a shot. Let me know if that doesn't solve things for you! |
As shown by #191 and #115, it is not possible through the current hook system to specify override semantics because hooks only does pre-processing.
To my experience, middleware is always more powerful than hooks, because you can control the flow a lot better.
I think it would make sense to introduce a middleware for:
Example implementation stub:
With an example implementation for preserving
time.Time
as described in #191 (although this should probably be handled by default as well):The text was updated successfully, but these errors were encountered: