AutoRest

2016, Feb 26    

The Azure team have put together this really great tool - called AutoRest - that can generate a client library for a Rest based API using a Swagger document.

Fire up a command prompt, pass AutoRest.exe some parameters and like magic you have an instant library in your language of choice to add to your app.

For example, the following will create a C# library and place all object in the AwesomeApp namespace

AutoRest.exe -CodeGenerator CSharp -Modeler Swagger -Input swagger.json -Namespace AwesomeApp

To use the library out of the box, add the Microsoft.Rest.ClientRuntime nuget package to your project or simply steal the model objects and roll your own wrapper around HTTPClient.

As the tool is a simple console app, it can be added as a custom build step

Pretty cool