https://github.com/soenneker/soenneker.openapi.merger
A utility library to merge OpenApi specs
https://github.com/soenneker/soenneker.openapi.merger
csharp dotnet fixing merge merger openapi openapimerger util
Last synced: about 1 month ago
JSON representation
A utility library to merge OpenApi specs
- Host: GitHub
- URL: https://github.com/soenneker/soenneker.openapi.merger
- Owner: soenneker
- License: mit
- Created: 2026-03-23T12:07:52.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-05-11T01:43:15.000Z (about 1 month ago)
- Last Synced: 2026-05-11T03:34:46.033Z (about 1 month ago)
- Topics: csharp, dotnet, fixing, merge, merger, openapi, openapimerger, util
- Language: C#
- Homepage: https://soenneker.com
- Size: 108 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
[](https://www.nuget.org/packages/soenneker.openapi.merger/)
[](https://github.com/soenneker/soenneker.openapi.merger/actions/workflows/publish-package.yml)
[](https://www.nuget.org/packages/soenneker.openapi.merger/)
#  Soenneker.OpenApi.Merger
### A utility library to merge OpenApi specs
## Installation
```
dotnet add package Soenneker.OpenApi.Merger
```
## Usage
```csharp
using Soenneker.OpenApi.Merger.Abstract;
OpenApiDocument mergedFromFiles = await openApiMerger.MergeOpenApis(
("contacts", @"C:\specs\contacts.json"),
("locations", @"C:\specs\locations.yaml"));
OpenApiDocument mergedFromDirectory = await openApiMerger.MergeDirectory(@"C:\specs");
string json = openApiMerger.ToJson(mergedFromDirectory);
OpenApiDocument mergedFromGit = await openApiMerger.MergeGitUrl("https://github.com/owner/repo");
OpenApiDocument mergedFromGitSubdirectory = await openApiMerger.MergeGitUrl("https://github.com/owner/repo", "apps");
```
The merger:
- can merge an explicit set of `(prefix, filePath)` OpenAPI inputs
- scans a directory recursively for `.json`, `.yaml`, and `.yml` OpenAPI files
- prefixes paths with the source file name when needed
- renames colliding component names and rewrites component `$ref` values to match
- can clone and merge directly from a Git repository URL