This tool filters OpenAPI v3 document contents, keeping only the content and its dependencies that match the provided filters.
brew install sukkola/tap/openapiv3-filteropenapiv3-filter api.yaml [OPTIONS]-
-h, --help: Prints help information -
-V, --version: Prints version information -
-a, --api-document <String>: Input file or - for stdin (default: -) -
-p, --path <String>: 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 <String>: HTTP method name used in the operation mapping.Examples:
--method 'post'- Matchespostmethods in the API specification--method 'post' --method 'get'- Matches bothpostandgetmethods in the document
-
--tag <String>: Tag name that is matched. Requires fully matched tag names.Examples:
--tag 'user_info'- Matchesuser_infotags in the document--tag 'user_info' --tag 'collection'- Matches bothuser_infoandcollectiontags in the document
-
--security <String>: Security name that is matched. Requires fully matched security names.Examples:
--security 'api_key'- Matches API document content that usesapi_keysecurity definitions--security 'api_key' --security 'basic_auth'- Matches bothapi_keyandbasic_authsecurity definitions in the document
# 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