Koalesce 1.0.0-beta.10

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

Koalesce

Koalesce

Koalesce is an open-source .NET library for merging and sanitizing OpenAPI specifications.

.NET .NET License: MIT

⭐ If you find Koalesce useful, please consider giving it a star on GitHub!


🧩 The Problem

Working with OpenAPI specifications? You're probably dealing with:

Multiple APIs (Microservices)

  • πŸ”€ Frontend teams juggling multiple Swagger UIs across services.
  • πŸ“š Scattered API documentation with no unified view for consumers.
  • πŸ› οΈ Client SDK generation from scattered, disconnected specs.

Even a single API

  • 🧹 Specs exposing internal or admin endpoints that shouldn't be public.
  • πŸ”„ Legacy specs stuck on older OpenAPI versions needing conversion.
  • 🏷️ Tags and paths that need reorganization before publishing.

πŸ’‘ The Solution

Koalesce adapts to what you need:

Koalesce


πŸ“¦ Quick Start

1️⃣ Install

Install it based on how you want to use Koalesce.

# Koalesce as an ASP.NET Core Middleware (for applications)
dotnet add package Koalesce --prerelease
# Koalesce as a CLI standalone tool
dotnet tool install --global Koalesce.CLI --prerelease

2️⃣ Configure

Multiple APIs (merge specs from URLs or files)
// appsettings.json
{
  "Koalesce": {
    "OpenApiVersion": "3.0.1",
    "Info": {
      "Title": "My 🐨Koalesced API",
      "Description": "Unified API aggregating multiple services"
    },
    "Sources": [
      {
        "Url": "https://localhost:8002/swagger/v1/swagger.json",
        "VirtualPrefix": "/catalog",
        "PrefixTagsWith": "Products",
        "ExcludePaths": ["/internal/*", "*/admin/*"]
      },
      {
        "Url": "https://localhost:8003/swagger/v1/swagger.json",
        "VirtualPrefix": "/inventory",
        "PrefixTagsWith": "Inventory",
      }
    ],    
    "MergedEndpoint": "/swagger/v1/apigateway.yaml" // ignored when using CLI
  }
}
Single API (sanitize, filter, convert)
{
  "Koalesce": {
    "OpenApiVersion": "3.1.0", // convert from any version to OpenAPI 3.1
    "Info": {
      "Title": "My Public API",
      "Description": "Clean, public-facing API specification"
    },
    "Sources": [
      {
        "Url": "https://localhost:8002/swagger/v1/swagger.json",
        "ExcludePaths": ["/internal/*", "*/admin/*", "/debug/*"],
        "PrefixTagsWith": "v2"
      }
    ],
    "MergedEndpoint": "/swagger/v1/public-api.yaml" // the processed spec endpoint
  }
}

3️⃣ Run it!

Option A: Middleware (ASP.NET Core)
// Program.cs
builder.Services.AddKoalesce();
app.UseKoalesce();

Koalesce Swagger Screenshot

Option B: Using the CLI Tool
  koalesce -c .\settings.json -o .\Output\mergedspec.yaml --report .\Output\report.html

Koalesce CLI Screenshot

πŸ’‘ The CLI processes OpenAPI specifications directly into a file on disk without requiring a host application.


Merge Report

Koalesce generates a structured report summarizing everything that happened during the merge. Available as a formatted HTML page, or JSON based on the file path and extension you defined.

  • Middleware: set MergeReportEndpoint (e.g., /merge-report.html, /api/report.json) to serve the report.
  • CLI: use --report <path> to export the report to disk (e.g., --report ./output/report.html).

Koalesce Report Screenshot


πŸ“ How It Works

