OpenAPI and Swagger
OpenAPI
The OpenAPI Specification (formerly the Swagger Specification) is a language-agnostic standard for describing REST APIs. An OpenAPI document, typically in JSON or YAML format, defines the API endpoints, operations, parameters, request and response schemas, authentication methods, and more.
Swagger tools
Swagger is a suite of tools built around the OpenAPI Specification:
- Swagger UI for interactive API documentation
- Swagger Editor for designing OpenAPI definitions
- Swagger Codegen for generating client SDKs and server stubs
In ASP.NET Core
The Swashbuckle.AspNetCore NuGet package is commonly used to generate OpenAPI documents automatically from API controllers, using reflection and attributesAttributes and reflectionAttributes tag code with metadata, and reflection reads that metadata back at runtime.Opens in a new tab. It also serves the Swagger UI for interactive documentation and testing. This is invaluable for API discoverability and consumption.
Sources
- Mastering Restful API Design with ASP.NET Core: Best Practices, Hamid Mosalla · accessed May 16, 2025