Natively Pronounced Mandarin
    Wondering what’s next for npm?Check out our public roadmap! »

    TypeScript icon, indicating that this package has built-in type declarations

    1.0.29 • Public • Published


    This library assumes that you have a number of microservices that you wish to expose through one main service or gateway.

    With this assumption in mind, it allows you to provide multiple OpenAPI 3.0 files and have them be merged together, in a deterministic manner, into a single OpenAPI specification.

    Many of the design decisions of this library have that use case in mind and thus the features will be geared to making that be a good experience.

    If you are looking for a CLI tool based on this library, then please check out: npm

    Merging Behaviour

    We process the inputs sequentially such that the first input in the list takes preference and subsequent inputs will be modified to merge seamlessly into the first.

    For some parts of the OpenAPI file, like paths, components and tags we attempt to merge the definitions together such that there are no overlaps and no information is dropped.

    However, for other elements of the OpenAPI files, the algorithm simply takes the value that is first defined in the list of OpenAPI files. Examples of elements of the OpenAPI files that follow this pattern are:

    • Info
    • Servers
    • Security Schemes
    • ExternalDocumentation

    The intention here is that the first file will define these elements and effectively override them from the other files. This matches the "API gateway" use case that we have mentioned previously whereby we probably want these definitions to be specific to the API gateway and thus override the top level definitions from other inputs.



    npm i openapi-merge

    DownloadsWeekly Downloads






    Unpacked Size

    46.9 kB

    Total Files


    Last publish


    • avatar