Therefore, when you create a new ASP.NET Core 5 Web API and immediately run the project, the browser will open up to the Swagger UI, allowing you to explore and test the API. app.UseSwagger() Īpp.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebApi v1")) Debug Launch SettingsĪnd last, you will notice that the debug launch settings have been set to open a browser to "swagger" to display the Swagger UI when the project is run. In the Configure method in the Startup.cs file you will see Swagger being added to the middleware pipeline. services.AddSwaggerGen(c =>Ĭ.SwaggerDoc("v1", new OpenApiInfo ) Swagger UI uses this document to populate a user interface that allows one to explore and test the ASP.NET Core Web API. In the ConfigureServices method in the Startup.cs file you will notice the configuration to create an OpenAPI Specifications Document.
If you edit the project file of a new ASP.NET Core 5 Web API, you will notice the inclusion of the Swashbuckle.AspNetCore package. Microsoft is simply including Swashbuckle as part of the template and configuring it with some default settings for your project. This isn't so much a new built-in feature as it is a change in the ASP.NET Core 5 Web API Project Template. One of the new features mentioned in the ASP.NET Core 5 announcement is the "built-in" support for OpenAPI and Swagger UI in ASP.NET Core 5 Web API's.