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

Add overload to deserialize GetBulkStateAsync item values #1173

Merged
merged 11 commits into from
Feb 16, 2024

Conversation

WhitWaldo
Copy link
Contributor

@WhitWaldo WhitWaldo commented Oct 23, 2023

Adds overload to BulkStateItem and GetBulkStateAsync to perform SDK-based deserialization of returned values instead of strictly returning serialized strings.

Signed-off-by: Whit Waldo whit.waldo@innovian.net

Description

Explained in more detail at #1172 , but GetBulkItemAsync returns a BulkStateItem with a Key, ETag and Value wherein each is typed as a string and the user is expected to deserialize the Value. Because the state might have been originally added one by one, relying on Dapr and its serialization options to serialize everything, this can cause downstream issues deserializing values not originally serialized by the developer.

As such, just as GetStateAsync allows a type parameter to deserialize each returned value, I've added the same overload to GetBulkItemAsync to deserialize using the same mechanism as GetStateAsync to deserialize each of the returned items as part of an overloaded and generically-typed BulkItemState.

Issue reference

As it's a simple addition, I didn't think it really merited a lot of discussion as the functionality is already available for single items (and this just adds the same for multiple items).

Please reference the issue this PR will close: #1172

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

I'll work on finding relevant documentation and updating that right now.

…ased deserialization of returned values instead of strictly returning serialized strings.

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
@WhitWaldo WhitWaldo requested review from a team as code owners October 23, 2023 09:37
…e other (typed or not)

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
…ialized nature of the value.

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
…h the non-generic and generic public methods can deserialize the data once as necessary.

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
philliphoff
philliphoff previously approved these changes Dec 5, 2023
Copy link

codecov bot commented Jan 6, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (034de3e) 67.28% compared to head (fada655) 67.36%.

Files Patch % Lines
src/Dapr.Client/BulkStateItem.cs 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1173      +/-   ##
==========================================
+ Coverage   67.28%   67.36%   +0.08%     
==========================================
  Files         174      174              
  Lines        6006     6028      +22     
  Branches      670      672       +2     
==========================================
+ Hits         4041     4061      +20     
- Misses       1798     1800       +2     
  Partials      167      167              
Flag Coverage Δ
net6 67.34% <92.30%> (+0.08%) ⬆️
net7 67.34% <92.30%> (+0.08%) ⬆️
net8 67.35% <92.30%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@halspang halspang left a comment

Choose a reason for hiding this comment

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

Looks good overall, just some formatting nitpicks.

src/Dapr.Client/DaprClientGrpc.cs Outdated Show resolved Hide resolved
src/Dapr.Client/DaprClientGrpc.cs Outdated Show resolved Hide resolved
src/Dapr.Client/DaprClientGrpc.cs Outdated Show resolved Hide resolved
…ion requires each have their own line.

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
@hhunter-ms
Copy link
Contributor

@halspang @philliphoff is this ready for merge? just checking since there's a corresponding docs PR waiting in the wings for this :)

@philliphoff
Copy link
Contributor

@hhunter-ms @halspang If Hal is ok with the last set to changes he requested (and the required merge is clean), I say merge it.

@philliphoff philliphoff modified the milestone: v1.13 Feb 15, 2024
@halspang halspang merged commit 83858d7 into dapr:master Feb 16, 2024
12 checks passed
@WhitWaldo WhitWaldo deleted the bulk-state-deserialization branch February 17, 2024 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GetBulkStateAsync should have typed overload that performs bulk deserialization
4 participants