Skip to content

Conversation

jprochazk
Copy link
Contributor

@jprochazk jprochazk commented Sep 4, 2025

Adds the ability to provide the condition for conditional patch operations. Related REST API docs here:

@github-actions github-actions bot added Community Contribution Community members are working on the issue Cosmos The azure_cosmos crate customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Sep 4, 2025
Copy link

github-actions bot commented Sep 4, 2025

Thank you for your contribution @jprochazk! We will review the pull request and get back to you soon.

Copy link

github-actions bot commented Sep 4, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

azure_data_cosmos

@jprochazk jprochazk force-pushed the jan/conditional-patch branch from b58b4d7 to f16d165 Compare September 15, 2025 11:52
Copy link
Member

@analogrelay analogrelay left a comment

Choose a reason for hiding this comment

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

Hey, if you'd like to undraft this, I think it's a good addition! I made one minor comment about the implementation, and it'll need at least one unit test to be added, then it'll be ready to go if you want to contribute it!

@jprochazk jprochazk force-pushed the jan/conditional-patch branch from f16d165 to a78eabc Compare September 30, 2025 16:57
@jprochazk
Copy link
Contributor Author

it'll need at least one unit test to be added

Added a few tests for serialization and deserialization.

Windows CI is failing, but it seems unrelated, as the same tests pass on Linux/MacOS.

@jprochazk jprochazk marked this pull request as ready for review September 30, 2025 17:06
@jprochazk jprochazk requested a review from a team as a code owner September 30, 2025 17:06
@jprochazk
Copy link
Contributor Author

(I am still waiting for approval from my employer to sign the CLA. I assume there will be no problem with that, but it's pending)

@jprochazk
Copy link
Contributor Author

@microsoft-github-policy-service agree company="Rerun"

@analogrelay
Copy link
Member

The build failures are a known issue in main that is fixed, I believe. I'll re-trigger the build.

@analogrelay
Copy link
Member

/azp run rust - pullrequest

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@heaths
Copy link
Member

heaths commented Oct 2, 2025

Rebase again. There was a bad PR that went into eng/common that broke test-proxy on Windows, it seems.

@Copilot Copilot AI review requested due to automatic review settings October 2, 2025 23:14
@jprochazk jprochazk force-pushed the jan/conditional-patch branch from a78eabc to fac09f5 Compare October 2, 2025 23:14
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds conditional patch operation support to the PatchDocument struct by introducing a condition field and corresponding builder method. This enables users to apply patch operations conditionally based on SQL-like filter predicates, aligning with Azure Cosmos DB's conditional patch operation REST API.

  • Added optional condition field to PatchDocument struct with proper serialization handling
  • Implemented with_condition builder method for fluent API usage
  • Added comprehensive tests including serialization and real-world example validation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
sdk/cosmos/azure_data_cosmos/src/models/patch_operations.rs Added condition field to PatchDocument, implemented with_condition builder method, and added tests for conditional patch functionality
sdk/cosmos/azure_data_cosmos/examples/cosmos/patch.rs Updated struct initialization to include the new condition field

@analogrelay analogrelay merged commit 4b58ebf into Azure:main Oct 3, 2025
17 checks passed
@analogrelay
Copy link
Member

I forgot to ask you to update the CHANGELOG, but I'll do that in an upcoming PR (we're nearing a release and I need to modify that file anyway)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution Community members are working on the issue Cosmos The azure_cosmos crate customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants