Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/readmeio/oas-reducer
Reduce an OpenAPI definition into a smaller subset.
https://github.com/readmeio/oas-reducer
oas openapi
Last synced: about 1 month ago
JSON representation
Reduce an OpenAPI definition into a smaller subset.
- Host: GitHub
- URL: https://github.com/readmeio/oas-reducer
- Owner: readmeio
- License: mit
- Archived: true
- Created: 2021-07-19T17:57:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-28T22:25:28.000Z (about 2 years ago)
- Last Synced: 2024-09-25T10:41:59.193Z (about 2 months ago)
- Topics: oas, openapi
- Language: TypeScript
- Homepage:
- Size: 463 KB
- Stars: 1
- Watchers: 13
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
> **Warning**
>
> `oas-reducer` has moved! If you're looking for the CLI reducer you can use it in [rdme](https://npm.im/rdme) with its `rdme openapi:reduce` command, ad if you're looking for the programmatic API aspect of this library that has been relocated into [oas](https://npm.im/oas)# oas-reducer
Reduce an OpenAPI definition into a smaller subset.
[![Build](https://github.com/readmeio/oas-reducer/workflows/CI/badge.svg)](https://github.com/readmeio/oas-reducer/) [![](https://img.shields.io/npm/v/oas-reducer)](https://npm.im/oas-reducer)
[![](https://d3vv6lp55qjaqc.cloudfront.net/items/1M3C3j0I0s0j3T362344/Untitled-2.png)](https://readme.com)
## Installation
```
npm install -g oas-reducer
```## Usage
### Library
```js
import oasReducer from 'oas-reducer';console.log(
oasReducer(, options)
);
```> ⚠️ Note that the API definition supplied here must be: an OpenAPI 3.x definition and a JSON object.
#### Available options
- `tags`: An array of tags to reduce by. Example: `['pet']`
- `paths`: A key-value object of path + method combinations to reduce by. Example: `{'/pet': ['get', 'post']}`
- If you wish to retain all methods of a given path, supply `*` as the method array instead. Example: `{'/pet': '*'}`### CLI
```shell
$ oas-reducer
```The CLI will walk you through a couple of questions about how and what you want to reduce the file by and then it'll prompt you to save the newly reduced API definition to a new file! 🏅
> ⚠️ Note that the API definition supplied here must be an OpenAPI 3.x definition and can be either a JSON or YAML file path.