azure-cosmos-dotnet-repository icon indicating copy to clipboard operation
azure-cosmos-dotnet-repository copied to clipboard

Patch Update not working when Serialization Options Property Naming Policy is set to Default.

Open sushruthkumar123 opened this issue 2 years ago • 3 comments

Describe the bug When "propertynamingpolicy" in set to "Default" in SerializationOptions the SDK throws Bad Request Exception since its trying to find a property and could nt find. Sdk is not considering Serialization settings for PropertyNamingPolicy when creating PatchOperations.

Example : When configuration is set to "Default". Property name is "Name". But when trying to replace the value at "Name" property is searching for "name".

To Reproduce Set "PropertyNamingPolicy" under "SerializationOptions" to Default. image

Perform patch update using UpdateAsync image

Expected behavior Successfully perform Patch update on document,

Actual behavior SDK throws 400 Bad request execption.

Environment summary SDK Version: 3.5.3 OS Version (Windows)

sushruthkumar123 avatar Apr 18 '22 05:04 sushruthkumar123

Hi 👋 @sushruthkumar123 Thank you so much for posting this issue. We really appreciate it. Could you please post the code to reproduce this bug, that would be really helpful to debug and fix the issue.

IEvangelist avatar Apr 18 '22 12:04 IEvangelist

Hi @IEvangelist, please find the example here. Let me know if more details are required.

https://github.com/sushruthkumar123/azurecosmosrepository/tree/main/samples/patchUpdate/PatchUpdate

sushruthkumar123 avatar Apr 18 '22 18:04 sushruthkumar123

Hi @IEvangelist, please find the example here. Let me know if more details are required.

https://github.com/sushruthkumar123/azurecosmosrepository/tree/main/samples/patchUpdate/PatchUpdate

Hi @sushruthkumar123 and @IEvangelist

This is correct looking at the code it will not do what your expecting, we have some work to do on this one, in the meantime you can use the JsonProperty attribute to get around this and I'll try and get a fix in for this soon 👍🏼

mumby0168 avatar Apr 18 '22 19:04 mumby0168