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
add runtime.WithUnmarshalerOption #1228
add runtime.WithUnmarshalerOption #1228
Conversation
e987aae
to
f7bca4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fantastic, thank you Ayush for starting this. Just a few grammatical thoughts, but this is basically exactly what I had in mind. Very impressed!
Please rebase on v2 |
Co-Authored-By: Johan Brandhorst <johan.brandhorst@gmail.com>
8499bcd
to
2250922
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@johanbrandhorst Done. |
Codecov Report
@@ Coverage Diff @@
## v2 #1228 +/- ##
==========================================
+ Coverage 53.99% 54.13% +0.13%
==========================================
Files 42 42
Lines 4369 4391 +22
==========================================
+ Hits 2359 2377 +18
- Misses 1752 1754 +2
- Partials 258 260 +2
Continue to review full report at Codecov.
|
@johanbrandhorst this will need your consent because you're the co-author of fef9392 and 35d0c34 |
Co-Authored-By: Johan Brandhorst <johan.brandhorst@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had another think about this, and I wonder if we need the two separate interfaces? What use case are we trying to support by allowing the user to configure the marshaler and unmarshaler separately? Would it be possible to keep it as a single interface and accomplish the goals we want?
If someone only wants to implement a custom unmarshaler, a single interface will force them to implement stubs for the |
That is true, but in the grand scheme of things, I think this are simpler with a single interface, and in the use case where a user only wants to implement the unmarshaling part, they can simply embed the default marshaler. I think most cases will be about changing the marshaler, and the user will modify embed the default marshaller to avoid modifying the unmarshalling. It also makes me wonder if we already had this capability, why did we add |
I believe we concluded that this change was not necessary in the end, so I'm closing it. Looking forward to future contributions from you Ayush :). |
This adds
runtime.WithUnmarshalOption
to allow use of a custom Unmarshaller.runtime.WithUnmarshalOption
runtime.Marshaler
intoruntime.Marshaler
andruntime.Unmarshaler
runtime.Marshaler
andruntime.Unmarshaler
acceptcontext.Context
Related: #1226