I played with AutoRest and Swagger . My web API controller has a method GetAllAsync. When I create a client for the service, the client has an interface IResourcesOperations, where Resourcesis the name of the controller.
The interface has a method called GetAllAsyncWithHttpMessagesAsync. Then there is a static class called ResourcesOperationsExtensions, which defines a method called GetAllAsyncand one is called GetAllAsyncAsync. The first one actually starts the second thread from the thread pool ( Task.Factory.StartNew). Does anyone know the reason for this?
I found that I can decorate my action method with an attribute
[SwaggerOperation("GetResources")]
This will create a client class method GetResourcesWithHttpMessagesAsyncand remove all methods for this web API action from the interface class and extension class.
Now my question is: why are these three methods generated by default?
And is there a way to generate a client using a method named GetResources(i.e. get rid of the WithHttpMessagesAsync suffix) or even GetAllAsync?
source
share