DOC-6842 Add redis-rb (Ruby) JSON docs [PARKED]#3629
Open
andy-stark-redis wants to merge 1 commit into
Open
Conversation
…mmand mappings Preemptive, parked docs for redis-rb's JSON module (merged upstream in redis-rb #1346-#1349 but not yet in a released gem — the latest is v5.4.1 from July 2025, which predates the module). Adds a Ruby port of the json_tutorial doctest set and redis_rb signatures across the 22 JSON.* command-api-mapping files. Foundation for the redis-rb Query Engine docs, which index JSON documents and will build on this. Two non-obvious things for whoever edits these next. First, data/examples.json is deliberately absent from this change: it is git-ignored and generated, and the new Ruby tab on the JSON data-type page comes entirely from the dt_json.rb source via build/local_examples.py (.rb maps to ruby maps to the "Ruby" tab). Do not hand-add a Ruby entry there. Second, the example's expected outputs and REMOVE-block asserts are not guesses — the file was run against the local redis-rb fork (master) on Redis 8.8 and passed all 18 steps, so the only remaining risk is the upstream API changing before the gem ships. Learned: examples.json is generated (Ruby tab derives from the .rb source); example outputs were run-verified against the redis-rb fork, not guessed Constraint: regenerate data/command-api-mapping.json with build/merge-command-api-mapping.sh after editing per-command files — never hand-edit the merged file Directive: parked — do not merge until redis-rb ships the JSON module in a released gem Recheck: next redis-rb gem release (currently unreleased; JSON module is master-only) Gaps: verified against fork master on Redis 8.8, not a released gem — re-run the example at pickup Ticket: DOC-6842 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
| [%w[black silver pink], %w[black white], %w[black silver pink]], | ||
| res21 | ||
| ) | ||
| # REMOVE_END |
Contributor
There was a problem hiding this comment.
I think it also makes sense to add an examples with raw: true option. We allow to pass a raw JSON strings as an arguments or return raw JSON as a response to skip object mapping step in case data stored as plain JSON.
https://github.com/redis/redis-rb/blob/master/test/lint/json.rb#L15
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.
DOC-6842 — redis-rb (Ruby) JSON docs
Adds Ruby (redis-rb) coverage for the JSON data type, in two parts:
json_tutorialdoctest set (local_examples/tmp/datatypes/json/dt_json.rb, all 18 steps) using redis-rb'sjson_*methods. TheRubytab on the JSON data-type page is generated from this.rbsource at build time (data/examples.jsonis git-ignored, so it is intentionally not in this diff).redis_rbmethod signatures added to the 22JSON.*command-api-mapping files, with descriptions taken from redis-rb's YARD docs.Foundation for the follow-up redis-rb Query Engine docs (
redis-rb#1356), which index JSON documents and build on this.Warning
Do not merge yet — parked. These docs are written against redis-rb's JSON module, which is merged to
masterbut not in any released gem (latest is v5.4.1, July 2025, which predates the module). Merge only after the trigger below fires. See redis-rb#1346–#1349.Park manifest
Ticket: DOC-6842
Parked at: 2026-07-14
Trigger to pick up: a redis-rb gem is released (a tag/version later than v5.4.1) that includes
lib/redis/commands/modules/json.rbLabels: parked, do not merge yet
Pinned sources (state observed at park time)
gh api repos/redis/redis-rb/tags --jq '.[0:5][].name'then confirmgh api "repos/redis/redis-rb/contents/lib/redis/commands/modules/json.rb?ref=<tag>"returns 200json.rbonmaster)fa90f44, 2026-06-11. Merged via PRs #1346–#1349.gh api "repos/redis/redis-rb/commits?path=lib/redis/commands/modules/json.rb&per_page=1" --jq '.[0].sha'659d885); now also master-only/unreleased.gh api repos/redis/redis-rb/pulls/1356 --jq '{merged,head_sha}'Observed shape the page assumes — confidence: HIGH (unusual for a parked PR)
The example and mappings were run-verified against the pinned source, not written blind against a diff:
dt_json.rbexecuted against the redis-rb fork atmaster(json.rbfa90f44) on Redis 8.8 (ReJSON), exit 0, all 18assert_equalblocks passing. Mapping signatures/types/descriptions were read from the samejson.rbYARD source. Residual risk is only API drift betweenmasterand the eventual release — return shapes likejson_set → "OK",json_arrpopparsed values, and theArray<…>vs scalar JSONPath/legacy-path distinction are the things to re-confirm if the API moves before the gem ships.Re-check checklist (on pickup)
local_examples/tmp/datatypes/json/dt_json.rbagainst the released gem — all 18 asserts must still pass.json.rbagainstmaster@fa90f44for signature/return-shape changes to anyjson_*method.data/command-api-mapping/JSON.*.jsonfile and re-runbuild/merge-command-api-mapping.sh(never hand-edit the mergeddata/command-api-mapping.json).Rubytab renders on the JSON data-type page oncedata/examples.jsonregenerates (it is generated from the.rbsource; not in this diff).data/examples.jsonentry was hand-added (it is git-ignored/generated) — verify none crept in.On pickup, then
When the trigger fires, run
/pickup 6842: it reconciles the docs against the now-released gem and takes the PR through the normal/reflect→/finalizepipeline to merge./finalizeis deferred until then — the episodicRecheck:/Gaps:commit trailers must survive for pickup. Thedo not merge yetguard holds until/finalizecompletes.🤖 Generated with Claude Code
Note
Low Risk
Documentation and static JSON mapping only; no runtime or security-sensitive code paths, with merge deferred until the client gem release.
Overview
Adds Ruby (redis-rb) coverage for the JSON data type: a new
json_tutorialexample andredis_rbentries on 22JSON.*commands in the command API mapping data.local_examples/tmp/datatypes/json/dt_json.rbis a Ruby port of the existing JSON tutorial (18STEP_*sections) usingr.json_set,r.json_get, array/object helpers, JSONPath filters, andassert_equalchecks—intended to drive the Ruby tab on the JSON docs at build time.Command mappings gain a
redis_rbblock per affected command (e.g.json_arrappend,json_get,json_setwithnx/xx/raw) with signatures, parameter types, and return-shape notes aligned with redis-rb’s YARD docs. The same updates appear in per-command files underdata/command-api-mapping/and in the mergeddata/command-api-mapping.json.The PR description notes it is parked until a redis-rb release ships the JSON module (newer than v5.4.1).
Reviewed by Cursor Bugbot for commit 21ec8f8. Bugbot is set up for automated code reviews on this repo. Configure here.