https://github.com/sukkola/openapiv3-filter
Cli tool for filtering openapi v3 documents
https://github.com/sukkola/openapiv3-filter
api api-rest cli openapi openapi-specification openapi3 tool tools web
Last synced: 4 months ago
JSON representation
Cli tool for filtering openapi v3 documents
- Host: GitHub
- URL: https://github.com/sukkola/openapiv3-filter
- Owner: sukkola
- License: other
- Created: 2025-02-21T09:57:58.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-03-26T17:41:34.000Z (11 months ago)
- Last Synced: 2025-07-05T06:52:52.959Z (7 months ago)
- Topics: api, api-rest, cli, openapi, openapi-specification, openapi3, tool, tools, web
- Language: Rust
- Homepage:
- Size: 71.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenAPI v3 Filter
This tool filters OpenAPI v3 document contents, keeping only the content and its dependencies that match the provided filters.
## Installation
```bash
brew install sukkola/tap/openapiv3-filter
```
## Usage
```bash
openapiv3-filter api.yaml [OPTIONS]
```
### Options
* `-h, --help`: Prints help information
* `-V, --version`: Prints version information
* `-a, --api-document `: Input file or - for stdin (default: -)
* `-p, --path `: Full path or partial path with `*` wildcard depicting a match for the rest of the content.
Examples:
* `--path '/pets'` - Exact match
* `--path '/pets/*'` - Match all paths under `/pets`
* `--path '*/pets'` - Match all paths ending with `/pets`
* `-m, --method `: HTTP method name used in the operation mapping.
Examples:
* `--method 'post'` - Matches `post` methods in the API specification
* `--method 'post' --method 'get'` - Matches both `post` and `get` methods in the document
* `--tag `: Tag name that is matched. Requires fully matched tag names.
Examples:
* `--tag 'user_info'` - Matches `user_info` tags in the document
* `--tag 'user_info' --tag 'collection'` - Matches both `user_info` and `collection` tags in the document
* `--security `: Security name that is matched. Requires fully matched security names.
Examples:
* `--security 'api_key'` - Matches API document content that uses `api_key` security definitions
* `--security 'api_key' --security 'basic_auth'` - Matches both `api_key` and `basic_auth` security definitions in the document
### Examples
```bash
# Filter operations with get method
openapiv3-filter api.yaml --method get
# Filter operations with paths containing 'users'
openapiv3-filter api.json --path '*users*'
# Filter operations with multiple tags
openapiv3-filter api.yaml --tag users --tag auth
# Combine multiple filters
openapiv3-filter api.json --path '/api/v1/*' --method post --tag admin