Azure/azure-sdk-for-python

Default value is emitted in __init__ method

t-bzhan opened this issue · 1 comments

Hello team, I’d like to report a potential issue with the Python SDK generation. Our swagger misplaces the default value for a property in our swagger, even though this default value is applicable to some SKUs:https://github.com/Azure/azure-rest-api-specs/pull/28640/files. The generated Python SDK appears to set the default value in the init method.
image

While this is undoubtedly a swagger issue we’d like to address, during the approval process for breaking changes, it was pointed out that SDKs should not encode the default value: https://azure.github.io/azure-sdk/general_implementation.html#general-params-server-defaults.
image

I haven’t observed the same behavior in Go or Java. However, I received feedback from the JavaScript SDK owner, who mentioned that JavaScript might exhibit a similar behavior.

This issue aims to have a discussion about whether we should encode the default value in the generated SDK.

@xiangyan99 this is the behavior we currently have in DPG. It's not what we actually want, but it would be breaking to remove. For tsp though, we are not encoding service defaults in our code at all.

What would you guys think is the best way forward