Repository navigation
MOD-16685 Add RedisJSON API to open from RedisModuleKey (#1619) - #1620
Merged
Merged
Conversation
* MOD-16685 Add RedisJSON API to open from RedisModuleKey Add a RedisJSON shared API V8 entry that opens a JSON root from an already-open RedisModuleKey handle. This lets consumers such as RediSearch reuse an existing key handle instead of manually checking isJSON and calling RedisModule_ModuleTypeGetValue. Update the RediSearch RedisJSON API header copy and add LLAPI coverage for the new openKeyFromHandle path. * use Imanager to get value for json * fix clippy * rename functions * fix compilation
AvivDavid23
approved these changes
Jul 9, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 8.10 #1620 +/- ##
==========================================
+ Coverage 85.82% 85.86% +0.04%
==========================================
Files 15 15
Lines 5212 5241 +29
==========================================
+ Hits 4473 4500 +27
- Misses 739 741 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Add a RedisJSON shared API V8 entry that opens a JSON root from an already-open RedisModuleKey handle. This lets consumers such as RediSearch reuse an existing key handle instead of manually checking isJSON and calling RedisModule_ModuleTypeGetValue.
Update the RediSearch RedisJSON API header copy and add LLAPI coverage for the new openKeyFromHandle path.
use Imanager to get value for json
fix clippy
rename functions
fix compilation
Note
Medium Risk
Extends the stable C shared-API struct (V8) and exposes raw pointers tied to caller-owned key lifetime; incorrect use could crash, but scope is read-only JSON access with explicit validation.
Overview
Bumps the RedisJSON shared C API to V8 with a new
getJsonFromHandleentry that returns the document root from an already-openRedisModuleKey, so consumers (e.g. RediSearch) can reuse a key handle instead of re-opening or callingRedisModule_ModuleTypeGetValuethemselves.The Rust side adds
json_api_get_value_from_handle_internal/JSONAPI_getJsonFromHandle, wires the function into the exportedRedisJSONAPIstruct andrejson_api.h, and implementsManager::get_value_from_handleon the IValue manager (module-type value → rootIValuepointer). NULL, non-module, and non-JSON keys return NULL before dereferencing.LLAPI test module and pytest exercise
LLAPI.GETJSONFROMHANDLEon valid JSON keys and expect errors for missing or plain string keys.Reviewed by Cursor Bugbot for commit 2fef684. Bugbot is set up for automated code reviews on this repo. Configure here.