Acontplus.ApiDocumentation 1.0.4

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

Acontplus.ApiDocumentation

NuGet .NET License

A modern .NET 9+ library for standardized API versioning and OpenAPI/Swagger documentation. Supports both controller-based and minimal APIs, with advanced customization and versioning support.


🚀 Features

  • API Versioning - Flexible, multi-version API support
  • Swagger/OpenAPI UI - Beautiful, customizable API docs
  • Minimal & Controller API Support - Works with both paradigms
  • JWT Bearer Auth UI - Secure your APIs and test with tokens
  • XML Comments - Show your code docs in Swagger UI
  • Custom Metadata - Configure contact, license, and more from appsettings.json
  • .NET 9+ Ready - Modern, fast, and future-proof

📦 Installation

dotnet add package Acontplus.ApiDocumentation

🎯 Quick Start (Controller-based API)

  1. Enable XML Documentation in your .csproj:

    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    
  2. Add SwaggerInfo to appsettings.json:

    "SwaggerInfo": {
      "ContactName": "Acontplus Development Team",
      "ContactEmail": "proyectos@acontplus.com",
      "ContactUrl": "https://acontplus.com.ec",
      "LicenseName": "MIT License",
      "LicenseUrl": "https://opensource.org/licenses/MIT"
    }
    
  3. Register services in Program.cs:

    using Acontplus.ApiDocumentation;
    
    var builder = WebApplication.CreateBuilder(args);
    builder.Services.AddControllers();
    builder.Services.AddApiVersioningAndDocumentation();
    
    var app = builder.Build();
    
    if (app.Environment.IsDevelopment())
    {
        app.UseApiVersioningAndDocumentation();
    }
    
    app.UseHttpsRedirection();
    app.UseAuthorization();
    app.MapControllers();
    app.Run();
    

🎯 Quick Start (Minimal API)

  1. Add the package:

    dotnet add package Microsoft.AspNetCore.OpenApi
    
  2. Register OpenAPI in Program.cs:

    var builder = WebApplication.CreateBuilder(args);
    builder.Services.AddOpenApi();
    
    var app = builder.Build();
    
    if (app.Environment.IsDevelopment())
    {
        app.MapOpenApi();
    }
    
    app.MapGet("/", () => "Hello world!");
    app.Run();
    

🗂️ API Versioning Example

[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class DataController : ControllerBase
{
    [HttpGet]
    public string Get() => "This is response from API version 1.0";
}

⚡ Migration & Troubleshooting Notes

  • Do NOT reference Microsoft.OpenApi directly.
    • For controller-based APIs, use Swashbuckle.AspNetCore.SwaggerGen and Swashbuckle.AspNetCore.SwaggerUI only. These packages bring the correct OpenAPI model types.
    • For minimal APIs, use Microsoft.AspNetCore.OpenApi.
  • If you see errors like The type or namespace name 'OpenApiInfo' could not be found:
    • Make sure you have not added Microsoft.OpenApi directly.
    • Ensure you have the following using statement:
      using Microsoft.OpenApi.Models;
      
    • Swashbuckle will bring in the correct version of Microsoft.OpenApi.Models.
  • For advanced UI and controller-based APIs, continue using Swashbuckle (AddSwaggerGen, UseSwaggerUI).
  • For minimal APIs, use the new built-in OpenAPI support in .NET 9+.

🛠️ Advanced Customization

  • Custom Swagger Info: Edit the SwaggerInfo section in appsettings.json.
  • JWT Bearer Auth: UI is pre-configured for Bearer tokens.
  • Multiple API Versions: Decorate controllers with [ApiVersion] and use versioned routes.
  • XML Comments: Enable in .csproj for rich documentation.

📄 License & Info


© 2024 Acontplus S.A.S. All rights reserved.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 82 7/11/2025
1.0.3 76 7/11/2025
1.0.2 121 7/9/2025
1.0.1 134 6/30/2025
1.0.0 132 6/30/2025

Updated for .NET 9+ with modern C# features, improved documentation, and enhanced OpenAPI/Swagger support.