Please follow the steps below to generate swagger for Azure functions
- Get a fiddler/postman session working with your function so that you have the json ouput.
- Past the Json as class using the following in Visual Studio
- Create a webapi application, configure swagger (the howto can be found here https://www.youtube.com/watch?v=LIhT6HIpLf8)and create a controller method with the necessary input and output values (no method implementation is necessary except for returning expected output)
// GET api/values/5 public List<Rootobject> Get() { return new List<Rootobject>();}
- Then just navigate to http://yourapplication:portno/swagger to make sure all the datatypes for your particular operation are shown accordingly.
- Then download the swagger file from http://yourapplication:portno/swagger/docs/v1 and save it to a file
- Then navigate to http://editor.swagger.io/#/ open the saved file (copy paste also works) and add or remove what you need….
Hopefully this will help in saving some time…