Minimal APIs (introduced in .NET 6, matured in .NET 9) wire HTTP endpoints as lambda functions. TypedResults<T> adds compile-time response type information for OpenAPI. Route groups apply middleware to related endpoints. Endpoint filters implement cross-cutting concerns (validation, auth). .NET 9 replaces Swashbuckle with a built-in OpenAPI document generator. [FromKeyedServices] injects named services directly into endpoints.
TypedResults for compile-time OpenAPI schema and typed responses.
TypedResults.Ok<T> carries compile-time type info picked up by the OpenAPI generator. Results.Ok() returns object — OpenAPI can't inspect it.
Inject a specific named service directly into an endpoint: MapGet("/", ([FromKeyedServices("redis")] ICache cache) => ...). No service locator needed.
In .NET 9, call app.MapOpenApi() and add a Scalar UI package. Swashbuckle is no longer the default and has fallen behind.
Sign in to share your feedback and join the discussion.