Koalesce.OpenAPI 0.1.0-alpha

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

🐨 Koalesce

Koalesce is a .NET library designed to merge multiple OpenAPI definitions into a unified document to enable seamless API Gateway integration and simplify frontend client generation for microservices-based architectures.


How It Works?

  • Koalesce fetches OpenAPI definitions from the specified SourceOpenApiUrls.
  • It then merges them using supported providers, generating a single schema at MergedOpenApiPath.
  • The final Koalesced API definition is serialized and available in JSON or YAML format.

⚡ Features

  • ✅ Coalesce multiple OpenAPI definitions into one unified schema.
  • ✅ Fully configurable via appsettings.json.
  • ✅ Aligns perfectly with API Gateways.
  • ✅ Aligns perfectly with UI tools for interacting with API endpoints.
  • ✅ Allows output a json or yaml merged document regardless the document type of the source APIs.
  • ✅ Streamlines API client generation since it results in one unified schema.
  • ✅ Extensible architecture to support new API aggregation strategies.

⚙️ Basic Configuration

Setting Type Default Value Description
SourceOpenApiUrls array 🔺 Source list of OpenAPI URLs to merge.
MergedOpenApiPath string 🔺 Path where the merged API definition is exposed.
Title string "My 🐨Koalesced OpenAPI" Title for the Koalesced API definition.
SkipIdenticalPaths boolean true If false, Koalesce will throw an exception when detecting identical API paths across merged definitions. If true, it will log a warning and skip them.
ApiGateWayBaseUrl string null / empty If provided, Koalesce will ensure a single server for the entire merged document.
  • 💡Parameters listed with 🔺 are required.
  • 💡The file extension [.json, .yaml] defined in MergedOpenApiPath will define the merged output format.
  • 💡Koalesce respects the order of SourceOpenApiUrls. This affects how identical paths are handled based on the SkipIdenticalPaths setting.
{
  "Koalesce": {
    "SourceOpenApiUrls": [
      "https://api1.com/swagger/v1/swagger.json",
      "https://api2.com/swagger/v1/swagger.json"
    ],
    "MergedOpenApiPath": "/swagger/v1/apigateway.json",
    "Title": "My Koalesced API",
    "SkipIdenticalPaths": true,
    "ApiGatewayBaseUrl": "https://api-gateway.com:5000",
    "Cache": {
      "DisableCache": false,
      "AbsoluteExpirationSeconds": 86400,
      "SlidingExpirationSeconds": 300,
      "MinExpirationSeconds": 30
    }
  }
}
🛠️ Caching Configuration (Koalesce.Cache)
Setting Type Default Value Description
DisableCache boolean false If true, Koalesce will always recompute the merged OpenAPI document on each request instead of caching it.
AbsoluteExpirationSeconds integer 86400 (24h) The maximum duration (in seconds) before the cached OpenAPI document is forcibly refreshed, regardless of access.
SlidingExpirationSeconds integer 300 (5 min) Resets cache expiration every time the document is accessed. If not accessed within this period, the cache expires earlier than its absolute expiration.
MinExpirationSeconds integer 30 Minimum allowed expiration time (in seconds). Prevents setting an excessively low cache duration that could cause unnecessary recomputation.
{
  "Koalesce": {
    "Title": "My Koalesced API",
    "SourceOpenApiUrls": [
      "https://api1.com/swagger/v1/swagger.json",
      "https://api2.com/swagger/v1/swagger.json"
    ],
    "MergedOpenApiPath": "/swagger/v1/apigateway.json",    
    "SkipIdenticalPaths": true,
    "ApiGatewayBaseUrl": "https://api-gateway.com",
    "Cache": {
      "DisableCache": false,
      "AbsoluteExpirationSeconds": 86400,
      "SlidingExpirationSeconds": 300,
      "MinExpirationSeconds": 30
    }
  }
}

📦 Installation

🟢 For OpenAPI

dotnet add package Koalesce.OpenAPI
⚙️ Package-specific Configuration

🔺 This configuration extends the basic settings. Ensure that your Koalesce section includes all required base options.

Setting Type Default Value Description
Koalesce.OpenApiVersion string "3.0.1" OpenAPI version.
{
  "Koalesce": 
  {
    "OpenApiVersion": "3.0.1",
    "Title": "My Koalesced OpenAPI",
    "SourceOpenApiUrls": [
      "https://localhost:5001/swagger/v1/swagger.json",
      "https://localhost:5002/swagger/v1/swagger.json",
      "https://fakerestapi.azurewebsites.net/swagger/v1/swagger.json"
    ],
    "MergedOpenApiPath": "/swagger/v1/swagger.yaml"
  }
}

🛠️ Usage with .NET pipeline

1️⃣ Register Koalesce.[ForProvider()]

In Program.cs:

builder.Services.AddKoalesce()
  // Register Koalesce.OpenAPI provider
  .ForOpenAPI();

2️⃣ Enable Middleware

app.UseKoalesce();

🔥 Running an Application (using Swagger.UI)

  • Start the application:

    dotnet run
    
  • Access the Koalesced API via Swagger UI:

    https://localhost:[port]/swagger/index.html
    
  • The merged OpenAPI definition should be available at:

    https://localhost:[port]/[MergedOpenApiPath]
    

📝 License & Contribution

Koalesce is licensed under the MIT License.
Contributions are welcome! Feel free to submit issues and PRs on GitHub.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Koalesce.OpenAPI:

Repository Stars
falberthen/EcommerceDDD
Experimental full-stack application showcasing Domain-Driven Design, Microservices, Event Sourcing, CQRS and Angular.
Version Downloads Last Updated
1.0.0-alpha.12 90 1/28/2026 1.0.0-alpha.12 is deprecated.
1.0.0-alpha.11 59 1/26/2026
1.0.0-alpha.10 67 1/23/2026
1.0.0-alpha.9 62 1/22/2026
1.0.0-alpha.8 58 1/20/2026
1.0.0-alpha.7 58 1/20/2026
1.0.0-alpha.6 52 1/18/2026
1.0.0-alpha.5 60 1/16/2026
1.0.0-alpha.4 63 1/14/2026
1.0.0-alpha.3 72 1/11/2026
1.0.0-alpha.2 67 1/5/2026
1.0.0-alpha.1 68 1/2/2026
0.1.1-alpha.2 290 4/11/2025
0.1.1-alpha.1 159 4/10/2025
0.1.0-alpha 226 3/16/2025