elidrissidev/openapi-merge

Merge multiple OpenAPI YML/JSON files into one

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 6

Type:application

1.5.2 2023-10-01 11:05 UTC

This package is auto-updated.

Last update: 2024-03-30 00:38:34 UTC


README

Test Status Docker Build Status codecov Mutation testing badge Latest Stable Version License

Read multiple OpenAPI 3.0.x YAML and JSON files and merge them into one large file.
This application is build on cebe/php-openapi

Installation

composer require marcelthole/openapi-merge

Usage

CLI

$ vendor/bin/openapi-merge --help

Usage:
    openapi-merge basefile.yml additionalFileA.yml additionalFileB.yml [...]  > combined.yml

Arguments

Argument Meaning
--match[=MATCH] Use a RegEx pattern to determine the additionalFiles. If this option is set the additionalFiles could be omitted (multiple values allowed)
--resolve-references[=RESOLVE-REFERENCES] Resolve the "$refs" in the given files [default: true]
-o, --outputfile[=OUTPUTFILE] Defines the output file for the result. Defaults the result will printed to stdout

Docker

Run the openapi-merge command within a docker container

docker pull ghcr.io/marcelthole/openapi-merge
docker run -v $PWD:/app --rm ghcr.io/marcelthole/openapi-merge [arguments]

Build the image locally from the sourcecode:

docker build --build-arg COMPOSER_REQUIRE_VERSION=<version> --no-cache -t marcelthole/openapi-merge:dev docker
docker run -v $PWD:/app --rm marcelthole/openapi-merge:dev [arguments]

Outputformat

The output format is determined by the basefile extension.