Skip to content
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

Support for deserializing params *object* as single first parameter #347

Merged
merged 9 commits into from
Nov 4, 2019

Conversation

milopezc
Copy link
Contributor

@milopezc milopezc commented Oct 17, 2019

Closes #289

@codecov-io
Copy link

codecov-io commented Oct 17, 2019

Codecov Report

Merging #347 into master will decrease coverage by 3.43%.
The diff coverage is 78.94%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #347      +/-   ##
==========================================
- Coverage   90.56%   87.13%   -3.44%     
==========================================
  Files          37       37              
  Lines        2438     2464      +26     
  Branches        0      484     +484     
==========================================
- Hits         2208     2147      -61     
- Misses        230      232       +2     
- Partials        0       85      +85
Impacted Files Coverage Δ
...StreamJsonRpc/Reflection/JsonRpcMethodAttribute.cs 100% <100%> (ø) ⬆️
src/StreamJsonRpc/JsonMessageFormatter.cs 87.26% <100%> (-5.88%) ⬇️
...reamJsonRpc/Reflection/MethodSignatureAndTarget.cs 66.66% <100%> (ø) ⬆️
src/StreamJsonRpc/Reflection/MethodSignature.cs 63.63% <55.55%> (-14.15%) ⬇️
src/StreamJsonRpc/JsonRpc.cs 90.97% <63.63%> (-2.33%) ⬇️
src/StreamJsonRpc/RequestId.cs 77.27% <0%> (-18.19%) ⬇️
src/StreamJsonRpc/StreamMessageHandler.cs 88.23% <0%> (-11.77%) ⬇️
src/StreamJsonRpc/RequestIdJsonConverter.cs 77.77% <0%> (-11.12%) ⬇️
...pc/Reflection/MessageFormatterDuplexPipeTracker.cs 86.84% <0%> (-7.9%) ⬇️
src/StreamJsonRpc/Reflection/TargetMethod.cs 89.39% <0%> (-7.58%) ⬇️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2e50b63...8753b1e. Read the comment docs.

@AArnott AArnott self-requested a review October 19, 2019 05:12
Copy link
Member

@AArnott AArnott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting to see this getting done! And thanks for writing the tests.

src/StreamJsonRpc.Tests/JsonRpcTests.cs Show resolved Hide resolved
src/StreamJsonRpc/JsonMessageFormatter.cs Outdated Show resolved Hide resolved
src/StreamJsonRpc/JsonMessageFormatter.cs Outdated Show resolved Hide resolved
src/StreamJsonRpc/JsonMessageFormatter.cs Outdated Show resolved Hide resolved
/// <summary>
/// Tries to obtain the <see cref="MethodSignatureAndTarget"/> info of a method.
/// </summary>
internal bool MethodSupportsSingleParameterObjectDeserialization(string methodName, Type parameterType)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being internal means this magic trick isn't reproducible by other (external) formatters. I like that it's your default, but I'd like to explore whether we can make the functionality available publicly.
Your method as it stands is very focused on your feature. If however we change it to simply return the JsonRpcMethodAttribute for any RPC method, then it will likely be useful not just for this but other future features, which makes me feel better about making it public.
I'm going to play around with this idea and may push a commit to your PR to see what you think, if that's OK with you.

This generalizes the new method on JsonRpc and makes it public.
…ibute

This gives per-method callers the ability to customize how their RPC method is invoked using all the power of the attribute.
It also adds a default constructor to the attribute so its more generally useful now that it has more functionality.
@AArnott
Copy link
Member

AArnott commented Nov 2, 2019

@milopezc Now that I've pushed a few commits to this PR, can you review as well? If you approve too, we'll complete this.

@AArnott AArnott added this to the v2.3 milestone Nov 2, 2019
Copy link
Contributor Author

@milopezc milopezc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, github is not letting me select the Approve option though.

@AArnott AArnott merged commit e441369 into microsoft:master Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for deserializing params *object* as single first parameter
3 participants