openax

command module
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 4 Imported by: 0

README ΒΆ

OpenAx πŸš€

npm version CI MIT License Release

A powerful command-line tool for filtering OpenAPI 3.x specifications. Extract specific paths, operations, and tags from large API specs while automatically resolving and including only the referenced components.

✨ Features

  • πŸ” Smart Filtering: Filter by paths, HTTP operations, and tags
  • 🧩 Dependency Resolution: Automatically includes referenced components
  • πŸ“ Multiple Sources: Load from files, URLs, or raw data
  • βœ… Validation: Built-in OpenAPI 3.x validation
  • πŸ› οΈ CLI & Library: Use as a command-line tool or Go library
  • πŸ“€ Multiple Formats: Output to JSON or YAML
  • πŸš€ High Performance: Efficient filtering with proper reference resolution

πŸš€ Quick Start

Installation
# Install globally via npm
npm install -g openax-cli

# Or use directly with npx (no installation required)
npx openax-cli --help
Alternative Installation
  • Binary downloads: GitHub Releases
  • For Go developers: go install github.com/imtanmoy/openax@latest
CLI Usage
# Validate an OpenAPI spec
openax --validate-only -i api.yaml

# Filter by tags
openax -i api.yaml --tags "users,orders" --format json

# Filter by operations and paths
openax -i api.yaml --operations "get,post" --paths "/api/v1"

# Save filtered result
openax -i api.yaml --tags "public" -o public-api.yaml
Examples
# Validate an OpenAPI spec
openax --validate-only -i api.yaml

# Filter by tags and save as JSON
openax -i api.yaml --tags "users,orders" --format json -o filtered.json

# Filter by operations and paths
openax -i api.yaml --operations "get,post" --paths "/api/v1" 

# Filter public APIs only
openax -i api.yaml --tags "public" -o public-api.yaml

# Use with remote URLs
openax -i https://api.example.com/openapi.yaml --tags "v1"

πŸ“– Documentation

CLI Reference
openax [options]

Flags:
  -i, --input string         Input OpenAPI spec file or URL (required)
  -o, --output string        Output file (stdout if not specified)
  -f, --format string        Output format: json or yaml (default: yaml)
  -p, --paths strings        Filter by paths (e.g., /users, /orders)
      --operations strings   Filter by operations (e.g., get, post, put, delete)
  -t, --tags strings         Filter by tags
      --validate-only        Only validate the spec without filtering
  -h, --help                 Show help
  -v, --version             Show version

🎯 Common Use Cases

  • API Documentation: Create focused docs from large specifications
  • Client Generation: Generate clients for specific service areas
  • Testing: Create minimal specs for testing specific functionality
  • Micro-services: Extract service-specific APIs from monolithic specs
  • Public APIs: Filter internal specs to expose only public endpoints
  • Versioning: Create version-specific API specifications

πŸ”§ Advanced Usage

Working with Large APIs
# Pre-validate large specs before filtering
openax --validate-only -i large-api.yaml

# Use specific filters for better performance
openax -i large-api.yaml --paths "/api/v1/users" --format json

# Combine multiple filters
openax -i api.yaml --tags "public" --operations "get,post" --paths "/api"
Integration with CI/CD
# Validate API specs in CI
openax --validate-only -i api.yaml || exit 1

# Generate client-specific specs
openax -i api.yaml --tags "mobile" -o mobile-api.yaml
openax -i api.yaml --tags "web" -o web-api.yaml

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


For Go developers: This tool is also available as a Go library. See the Go documentation for library usage examples.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
examples
custom-filter command
Package main demonstrates how to create custom filtering logic using openax.
Package main demonstrates how to create custom filtering logic using openax.
library command
Package main demonstrates how to use openax as a library.
Package main demonstrates how to use openax as a library.
pkg
loader
Package loader provides utilities for loading OpenAPI specifications from various sources.
Package loader provides utilities for loading OpenAPI specifications from various sources.
openax
Package openax provides OpenAPI specification filtering and validation capabilities.
Package openax provides OpenAPI specification filtering and validation capabilities.
validator
Package validator provides OpenAPI specification validation utilities.
Package validator provides OpenAPI specification validation utilities.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL