autorest icon indicating copy to clipboard operation
autorest copied to clipboard

(C#) Incorrect comment on credentials parameter of generated Azure ServiceClient c-tor

Open bitsforthought opened this issue 10 years ago • 0 comments

The comment for the credentials property of generated ServiceClient constructors assumes that the generated client is a management client, since it mentions "Azure subscription credentials". This is incorrect for data plane SDKs like Azure Search that define their own credential classes. Also, the comment is a bit awkward in that it mentions "Get" like a property, but it's a parameter.

Here is what the generated code for such a constructor looks like with the latest 0.17.0 nightly build:

/// <summary>
/// Initializes a new instance of the SearchServiceClient class.
/// </summary>
/// <param name='credentials'>
/// Required. Gets Azure subscription credentials.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
public SearchServiceClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
{
    if (credentials == null)
    {
        throw new ArgumentNullException("credentials");
    }
    this.Credentials = credentials;
    if (this.Credentials != null)
    {
        this.Credentials.InitializeServiceClient(this);
    }
}

Can we have a more accurate and less weird comment like "Required. Credentials needed for the client to connect to Azure."?

bitsforthought avatar May 24 '16 01:05 bitsforthought