In this video, Mike Kistler shares his top OpenAPI feature in .NET 9—build-time generation—offering insights on how it streamlines API development for .NET professionals.

Build-Time OpenAPI Documentation in .NET 9: Insights from Mike Kistler

In a recent episode of #OneDevQuestion, Mike Kistler highlights his favorite OpenAPI feature introduced in .NET 9: build-time generation of OpenAPI documentation.

Key Points Discussed

  • Build-Time Generation: .NET 9 now supports generating OpenAPI documentation as part of the build process. This eliminates the need for your application to serve the documentation at runtime.
  • Local Usage: Developers can utilize the generated OpenAPI docs locally, facilitating tasks such as:
    • Linting the API definition to ensure it conforms to best practices
    • Code generation from the OpenAPI specification for clients or servers
    • Applying tools like Spectral to enforce API design conventions

Benefits

  • Performance and Security: By moving documentation serving out of the application, runtime overhead and potential exposure are reduced.
  • Increased Flexibility: Local documentation files offer greater integration with CI/CD pipelines, linting, and external tools—improving the developer experience and code quality.

Tools Highlighted

  • Spectral: A popular tool for linting OpenAPI (and other API formats) to enforce consistency and catch issues early.

References and Further Reading


Author: dotnet