Package Exports
- openapi-operation-splitter
- openapi-operation-splitter/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (openapi-operation-splitter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
OpenApi Operation Splitter
Module and library that can use for splitting a given swagger/open-api file by an operation.
Installation
npm i openapi-operation-splitter
Cli
$ node_modules/.bin/openapi-operation-splitter --inputFile=passedValue --targetFileName=passedValue --operations=passedValue1 passedValue2
Options
Argument | Alias | Type | Description |
---|---|---|---|
inputFile | string | Input file | |
targetFileName | string | output file name | |
operations | string[] | http operations that would be extracted | |
help | h | boolean | Prints this usage guide |
Library Usage
import { OpenApiOperationSplitter } from 'openapi-operation-splitter';
async function main() {
const splitter = new OpenApiOperationSplitter();
const api = await splitter.parse('inputFile.yml');
const paths = splitter.getPathsObjectByOperation(api, "get");
api.paths = paths;
await splitter.saveApiToYaml(api, 'targetFile.yml');
}