GM.Documentation 1.3.0

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

<p align="center"> <img src="https://raw.githubusercontent.com/gmetskhvarishvili/GM.Documentation/master/icon.png" alt="GM.Documentation" width="140" height="140" /> </p>

GM.Documentation

CI NuGet License: MIT

A lightweight, configuration-driven Swagger/OpenAPI setup for ASP.NET Core. Two calls give you a fully configured Swagger UI — API versioning, FluentValidation rules in the schema, OAuth2 security, required-header parameters, custom date formatting, and custom CSS/JS — all driven from configuration. Part of the GM.* family of packages. Targets net10.0.

It builds on Swashbuckle, Asp.Versioning, and MicroElements.Swashbuckle.FluentValidation.

Install

dotnet add package GM.Documentation

Register

using GM.Documentation;

builder.Services.AddGMDocumentation(builder.Configuration, "Swagger");

Use

var app = builder.Build();

app.UseGMDocumentation();

That serves the UI at the app root (/), wires one Swagger document per discovered API version, and injects Assets/swagger.css + Assets/swagger.js if present.

Configure

Everything comes from the configuration section you name (shape matches SwaggerDocOptions); every value is optional and falls back to a sensible default:

{
  "Swagger": {
    "Enabled": true,
    "Title": "My API",
    "Description": "My API description",
    "DateTimeFormat": "dd/MM/yyyy HH:mm",
    "Headers": [ "X-Tenant-Id" ],
    "Contact": { "Name": "Team", "Email": "team@example.com", "Url": "https://example.com" },
    "License": { "Name": "MIT", "Url": "https://opensource.org/licenses/MIT" },
    "Authorization": {
      "Scheme": "oauth2",
      "Name": "Authorization",
      "Authority": "https://identity.example.com",
      "TokenEndpoint": "https://identity.example.com/connect/token",
      "RequiredScopes": "api openid profile",
      "Flows": [ "authorizationCode", "clientCredentials" ],
      "ClientName": "swagger",
      "ClientSecret": "secret"
    }
  }
}

You can also override options in code — values passed here win over configuration:

builder.Services.AddGMDocumentation(builder.Configuration, "Swagger", new SwaggerDocOptions
{
    Title = "Overridden Title"
});

What you get

  • API versioning — one Swagger document per IApiVersionDescriptionProvider group (falls back to v1).
  • FluentValidation in the schema — validators are reflected into the OpenAPI schema.
  • OAuth2 security — authorization code, client credentials, password, and implicit flows from config.
  • Required headers — headers listed in config are added to every operation.
  • Custom date formattingDateTime/DateTime? render with your configured format.
  • Custom UI assetsAssets/swagger.css and Assets/swagger.js are injected when present.
  • XML comments — every *.xml doc file next to the app is included automatically.

Contributing & releases

Versioning is automated from Conventional Commits — see CONTRIBUTING.md.

License

MIT — see LICENSE.

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 GM.Documentation:

Package Downloads
GM.API

An opinionated ASP.NET Core Web API starter for .NET. A single AddGMAPI/UseGMAPI pair wires up controllers, CORS, API versioning, Swagger docs, FluentValidation, Serilog, and middlewares for exception handling, request logging (with sensitive-data masking) and request localization. Bundles the GM.API.* companion packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 121 7/30/2026
1.2.0 118 7/2/2026
1.1.0 270 6/5/2025
1.0.0 324 5/13/2025