1. Load Sources

  • Read from URLs (https://api.com/swagger.json) or local files (./path/localspec.yaml).
  • Supports OpenAPI 2.0, 3.0.x, 3.1.x, 3.2.x in JSON and YAML formats.

2. Transform

  • Exclude endpoints with wildcard patterns (ExcludePaths).
  • Prefix tags for better grouping (PrefixTagsWith).
  • Convert between OpenAPI versions and output formats.

3. Merge (when 2+ sources are provided)

  • Path conflicts are handled by your choice: VirtualPrefix, First Wins, or Fail-Fast.
  • Schema name collisions are auto-renamed based on configuration (e.g., Inventory.Product β†’ InventoryProduct).

4. Output

  • A single, clean OpenAPI spec (JSON or YAML), targeting any version, ready for Swagger UI, Scalar, Kiota, or NSwag.

🌞 Where Koalesce Shines

Multiple APIs (merge specs from URLs or files) β†’ Unified Spec
  • βœ… Backend-for-Frontend (BFF): Unify multiple microservices into one API contract for your frontend team.
  • βœ… Developer Portals: Publish a single API reference for partners without exposing internal service boundaries.
  • βœ… Client SDK Generation: Generate one SDK from the unified spec (Kiota, NSwag, AutoRest) instead of managing multiple clients.
  • βœ… Mixed OpenAPI Versions: Merge specs from different OpenAPI versions (2.0, 3.0.x, 3.1.x) into one normalized output.
Single API β†’ Curate Your Spec
  • βœ… Public API Publishing: Strip internal, admin, or debug endpoints before sharing specs externally.
  • βœ… Version Conversion: Convert a legacy Swagger 2.0 spec to OpenAPI 3.1 with a single configuration.
  • βœ… Spec Cleanup: Remove unused schemas, reorganize tags, and filter paths β€” all through the same pipeline.
Both
  • βœ… CI/CD Validation: Validate and process API contracts in your pipeline using strict mode.
  • βœ… Format Conversion: Output as JSON or YAML, targeting any supported OpenAPI version.

πŸ’‘ Tip: For internal service-to-service communication, prefer direct service calls with dedicated clients per service to avoid tight coupling and unnecessary Gateway overhead.


🧠 Design Philosophy

Koalesce balances Developer Experience with architectural governance:

  • Resilient by Default: Skips unreachable services and duplicate paths with warnings.
  • Strict by Choice: Can be configured to fail on unreachable services or route collisions β€” useful for CI/CD pipelines or while developing.
  • Purposefully Opinionated: Ensures processed specifications have clean, deterministic, and conflict-free naming.
  • DX First: Designed to be easy to set up and use, with sensible defaults and clear error messages.

Koalesce respects your APIs as the source of truth, mutating only when necessary or convenient:

  • Preserve First: Original paths, descriptions, operations, and responses remain unchanged.
  • Mutate When Required: Automatically resolves conflicts (e.g., schema name collisions: Product β†’ CustomersProduct vs InventoryProduct).
  • Mutate When Convenient: Optional features like PrefixTagsWith, VirtualPrefix, ExcludePaths enhance organization and visibility.
  • Predictable: Same inputs always produce the same output.

πŸ’‘ In practice: Your source APIs define the contract. Koalesce processes them intelligently, changing only what's needed for conflict-free results or what you explicitly configure.



πŸ“§ Support & Contributing

  • Issues: Report bugs or request features via GitHub Issues.
  • Contributing: Contributions are welcome! Please read CONTRIBUTING.md before submitting PRs.
  • Sample Projects: Check out Koalesce.Samples for a complete implementation.

πŸ“ License

Koalesce is licensed under the MIT License.


⚠️ Migration: The packages Koalesce.OpenAPI and Koalesce.OpenAPI.CLI are now deprecated. Please migrate to Koalesce and Koalesce.CLI.

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 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

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.0-beta.10 79 2/25/2026
1.0.0-beta.9 60 2/21/2026
1.0.0-beta.8 61 2/16/2026
1.0.0-beta.7 44 2/14/2026
1.0.0-beta.6 44 2/13/2026
1.0.0-beta.5 68 2/7/2026
1.0.0-beta.4 48 2/5/2026
1.0.0-beta.3 44 2/3/2026
1.0.0-beta.2 45 2/2/2026
1.0.0-beta.1 57 2/1/2026