autorest icon indicating copy to clipboard operation
autorest copied to clipboard

LRO properties should be omitted in generated code unless needed

Open bitsforthought opened this issue 10 years ago • 7 comments

(This applies to C#; I haven't checked if it applies to other languages too.)

Not all SDKs support long-running operations, but AutoRest includes the LongRunningOperationRetryTimeout property in the generated ServiceClient anyway. This is confusing to end users looking for information on how to control the client's retry behavior.

There should be a way to prevent AutoRest from generating this property when it's not needed.

bitsforthought avatar Sep 20 '16 21:09 bitsforthought

Which language are you talking about?

  • C#, node.js, ruby, python, java, go - support long running operations.

amarzavery avatar Sep 20 '16 22:09 amarzavery

I know for sure the issue affects C#. I haven't looked at generated code in the other languages.

bitsforthought avatar Sep 21 '16 17:09 bitsforthought

Since the generated clients inherit from IAzureClient, they have to implement LongRunningOperationRetryTimeout. I'd suggest implementing the property explicitly, in case there are no LROs, so at least it is somewhat hidden from end users.

olydis avatar Nov 10 '16 21:11 olydis

@olydis Or factor the interface differently, since not all clients support LRO.

bitsforthought avatar Nov 10 '16 22:11 bitsforthought

IAzureClient is part of the Azure client runtime, which is now owned by azure-sdk-for-net and not AutoRest

Your proposal would require generating a custom client runtime, which is something we'll think about in the 2.0 time frame. Until then, the Azure client runtime is considered unchangeable ;-)

olydis avatar Nov 10 '16 23:11 olydis

@olydis As long as that is an explicit decision to ease package versioning pain for customers at the cost of a slightly awkward interface. I'm ok with that tradeoff. :-)

bitsforthought avatar Nov 11 '16 00:11 bitsforthought

Adding to vNext generator/client runtime feature list.

fearthecowboy avatar Jul 18 '17 17:07 fearthecowboy