Generating swagger for azure functions until its available OOB

Please follow the steps below to generate swagger for Azure functions

  1. Get a fiddler/postman session working with your function so that you have the json ouput.
  2. Past the Json as class using the following in Visual Studiopastedimage
  3. 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>();}
  4. Then just navigate to  http://yourapplication:portno/swagger  to make sure all the datatypes for your particular operation are shown accordingly.
  5. Then download the swagger file from http://yourapplication:portno/swagger/docs/v1  and save it to a file
  6. 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…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: