-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional Patch SDK #19307
Conditional Patch SDK #19307
Conversation
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/BulkPatchItemRequestOptions.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/BulkPatchItemRequestOptions.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncContainer.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/batch/BatchExecUtils.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/BridgeInternal.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/BulkItemRequestOptions.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/PatchSpec.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/PatchSpec.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/PatchSpec.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/PatchSpec.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/BulkItemRequestOptionsBase.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/BulkItemRequestOptionsBase.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/BulkItemRequestOptionsBase.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncContainer.java
Outdated
Show resolved
Hide resolved
...os/azure-cosmos/src/main/java/com/azure/cosmos/TransactionalBatchItemRequestOptionsBase.java
Outdated
Show resolved
Hide resolved
...os/azure-cosmos/src/main/java/com/azure/cosmos/TransactionalBatchItemRequestOptionsBase.java
Show resolved
Hide resolved
...s/azure-cosmos/src/main/java/com/azure/cosmos/TransactionalBatchPatchItemRequestOptions.java
Outdated
Show resolved
Hide resolved
...os/azure-cosmos/src/main/java/com/azure/cosmos/TransactionalBatchItemRequestOptionsBase.java
Outdated
Show resolved
Hide resolved
...s/azure-cosmos/src/main/java/com/azure/cosmos/TransactionalBatchPatchItemRequestOptions.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please make sure you address Fabian's comments as well.
This is not introduced in this PR. we can close on this one outside of the scope of this PR.
But so we remember to discuss it, the current Patch api asks for 5 arg which is debatable if it is easy to use.
container.patchItem(
String itemId,
PartitionKey partitionKey,
CosmosPatchOperations cosmosPatchOperations,
CosmosPatchItemRequestOptions options,
Class<T> itemType)
@FabianMeiswinkel @kushagraThapar @milismsft thought on using 5 args here?
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/BulkPatchItemRequestOptions.java
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/patch/PatchUtil.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/patch/PatchUtil.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/PatchAsyncTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/PatchAsyncTest.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/PatchSpec.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java
Outdated
Show resolved
Hide resolved
...mos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/batch/ItemBatchOperation.java
Outdated
Show resolved
Hide resolved
@@ -1003,19 +1014,19 @@ public String getId() { | |||
String itemId, | |||
PartitionKey partitionKey, | |||
CosmosPatchOperations cosmosPatchOperations, | |||
CosmosItemRequestOptions options, | |||
CosmosPatchItemRequestOptions options, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that this is not introduced in this PR. So we don't have to find a solution to it in this PR.
But we need to pay attention what we should do.
We have a method here with 5 args which IMO in Java is not as great. We have tried to limit the number of args in the public surface area for better usability.
@FabianMeiswinkel @kushagraThapar @milismsft what's your thought on a method with 5 args here? thought?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline - I don't have a proposal for a better way (that is consistent with the approach for other point operations). itemId, pk and item Type are required. The only alternative I see is to push id, pk and itemType into CosmosPatchOperations as required parameters for the static create factory method.
But IMO this is more confusing because it could create the impression that path operations can spread across documents/items - I prefer the current mode which allows factoring the patchOperations and reuse it for different documents.
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/batch/BatchExecUtils.java
Outdated
Show resolved
Hide resolved
...cosmos/azure-cosmos/src/main/java/com/azure/cosmos/TransactionalBatchItemRequestOptions.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/patch/PatchUtil.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now - thanks!
This PR introduces conditional Patch to Java SDK.
Patch requests have the option that it can be triggered only when the condition attached is true.
The new condition(filter predicate) is attached along with request options and is processed for the respective document.