Reputation: 155
This may seem easy to others but I tried many methods that failed and this is so simple I wanted to share. I am using Web API with framework 4.5
Upvotes: 1
Views: 6958
Reputation: 155
First run your project and display the swagger by typing /swagger after the address. For example http://localhost:59558/swagger/. The swagger UI will display in a text input a value like http://localhost:59558/swagger/docs/v1. Copy this value and paste it into a new browser window or tab. The swagger data will be returned in json format. Select all the data (Ctl A), copy it (Ctl C) , and paste it (Ctl P) into a text editor like notepad++. Save it as a text file.
go to site editor.swagger.io. From the file drop down select Import File. Find the file you saved and import it. From the file drop down select save as yaml. The site will save to your download directory named swagger.yaml
Voila done deal easy peasy.
Upvotes: 7