Skip to content

feat: JSON.MERGE plus unit and integration tests#95

Open
patrickn2 wants to merge 19 commits into
valkey-io:unstablefrom
patrickn2:feat--JSON.MERGE-Command
Open

feat: JSON.MERGE plus unit and integration tests#95
patrickn2 wants to merge 19 commits into
valkey-io:unstablefrom
patrickn2:feat--JSON.MERGE-Command

Conversation

@patrickn2
Copy link
Copy Markdown

@patrickn2 patrickn2 commented Dec 30, 2025

JSON.MERGE Command
Followed instructions here https://redis.io/docs/latest/commands/json.merge/

Closes #74.

@patrickn2 patrickn2 mentioned this pull request Dec 30, 2025
@roshkhatri
Copy link
Copy Markdown
Member

roshkhatri commented Dec 30, 2025

Can you please add --sign off to the commits?: https://github.com/valkey-io/valkey-json/pull/95/checks?check_run_id=59176701849

@patrickn2
Copy link
Copy Markdown
Author

Can you please add --sign off to the commits?: https://github.com/valkey-io/valkey-json/pull/95/checks?check_run_id=59176701849

I guess I made a mess trying to fix it
Could you take a look?

@roshkhatri
Copy link
Copy Markdown
Member

Can you please add --sign off to the commits?: https://github.com/valkey-io/valkey-json/pull/95/checks?check_run_id=59176701849

I guess I made a mess trying to fix it Could you take a look?

Yeah, its okay , you can just run these commands and it should be fine:

git rebase HEAD~3 --signoff
git push --force-with-lease origin feat--JSON.MERGE-Command

@patrickn2 patrickn2 force-pushed the feat--JSON.MERGE-Command branch from 9301a02 to 3bb9a5d Compare December 30, 2025 22:18
@patrickn2
Copy link
Copy Markdown
Author

Can you please add --sign off to the commits?: https://github.com/valkey-io/valkey-json/pull/95/checks?check_run_id=59176701849

I guess I made a mess trying to fix it Could you take a look?

Yeah, its okay , you can just run these commands and it should be fine:

git rebase HEAD~3 --signoff
git push --force-with-lease origin feat--JSON.MERGE-Command

Done

Copy link
Copy Markdown
Member

@roshkhatri roshkhatri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR, just some suggestions and may need to add more tests

Comment thread src/json/dom.cc Outdated
Comment thread src/json/json.cc Outdated
Comment thread src/json/dom.cc
Comment thread CMakeLists.txt
Comment thread build.sh
Comment thread tst/integration/test_json_basic.py
Comment thread tst/integration/conftest.py
Comment thread docs/JSON.MERGE_COMPLEXITY.md Outdated
Comment thread docs/JSON.MERGE_SUMMARY.md Outdated
Comment thread docs/JSON.MERGE_SUMMARY.md Outdated
@patrickn2 patrickn2 force-pushed the feat--JSON.MERGE-Command branch 2 times, most recently from b53bf08 to 9713e53 Compare January 6, 2026 14:37
@roshkhatri
Copy link
Copy Markdown
Member

The failing CI would be fixed once we merge the latest unstable into this branch

@roshkhatri
Copy link
Copy Markdown
Member

I am not sure though why these are failing: https://github.com/valkey-io/valkey-json/actions/runs/20278225578/job/58232842208
here the cloning into valkey is working but on this PR there seems to be some issue

Comment thread src/CMakeLists.txt Outdated
Copy link
Copy Markdown
Contributor

@sarthakaggarwal97 sarthakaggarwal97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments from my end. Thank you for the change.

Comment thread src/json/dom.cc Outdated
Comment thread src/json/dom.cc
Comment thread src/json/dom.cc Outdated
Comment thread src/json/json.cc Outdated
Comment thread src/json/dom.cc Outdated
@patrickn2 patrickn2 force-pushed the feat--JSON.MERGE-Command branch 2 times, most recently from c8376e8 to c62cd5a Compare February 6, 2026 21:35
@sarthakaggarwal97
Copy link
Copy Markdown
Contributor

@patrickn2 thanks for the fixes. Allow me some time to review again!

Comment thread .github/workflows/ci.yml
Copy link
Copy Markdown

@mkmkme mkmkme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Here are some opinionated drive-by comments on the PR. Could you have a look please?

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Comment thread src/json/dom.cc
Comment thread src/json/dom.cc Outdated
Comment thread src/json/dom.cc Outdated
Comment thread src/json/dom.cc Outdated
Comment thread src/CMakeLists.txt
Comment thread build.sh
Comment thread CMakeLists.txt
Copy link
Copy Markdown
Member

@roshkhatri roshkhatri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont have more to add to what @sarthakaggarwal97 and @mkmkme
I think just rebasing onto unstable should work

Comment thread .github/workflows/ci.yml
Comment thread tst/integration/conftest.py
@roshkhatri
Copy link
Copy Markdown
Member

@patrickn2, if possible, can you please take a look at the feedback?
Valkey will be releasing 9.1 rc1 soon and we can release new version for valkey-json, so we can have valkey-json in the next bundle release.

@patrickn2
Copy link
Copy Markdown
Author

I guess I fixed everything guys
Thank you for your review @mkmkme @roshkhatri

@patrickn2 patrickn2 force-pushed the feat--JSON.MERGE-Command branch from c8e2180 to bdbf4b4 Compare March 6, 2026 13:26
Comment thread build.sh Outdated
…ck Nogueira <patricknn@gmail.com>

Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
…it and add unit tests for depth limit scenarios

Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
…d improve memory tracking. Update unit tests for merge values.

Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
…ses, and add unit tests for various merge scenarios

Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
…ts for various merge scenarios including array and object replacements

Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
…, mixed updates, error handling, and no-op scenarios

Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
patrickn2 and others added 10 commits March 6, 2026 21:21
Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
This reverts commit ac5a0e4.

Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
- Introduced a new configuration key `json.max-path-limit` to set the maximum nesting depth for JSON documents.
- Updated README.md to include details about the new configuration option, its default value, and usage instructions.
- Modified merge_values function to ensure proper handling of empty objects during merging.
- Adjusted the command info for JSON.MERGE to reflect a new parameter value.

Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
…fixed them

Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
…nd add a new unit test for object replacement in merging

- Moved the check for empty objects in merge_values to ensure proper handling during merging.
- Added a unit test to verify that an object replaces an array at a specified key in the merge process.

Signed-off-by: patricknn@gmail.com <patricknn@gmail.com>
Made-with: Cursor
Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
…ormance

- Changed key type from std::string to std::string_view to reduce unnecessary copies.
- Updated key member check in merge_values to utilize the new key type.

Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
…inimize unnecessary copies.

Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
Signed-off-by: patrick.nogueira@fox.com
Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
Signed-off-by: patrick.nogueira@fox.com
Signed-off-by: patrick.nogueira@fox.com <patrick.nogueira@fox.com>
@roshkhatri roshkhatri force-pushed the feat--JSON.MERGE-Command branch from bdbf4b4 to b1f8569 Compare March 6, 2026 21:30
@roshkhatri
Copy link
Copy Markdown
Member

There were some stray changes in the history, removed and pushed it, should be easier to review the PR now

Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
@roshkhatri roshkhatri force-pushed the feat--JSON.MERGE-Command branch from 787e805 to c57b920 Compare March 6, 2026 22:31
Comment thread src/commands/json.merge.json Outdated
Co-authored-by: Roshan Khatri <117414976+roshkhatri@users.noreply.github.com>
Signed-off-by: Patrick Nery Nogueira <119355744+patrickn2@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support JSON.MERGE

4 participants