-
Notifications
You must be signed in to change notification settings - Fork 39
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
Pass in JsonSerializerOptions to generic methods #187
Merged
shacharPash
merged 8 commits into
redis:master
from
MichaelDeutschCoding:json-serializer-opts
Oct 17, 2023
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8f77bcb
Pass in JsonSerializerOptions to generic methods
MichaelDeutschCoding 4895597
move the '?' to the right place
shacharPash 1b29670
Add unit tests for JsonSerializerOptions
MichaelDeutschCoding 6db97f9
add missing json path
MichaelDeutschCoding 4a80e25
Merge branch 'master' into json-serializer-opts
shacharPash a9f10d7
Merge branch 'master' into json-serializer-opts
shacharPash 252c8c5
Merge branch 'master' into json-serializer-opts
shacharPash 26e3bb6
Merge branch 'master' into json-serializer-opts
shacharPash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Technically these API changes are binary breaks, if you overlay the new DLLs you'll get missing member exceptions - as the calling applications will need to recompile. NRedisStack is still pre-1.0 so avoiding breaks is still "best effort" I'd say so there's a few options:
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.
@MichaelDeutschCoding
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 don't really have the context to know which of those options makes the most sense; this is my first contribution to the code base. I'm happy to implement any of those approaches, if you can just give me the direction you'd like to take.
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.
@slorello89
To create another signature where serializerOptions is not optional, we will have to do it like this:
What changes the order of the original function (path after key), I think it's better to leave serializerOptions optional.
WDYT?
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.
You would just reset this line, and add a new method with:
as the signature.
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.
@slorello89 I didn't understand how this is possible, an optional variable should come at the end
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 don't know how bad it would be breaking binary/reflection users by changing the method signature, but personally it would feel weird to me to add an additional separate method with a mandatory JsonSerializerOptions, when that parameter is itself optional in the JsonSerializer method we're calling.
If the version number is bumped, does that provide enough "warning" if it does indeed break anyone's use flow?
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.
Honestly, I didn't understand why it breaks.
If the variable we added is optional, anyone who used the function without
JsonSerializerOptions
can continue to use it in exactly the same way because the variable is optional.@slorello89 what do you say?
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.
@shacharPash - @MichaelDeutschCoding is correct - adding optional parameters are compiler-compatible but not binary-compatible. You would need to recompile your application if you use the method in question. See my comments above, as this is still not 1.0+ I think all three options are valid (reset the signature, bump minor, or YOLO), however, if we were post 1.0 I'd insist on option 1 as this is a very minor change to make a major revision for and you really shouldn't propagate binary breaks in minors/patches.