autorest icon indicating copy to clipboard operation
autorest copied to clipboard

(C#) AutoRest generates public constructors that leave ServiceClient in an unusable state

Open bitsforthought opened this issue 11 years ago • 3 comments

AutoRest generates the following constructors in C# (using Azure Search's SearchServiceClient as an example):

public SearchServiceClient()
public SearchServiceClient(params DelegatingHandler[] handlers)
public SearchServiceClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
public SearchServiceClient(Uri baseUri, params DelegatingHandler[] handlers)
public SearchServiceClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers)
public SearchServiceClient(Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers)

Most of these constructors do not take ServiceClientCredentials, and the Credentials property is not publicly settable. It seems that the constructors that do not take credentials should be private or maybe protected.

Also, is there a way in the Swagger to specify a derived class of ServiceClientCredentials? It would be nice if the constructors that do take credentials could be as strongly-typed as possible.

bitsforthought avatar Oct 12 '15 22:10 bitsforthought

Tracking via: https://www.pivotaltracker.com/story/show/107070538

stankovski avatar Oct 30 '15 18:10 stankovski

Fixed in dev

stankovski avatar Nov 06 '15 15:11 stankovski

Thanks!

bitsforthought avatar Nov 06 '15 17:11 bitsforthought