Repository navigation
fix: Cosmos patch requests not using the custom serializer - #51407
Open
Kartika Prasad (pure-zero) wants to merge 2 commits into
Open
Kartika Prasad (pure-zero) wants to merge 2 commits into
Kartika Prasad (pure-zero) wants to merge 2 commits into
Conversation
Kartika Prasad (pure-zero)
requested review from
a team and
Kiran Kumar Kolli (kirankumarkolli)
as code owners
November 24, 2026 23:21
|
Azure Pipelines: Successfully started running 2 pipeline(s). 29 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Thank you for your contribution Kartika Prasad (@pure-zero)! We will review the pull request and get back to you soon. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The custom serializer turns numeric INCREMENT operands into objects, causing Cosmos DB to reject those patches and transactional batches; increments must retain default serialization with long and double regression coverage.
1 open issue
What changed in this PR
This PR addresses #51405 by applying the effective CosmosItemSerializer to Cosmos DB patch values across single-item, transactional batch, and bulk requests.
Changes:
- Resolves and forwards the effective serializer when building patch payloads.
- Adds tests for custom serialization, fallback behavior, and batch/bulk serializer propagation.
- Documents the fix in the Cosmos SDK changelog.
| File | Description |
|---|---|
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/patch/PatchUtil.java |
Resolves serializers and applies them to patch values. |
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/batch/ItemBulkOperation.java |
Forwards the effective serializer for bulk patches. |
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/batch/ItemBatchOperation.java |
Forwards the effective serializer for transactional batch patches. |
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/batch/CosmosItemOperationBase.java |
Adds a shared patch-body serialization helper. |
sdk/cosmos/azure-cosmos/CHANGELOG.md |
Records the custom patch serialization fix. |
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/patch/PatchUnitTest.java |
Tests serializer selection, precedence, and fallback behavior. |
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/batch/ItemOperationPatchSerializerTest.java |
Tests serializer propagation for batch and bulk patches. |
Review effort: Balanced
This branch has not been deployed
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.

…ions when set
Fixes #51405
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines