Azure / azure-sdk-for-cpp

This repository is for active development of the Azure SDK for C++. For consumers of the SDK we recommend visiting our versioned developer docs at https://azure.github.io/azure-sdk-for-cpp.
MIT License
181 stars 126 forks source link

The implementation and default behavior of UpsertEntity differs in C++ compared to other languages #6230

Open ahsonkhan opened 2 hours ago

ahsonkhan commented 2 hours ago

1) The default value of UpsertEntityOptions is UpsertKind::Update in C++, but it is Merge in other languages. 2) We are calling AddEntity in the exception path for some reason, which the other language SDKs don't do. Why do we do this?

C++ implementation: https://github.com/Azure/azure-sdk-for-cpp/blob/384552adff3d6cdea46cdf8a345120b183bdcc1e/sdk/tables/azure-data-tables/src/table_clients.cpp#L599-L627

P.S. The (void)options line should be removed (on line 604), since the options are being used here.

.NET implementation: https://github.com/Azure/azure-sdk-for-net/blob/4e1173308d32f0413788359a87376e673f2ab15b/sdk/tables/Azure.Data.Tables/src/TableClient.cs#L818-L856

GoLang implementation: https://github.com/Azure/azure-sdk-for-go/blob/3ebd0d439f9d8aa06a0764a60892a8001b997a34/sdk/data/aztables/client.go#L420-L478

cc @jhendrixMSFT, @christothes

gearama commented 2 hours ago

works as expected

ahsonkhan commented 2 hours ago

There's a behavioral difference, and our SDKs need to be: 1) Idiomatic to the language. 2) Consistent across languages where (1) isn't lost.

That's written in our design guidelines: https://azure.github.io/azure-sdk/cpp_introduction.html#cpp-principles

Client libraries should be consistent within the language, consistent with the service and consistent between all target languages. In cases of conflict, consistency within the language is the highest priority and consistency between all target languages is the lowest priority.