Skip to main content

CLI tool for OpenAPI specifications

Project description

clapikit

CLI tool for OpenAPI specifications.

Description

clapikit (CLI + API + Kit) is a command-line tool that parses OpenAPI YAML/JSON files and provides a CLI interface to interact with APIs defined in those specifications. It dynamically generates subcommands based on the endpoints defined in the OpenAPI specification.

Installation

# Install with uvx
uvx clapikit

# Or install with pip
pip install clapikit

Usage

# List available commands from an OpenAPI specification
clapikit --spec https://example.com/openapi.yaml

# Execute an API endpoint
clapikit --spec https://example.com/openapi.yaml getUserInfo

# Override server URL
clapikit --spec https://example.com/openapi.yaml --server http://custom-server:8080 getUserInfo

# Enable debug output
clapikit --spec https://example.com/openapi.yaml --debug getUserInfo

# Send data with a request
clapikit --spec https://example.com/openapi.yaml createUser --data '{"name": "John", "email": "john@example.com"}'

# Specify query parameters
clapikit --spec https://example.com/openapi.yaml searchUsers --params '{"role": "admin", "limit": 10}'

# Set custom headers
clapikit --spec https://example.com/openapi.yaml getUserInfo --headers '{"Authorization": "Bearer token123"}'

# Control output format
clapikit --spec https://example.com/openapi.yaml getUserInfo --output text

Features

  • Parse OpenAPI YAML/JSON files from local paths or URLs
  • Dynamically generate subcommands based on API endpoints
  • Execute API requests directly from the command line
  • Override server URL from command line
  • Debug mode for detailed logging
  • Support for request data, query parameters, and headers
  • JSON and text output formats

Development

# Clone the repository
git clone https://github.com/youyo/clapikit.git
cd clapikit

# Install development dependencies
uv pip install -e .

# Run tests
python test_cli.py

Mock Server for Testing

You can use Prism to run a mock server for testing:

npx @stoplight/prism-cli mock https://learn.openapis.org/examples/v3.0/api-with-examples.yaml

License

See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clapikit-0.1.0.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clapikit-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file clapikit-0.1.0.tar.gz.

File metadata

  • Download URL: clapikit-0.1.0.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for clapikit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 96cead7435b17d1dac1e01f9ea2d37643f3f2773e6a1ae140ef690628125c6e3
MD5 01faa76fbe40d504e5dd70a356717614
BLAKE2b-256 c58b2751c35507e0999076b121073e7b0c8e097eede406cf505e7740e02a74a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for clapikit-0.1.0.tar.gz:

Publisher: publish.yaml on youyo/clapikit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clapikit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: clapikit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for clapikit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a162f097fbf9d62d14ec93db6a7eb7bb21afa3da05f6210e1d36088152fa6e81
MD5 f7f0a838ee7dddbb7ce48a8b5e7ba78e
BLAKE2b-256 560a2a9307505954a78648fcc548fa59a0fbaa8b4ab476b34c0888bfda38dfc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for clapikit-0.1.0-py3-none-any.whl:

Publisher: publish.yaml on youyo/clapikit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page