swagger.json is a generated JSON document that describes an HTTP API using the OpenAPI specification. Swashbuckle creates it from the ASP.NET Core application’s endpoints, request types, and response types. section 3.2.2 section 11.2.1
ASP.NET Core exposes the document at /swagger/v1/swagger.json through UseSwagger. SwaggerUI reads that JSON at /swagger and turns it into an interactive API client for browsing and testing endpoints. section 3.2.2 section 11.2.1
// ...
builder.Services.AddSwaggerGen(); #1
// ...
if (app.Environment.IsDevelopment())
{
app.UseSwagger(); #2
app.UseSwaggerUI(); #3
}
Register the generator, then enable the JSON middleware and user interface in the development environment. section 3.2.2
Grouping endpoints
Swashbuckle adds controller names to the document’s tags property, so controller-based endpoints appear in related SwaggerUI groups. Minimal API methods lack controllers and therefore need explicit tags, such as Tags = new[] { "Auth" } in SwaggerOperation. section 11.2.7
The default document uses OpenAPI 3.0 and API version 1.0. Swashbuckle options can change the specification version, add documents, customize the SwaggerUI page, and postmodify generated descriptions. section 3.2.2 section 11.5
