A walkthrough of fixing incomplete OpenAPI documentation in ASP.NET Core Minimal APIs. The core issue is that endpoints returning IResult produce no useful schema in Swagger docs. The fix involves switching return types to strongly-typed Results using TypedResults, using union return types to enumerate all possible responses, and calling .Produces<ProblemDetails>() when registering endpoints. A further refinement creates a custom BadRequestDetails class inheriting from ProblemDetails to document extension fields like invalid field lists, aligning the schema with RFC 7807 problem details standard.

โ€ข10m watch time
7.2K Impressions