DOC-6842 Add redis-rb (Ruby) JSON docs [PARKED]#3629
Open
andy-stark-redis wants to merge 2 commits 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
6 tasks
… steps Adds raw: true examples to the set_get, arr, arr2, and obj steps of the Ruby JSON tutorial, per maintainer feedback (vladvildanov on PR #3629): raw input (pass an already-encoded JSON string, skipping serialization) and raw output (get the unparsed JSON string back instead of a Ruby object). These land only on the Ruby tab of those shared steps because raw: is a redis-rb-specific kwarg — the other clients on the json_tutorial set have no equivalent option, so the raw lines are deliberately not mirrored to their tabs. Re-verified end-to-end against the redis-rb fork (master) on Redis 8.8 — all asserts pass, including the five new raw ones. Directive: the raw: examples are Ruby-only by design (redis-rb-specific kwarg) — don't mirror them to other clients' tabs on these shared json_tutorial steps Ticket: DOC-6842 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
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 reference JSON only; no runtime or auth changes. Residual risk is docs drifting from the eventual redis-rb gem release until pickup re-verification.
Overview
Adds Ruby (redis-rb) coverage for the JSON data type: a new
json_tutorialdoctest source andredis_rbentries on the existing JSON command reference data.local_examples/tmp/datatypes/json/dt_json.rbis a Ruby port of the shared JSON tutorial (18 stepped sections). It exercises redis-rb’sjson_*helpers—set/get, strings, numbers, arrays, objects, path queries, filters, and bulk updates—and documents theraw:option for pre-encoded JSON on several calls. Build output feeds the JSON data-type page Ruby tab (via generatedexamples.json, not in this diff).data/command-api-mapping/JSON.*.json(22 commands) and the mergeddata/command-api-mapping.jsoneach gain aredis_rbblock: method signatures, parameters, and return descriptions aligned with redis-rb’s YARD docs (including JSONPath vs legacy path return shapes and optionalraw).PR is parked until a redis-rb release ships the JSON module (post–v5.4.1); docs target unreleased
masterAPI.Reviewed by Cursor Bugbot for commit a42f75e. Bugbot is set up for automated code reviews on this repo. Configure here.