Muonroi.AspNetCore.OpenApi 1.0.0-alpha.16

This is a prerelease version of Muonroi.AspNetCore.OpenApi.
dotnet add package Muonroi.AspNetCore.OpenApi --version 1.0.0-alpha.16
                    
NuGet\Install-Package Muonroi.AspNetCore.OpenApi -Version 1.0.0-alpha.16
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Muonroi.AspNetCore.OpenApi" Version="1.0.0-alpha.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Muonroi.AspNetCore.OpenApi" Version="1.0.0-alpha.16" />
                    
Directory.Packages.props
<PackageReference Include="Muonroi.AspNetCore.OpenApi" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Muonroi.AspNetCore.OpenApi --version 1.0.0-alpha.16
                    
#r "nuget: Muonroi.AspNetCore.OpenApi, 1.0.0-alpha.16"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Muonroi.AspNetCore.OpenApi@1.0.0-alpha.16
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Muonroi.AspNetCore.OpenApi&version=1.0.0-alpha.16&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Muonroi.AspNetCore.OpenApi&version=1.0.0-alpha.16&prerelease
                    
Install as a Cake Tool

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.

NuGet License: Apache 2.0

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 documentationMErrorResponseFilter adds Bad Request and Internal Server Error response entries (with the MErrorResponse schema) to every operation that does not already declare them.
  • Parameter default propagationSwaggerDefaultValues reads ApiParameterDescription.DefaultValue via the ASP.NET Core API explorer and serializes it into the OpenAPI schema using IMJsonSerializeService.
  • 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.Description to the OpenAPI parameter description when none is set explicitly.
  • Required flag enforcement — marks parameters as required when ApiParameterDescription.IsRequired is 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)
  • Muonroi.Core.Abstractions — defines IMJsonSerializeService consumed by SwaggerDefaultValues
  • Muonroi.Core — provides the MJsonSerializeService implementation and MErrorResponse type
  • Muonroi.Mediator — mediator integration used alongside this package in API projects

License

Apache-2.0. See LICENSE-APACHE.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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