Saturday, October 21, 2017

swagger integration into webapi project (Part 2 - .net core)

While trying to setup a test web-api solution in .net core I was wondering whether the swagger integration even works for .net core with the swashbuckle nuget and yes... it does work!

I used swashbuckle.aspnetcore (with .swagger / .swaggergen / .swaggerui)

the only things I had to add in startup.cs were:

ConfigureService:

  • addmvc
  • addmvccore
  • addapiexplorer
  • addswaggergen
    • swaggerdoc
    • includexmlcomments
Configure:
  • usemvc
  • useswagger
  • useswaggerUI
    • SwaggerEndpoint
done.

Every created controller will from now on be listed in swagger UI.

No comments: