Dosaic.Api.OpenApi 1.2.28

dotnet add package Dosaic.Api.OpenApi --version 1.2.28
                    
NuGet\Install-Package Dosaic.Api.OpenApi -Version 1.2.28
                    
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="Dosaic.Api.OpenApi" Version="1.2.28" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dosaic.Api.OpenApi" Version="1.2.28" />
                    
Directory.Packages.props
<PackageReference Include="Dosaic.Api.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 Dosaic.Api.OpenApi --version 1.2.28
                    
#r "nuget: Dosaic.Api.OpenApi, 1.2.28"
                    
#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 Dosaic.Api.OpenApi@1.2.28
                    
#: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=Dosaic.Api.OpenApi&version=1.2.28
                    
Install as a Cake Addin
#tool nuget:?package=Dosaic.Api.OpenApi&version=1.2.28
                    
Install as a Cake Tool

Dosaic.Api.OpenApi

A Dosaic plugin that integrates Swashbuckle / Swagger into a Dosaic web service. It registers the Swagger generator, serves the interactive Swagger UI at "/", auto-discovers XML documentation files, and ships built-in filters that improve schema quality for value objects, read-only properties, and file-upload endpoints. Optional OAuth 2.0 / JWT bearer authentication can be wired up through configuration.

Installation

dotnet add package Dosaic.Api.OpenApi

Usage

Registering the plugin

Add OpenApiPlugin to your host's plugin list. When using the source-generator based startup this happens automatically — the generator picks up OpenApiPlugin because it implements IPluginActivateable.

using Dosaic.Hosting.WebHost;

PluginWebHostBuilder.RunDefault(Dosaic.Generated.DosaicPluginTypes.All);

Configuration

The plugin reads its settings from the openapi section of your application configuration (any supported format: JSON, YAML, environment variables).

appsettings.json — minimal (no auth):

{
  "openapi": {}
}

appsettings.json — with OAuth 2.0 / JWT bearer auth enabled:

{
  "openapi": {
    "auth": {
      "enabled": true,
      "tokenUrl": "https://auth.example.com/realms/my-realm/protocol/openid-connect/token",
      "authUrl": "https://auth.example.com/realms/my-realm/protocol/openid-connect/auth"
    }
  }
}

appsettings.yaml equivalent:

openapi:
  auth:
    enabled: true
    tokenUrl: "https://auth.example.com/realms/my-realm/protocol/openid-connect/token"
    authUrl: "https://auth.example.com/realms/my-realm/protocol/openid-connect/auth"

Annotating endpoints with Swashbuckle Annotations

The plugin enables Swashbuckle.AspNetCore.Annotations, so you can decorate your controllers and minimal-API handlers:

using Swashbuckle.AspNetCore.Annotations;

[HttpGet("{id}")]
[SwaggerOperation(Summary = "Get an order by ID", Tags = ["Orders"])]
[SwaggerResponse(200, "Order found", typeof(OrderDto))]
[SwaggerResponse(404, "Order not found")]
public IActionResult GetOrder(Guid id) { ... }

XML documentation

XML doc comments are picked up automatically. Enable XML output in your project file and the plugin will include every *.xml file found next to your assembly:

<PropertyGroup>
  <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

Enum member summaries (optional)

EnumSummarySchemaFilter appends enum member XML summaries to the generated schema description.

  • Works for enum and Nullable<TEnum> schemas.
  • Skips members marked with [OpenApiIgnore].
  • Skips members with empty or missing XML <summary> docs.
  • Resolves XML docs by the enum type's assembly ({AssemblyName}.xml next to the binary) and additionally searches any documentation files passed at registration.
  • No-op if no XML documentation can be resolved.

OpenApiPlugin registers this filter by default and forwards the discovered XML files. If you configure Swagger manually, register it explicitly:

using Dosaic.Api.OpenApi.Filters.Schema;

services.AddSwaggerGen(options =>
{
    // Optionally pass extra XML docs to search as fallback
    var documentationFiles = Directory.GetFiles(AppContext.BaseDirectory, "*.xml");
    options.SchemaFilter<EnumSummarySchemaFilter>(new object[] { documentationFiles });
});

File-upload endpoints

Endpoints with IFormFile parameters are automatically converted to a multipart/form-data request body schema — no extra attributes required:

[HttpPost("upload")]
public IActionResult Upload(IFormFile file) { ... }

Value-object properties

Properties (or types) decorated with [Vogen.ValueObject] are transparently flattened in the generated schema to their underlying primitive type. The ValueObjectSchemaFilter handles the schema rewrite, and the ValueObjectDocumentFilter cleans up any leftover component schemas, so the generated OpenAPI document is accurate and free of $ref noise.

Read-only properties

Properties decorated with [ReadOnly(true)] from System.ComponentModel are marked readOnly: true in the generated schema:

using System.ComponentModel;

public class OrderDto
{
    [ReadOnly(true)]
    public Guid Id { get; init; }

    public string Description { get; set; }
}

Omitting models and fields from schema

Use [OpenApiIgnore] from Dosaic.Api.OpenApi.Filters.Common to omit elements from generated schemas.

  • On a property: removes that property from the containing schema.
  • On a type (class / struct): skips normal object expansion for that type.
  • On an enum: omits enum value metadata and keeps only the underlying primitive schema type.
  • On an enum member: removes that specific member from generated enum value metadata (including enum summary descriptions, when enabled).
using Dosaic.Api.OpenApi.Filters.Common;

public class CreateOrderRequest
{
    public string Description { get; set; }

    [OpenApiIgnore]
    public string InternalNote { get; set; }
}

Features

Feature Detail
OpenApiPlugin Dosaic plugin implementing IPluginServiceConfiguration, IPluginApplicationConfiguration, and IPluginEndpointsConfiguration
Swagger UI Served at the root path (/); displays request durations; auto-linked to swagger/v1/swagger.json
SwaggerGen Registers AddSwaggerGen with the application name as document title and version v1
XML comments All *.xml files next to the assembly are automatically included
Swashbuckle Annotations [SwaggerOperation], [SwaggerResponse], [SwaggerSchema], etc. enabled out of the box
ReadOnlyPropertySchemaFilter Marks properties annotated with [ReadOnly(true)] as readOnly: true in the schema
OpenApiIgnoreSchemaFilter Applies [OpenApiIgnore] rules to omit properties, selected enum members, or entire type details from generated schemas
EnumSummarySchemaFilter Optional schema filter that appends enum member XML summaries to schema descriptions, skipping ignored/empty/undocumented members
ValueObjectSchemaFilter Replaces Vogen value-object schemas with their underlying primitive type
ValueObjectDocumentFilter Removes residual value-object component schemas after the schema filter rewrites inline $refs
FormFileFilter Transforms IFormFile parameters into proper multipart/form-data request body schemas
OAuth 2.0 / JWT auth Optional bearer security scheme supporting Authorization Code, Client Credentials, Password, and Implicit flows

Configuration reference

// Bound from the "openapi" section
public class OpenApiConfiguration
{
    // Optional authentication settings
    public OpenApiAuthConfiguration Auth { get; set; }

    public class OpenApiAuthConfiguration
    {
        // Set to true to add the bearer security scheme and requirement
        public bool Enabled { get; set; }

        // Full token endpoint URL (used by Client Credentials, Password, and Authorization Code flows)
        public string TokenUrl { get; set; }

        // Full authorization endpoint URL (used by Implicit and Authorization Code flows)
        public string AuthUrl { get; set; }
    }
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 Dosaic.Api.OpenApi:

Package Downloads
Dosaic.Plugins.Endpoints.RestResourceEntity

A plugin-first dotnet framework for rapidly building anything hosted in the web.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.28 54 4/30/2026
1.2.27 79 4/29/2026
1.2.26 76 4/29/2026
1.2.25 102 4/27/2026
1.2.24 90 4/21/2026
1.2.23 99 4/14/2026
1.2.22 90 4/10/2026
1.2.21 90 4/10/2026
1.2.20 87 4/10/2026
1.2.19 85 4/9/2026
1.2.18 97 4/2/2026
1.2.17 87 4/1/2026
1.2.16 93 4/1/2026
1.2.15 90 3/31/2026
1.2.14 98 3/30/2026
1.2.13 91 3/26/2026
1.2.12 94 3/24/2026
1.2.11 94 3/17/2026
1.2.10 96 3/16/2026
1.2.9 90 3/13/2026
Loading failed