Skip to content

soenneker/soenneker.openapi.merger

Soenneker.OpenApi.Merger

A utility library to merge OpenApi specs

Installation

dotnet add package Soenneker.OpenApi.Merger

Usage

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

About

A utility library to merge OpenApi specs

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages