APIWeaver is a powerful and lightweight library designed to provide a seamless integration of OpenAPI and Swagger UI into your .NET 6+ apps. APIWeaver supports the latest .NET features and is designed to be future-proof, ensuring support for upcoming .NET and OpenAPI features.
Microsoft is planning a built-in solution for generating OpenAPI documents. APIWeaver is focusing on API client generation.
To get started with APIWeaver, you can install the NuGet package using your preferred package manager. In most cases, the package APIWeaver.Swagger
is the one you are looking for.
- Install the NuGet package
dotnet add package APIWeaver.Swagger
- Add the using directive to your Program.cs file
using APIWeaver;
- Add the following lines to your
Program.cs
file.
builder.Services.AddApiWeaver();
// other code
if (app.Environment.IsDevelopment())
{
app.UseSwaggerUi();
}
That's it. You now have a fully functional Swagger UI in your application. The UI can be accessed by navigating to /swagger
in your browser 🥳. A more detailed guide with more use cases can be found here.
- Fully functional and configurable Swagger UI (with dark mode 🌙)
- OpenAPI 3.0 generation
- OpenAPI generation based on minimal APIs and controllers
- .NET 6, 7 and 8 including required members, nullable types and latest validation attributes
System.Text.Json
including serializer options like IncludeFields, IgnoreReadOnlyFields, IgnoreReadOnlyProperties and more- Custom transformers to modify the generated OpenAPI document asynchronously
- API client generation based on the generated OpenAPI document
This project is currently under active development, with ongoing improvements, new features and potential API changes. If you have any feedback, feature requests or issues, please feel free to open an issue or a pull request.
Your contributions to this project are welcomed and encouraged. Your active involvement can significantly impact its success!
Distributed under the MIT License. See LICENSE for more information. This means APIWeaver will always remain free.