How to use the new built-in OpenAPI support in .NET 9, including build-time generation, linting, and Swagger UI integration.
.NET 9 OpenAPI - Part 2
In part 1 (youtu.be/m4qAZifm42o) we took a deeper look into the existing OpenAPI world using .NET 8 and Swagger. Now we finally use the new .NET 9 built-in functionallity.
EDIT: The schema resolving error at [] is already addressed in GitHub at github.com/dotnet/aspnetcore/issues/58968#issuecomment-25904… and will be fixed soon.
Links:
- Github sources: github.com/codingfreak/blogsamples/tree/master/ApiConversion
- MS learn for this: learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/o…
What I show here in short:
- Going from a new template to a full solution.
- Still using Swagger as the UI.
- Using OAuth2 authorization.
- Build-time generation of JSON.
- Linting your JSON.
- Generating Operation IDs.
- Generating XML-file based endpoint docs.
- Problems detected with the new packages on schema generation.
[] Intro
[] Presentation
[] The new project template
[] Starting to customize
[] Apply API versionning with Swagger UI
[] OpenAPI Document Transformer: Metadata
[] OpenAPI Document Transformer: Security Schemes
[] User secrets and Swagger Auth Button back
[] OpenAPI Operation Transformer: Security Schemes with endpoint metadata
[] OpenAPI Operation Transformer: Operation Ids and spectral linting
[] VS restart because mouse pointer frozen 😒
[] OpenAPI Operation Transformer: XML-file-based descriptions and summaries
[] A current limitation: Problems with schemas and inheritance
[] Outro
Why it's here
1 person recommends this
What people say. Recommended as a comprehensive walkthrough of migrating to the new built-in OpenAPI features in .NET 9.
W
u/WingedHussar98in r/dotnet • Recommends
Moving to .NET 9 and OpenAPI
Over the last month there have been quite a few questions and discussions regarding OpenAPI and .NET 9 so I wanted to share the following 2 parted Video as a hopefully helpful ressource.
Part 1: Focussing on the "classic" way with swashbuckle and .NET 8
link to this video
Part 2: Focussing on moving to .NET 9 and OpenAPI
link to this video