Ensure that JSON.GET returns Nil response#2987
Closed
nic-gibson wants to merge 1 commit into
Closed
Conversation
Updated JSONCmd.readReply to return redis.Nil if no results Added a doc line for Val() and Expanded() methods of JSONCmd Added a test case for non existent keys in json_test.go
|
I'm also having issues with this. @nic-gibson do you know if this will be merged? Should we expect a non error when the key is missing for JSONGet? |
Member
|
@nic-gibson can you please resolve conflicts and sync with master ? |
Member
|
@nic-gibson can you enable contributions to your fork so we can resolve the conflicts and proceed with this PR. |
|
Any updates here? |
Member
|
@axilis-marko looks like @nic-gibson is not responding. If you would like you are welcomed to open a pr and fix the failing builds |
ndyakov
requested changes
Apr 24, 2025
ofekshenawa
pushed a commit
that referenced
this pull request
Aug 10, 2025
Updated JSONCmd.readReply to return redis.Nil if no results. Added a doc line for Val() and Expanded() methods of JSONCmd. Added a test case for non existent keys in json_test.go. Original-PR: #2987
ofekshenawa
pushed a commit
that referenced
this pull request
Aug 11, 2025
Ensure that JSON.GET returns redis.Nil for missing keys/paths, making it consistent with other Redis commands. - Restore proper nil detection logic in JSONCmd.readReply - Add comprehensive test coverage for JSON nil scenarios - Handle both non-existent keys and non-existent paths consistently - Distinguish between empty arrays and nil responses - Add documentation for Val() and Expanded() methods Original work and problem identification by Nic Gibson. Enhanced implementation with comprehensive testing and fixes for the broken nil detection logic. Fixes #2987
Collaborator
|
Hi @nic-gibson, Thanks again for your work! |
ndyakov
added a commit
that referenced
this pull request
Aug 12, 2025
* fix conflicts * Fix JSON nil response handling Ensure that JSON.GET returns redis.Nil for missing keys/paths, making it consistent with other Redis commands. - Restore proper nil detection logic in JSONCmd.readReply - Add comprehensive test coverage for JSON nil scenarios - Handle both non-existent keys and non-existent paths consistently - Distinguish between empty arrays and nil responses - Add documentation for Val() and Expanded() methods Original work and problem identification by Nic Gibson. Enhanced implementation with comprehensive testing and fixes for the broken nil detection logic. Fixes #2987 * Fix JSON nil response handling - align with Redis behavior - Non-existent keys return redis.Nil (consistent with other Redis commands) - Non-existent paths in existing keys return empty array '[]' - Fix broken test that was using wrong doc1 reference - Add comprehensive test coverage for JSON nil scenarios This aligns with official Redis JSON.GET behavior: - Missing keys should return nil error like other Redis commands - Missing paths should return empty JSON array, not error * Fix JSONDel tests --------- Co-authored-by: Nic Gibson <nic.gibson@redis.com> Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Updated JSONCmd.readReply to return redis.Nil if no results.