Muonroi.AspNetCore.OpenApi
1.0.0-alpha.16
dotnet add package Muonroi.AspNetCore.OpenApi --version 1.0.0-alpha.16
NuGet\Install-Package Muonroi.AspNetCore.OpenApi -Version 1.0.0-alpha.16
<PackageReference Include="Muonroi.AspNetCore.OpenApi" Version="1.0.0-alpha.16" />
<PackageVersion Include="Muonroi.AspNetCore.OpenApi" Version="1.0.0-alpha.16" />
<PackageReference Include="Muonroi.AspNetCore.OpenApi" />
paket add Muonroi.AspNetCore.OpenApi --version 1.0.0-alpha.16
#r "nuget: Muonroi.AspNetCore.OpenApi, 1.0.0-alpha.16"
#:package Muonroi.AspNetCore.OpenApi@1.0.0-alpha.16
#addin nuget:?package=Muonroi.AspNetCore.OpenApi&version=1.0.0-alpha.16&prerelease
#tool nuget:?package=Muonroi.AspNetCore.OpenApi&version=1.0.0-alpha.16&prerelease
Muonroi.AspNetCore.OpenApi
Swashbuckle operation filters that add standardized error-response documentation and clean up parameter defaults for every endpoint in your Muonroi ASP.NET Core API.
Muonroi APIs return a consistent MErrorResponse shape for validation failures and unhandled exceptions. Without extra setup, Swashbuckle omits those responses from generated OpenAPI documents and leaves parameter default values blank. This package ships two IOperationFilter implementations that correct both gaps automatically at Swagger-gen time — no per-endpoint attributes required.
Installation
dotnet add package Muonroi.AspNetCore.OpenApi --prerelease
Quick Start
Register both filters inside AddSwaggerGen. SwaggerDefaultValues depends on IMJsonSerializeService; register its implementation from Muonroi.Core first.
using Muonroi.AspNetCore.OpenApi.OpenApi;
using Muonroi.Core.Abstractions.Interfaces;
using Muonroi.Core.Abstractions.SeedWorks;
// Concrete IMJsonSerializeService lives in Muonroi.Core.
builder.Services.AddSingleton<IMJsonSerializeService, MJsonSerializeService>();
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new()
{
Title = "My API",
Version = "v1"
});
// Auto-document 400 + 500 MErrorResponse on every endpoint.
options.OperationFilter<MErrorResponseFilter>();
// Fill parameter defaults/descriptions and prune unsupported content types.
options.OperationFilter<SwaggerDefaultValues>();
});
// ...
app.UseSwagger();
app.UseSwaggerUI();
Features
- Automatic 400/500 documentation —
MErrorResponseFilteraddsBad RequestandInternal Server Errorresponse entries (with theMErrorResponseschema) to every operation that does not already declare them. - Parameter default propagation —
SwaggerDefaultValuesreadsApiParameterDescription.DefaultValuevia the ASP.NET Core API explorer and serializes it into the OpenAPI schema usingIMJsonSerializeService. - Content-type pruning — removes content types from response entries that the endpoint's formatters do not actually support, keeping the generated document accurate.
- Parameter description fill-in — copies
ModelMetadata.Descriptionto the OpenAPI parameter description when none is set explicitly. - Required flag enforcement — marks parameters as required when
ApiParameterDescription.IsRequiredis true.
Configuration
There are no options classes or appsettings keys. Registration is entirely through Swashbuckle's SwaggerGenOptions:
builder.Services.AddSwaggerGen(options =>
{
options.OperationFilter<MErrorResponseFilter>();
options.OperationFilter<SwaggerDefaultValues>();
});
SwaggerDefaultValues requires IMJsonSerializeService to be registered in the DI container. The concrete MJsonSerializeService is in Muonroi.Core.
API Reference
| Type | Purpose |
|---|---|
MErrorResponseFilter |
IOperationFilter — appends 400 and 500 MErrorResponse entries to operations that lack them |
SwaggerDefaultValues |
IOperationFilter — propagates parameter defaults/descriptions and prunes unsupported content types; depends on IMJsonSerializeService |
Samples
- Quickstart.OpenApi — minimal ASP.NET Core API demonstrating both filters with a catalog controller
Compatibility
- Target framework: net8.0
- License: Apache-2.0 (OSS)
Related Packages
Muonroi.Core.Abstractions— definesIMJsonSerializeServiceconsumed bySwaggerDefaultValuesMuonroi.Core— provides theMJsonSerializeServiceimplementation andMErrorResponsetypeMuonroi.Mediator— mediator integration used alongside this package in API projects
License
Apache-2.0. See LICENSE-APACHE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Muonroi.Core.Abstractions (>= 1.0.0-alpha.16)
- Muonroi.Mediator (>= 1.0.0-alpha.16)
- Swashbuckle.AspNetCore (>= 8.1.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Muonroi.AspNetCore.OpenApi:
| Package | Downloads |
|---|---|
|
Muonroi.AspNetCore
ASP.NET Core integration: auto-CRUD controllers, middleware pipeline, license protection, and Muonroi hosting extensions. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-alpha.16 | 64 | 6/22/2026 |
| 1.0.0-alpha.15 | 110 | 5/31/2026 |
| 1.0.0-alpha.14 | 103 | 5/15/2026 |
| 1.0.0-alpha.13 | 84 | 5/2/2026 |
| 1.0.0-alpha.12 | 72 | 4/2/2026 |
| 1.0.0-alpha.11 | 123 | 4/2/2026 |
| 1.0.0-alpha.9 | 67 | 3/30/2026 |
| 1.0.0-alpha.8 | 151 | 3/28/2026 |
| 1.0.0-alpha.7 | 75 | 3/27/2026 |
| 1.0.0-alpha.5 | 60 | 3/27/2026 |
| 1.0.0-alpha.4 | 70 | 3/27/2026 |
| 1.0.0-alpha.3 | 62 | 3/27/2026 |
| 1.0.0-alpha.2 | 69 | 3/26/2026 |
| 1.0.0-alpha.1 | 67 | 3/8/2026 |