Swagger – Swashbuckle AspNetCore

Swagger tools for documenting and testing API’s built on ASP.NET Core

  1. Install Swashbuckle.AspNetCore from nuget
  2. In Startup.cs (ConfigureServices) add
1
2
3
4
5
6
7
services.AddMvc();

//Swashbuckle (Swagger)
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "Vodacommessaging Xml2sms", Version = "v1" });
});
  1. In Startup.cs (Configure) add
1
2
3
4
5
6
7
8
//In the Configure method, insert middleware to expose the generated Swagger as JSON endpoint(s)
app.UseSwagger();

//Optionally insert the swagger-ui middleware if you want to expose interactive documentation, specifying the Swagger JSON endpoint(s) to power it from.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Vodacommessaging Xml2sms V1");
});
  1. Run your application and browse to /swagger

Example project this has been added to : https://github.com/charleyza/VodacommessagingXml2sms

References