1.0.2 • Published 3 years ago

@xops.net/openrpc-cli v1.0.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

openrpc-cli

a command line tool for OpenRPC

Table of Contents

Installation

Running from source

git clone https://github.com/habenamare/bounty-openrpc-project
cd bounty-openrpc-project

npm install   # If using `npm`
yarn          # If using `yarn`

./bin/run     # Run the openrpc-cli program

Pack using pkg to create a single executable

The single executables created using pkg may be too big. This is because they include Node.js.

npm run build # If using `npm`
yarn build    # If using `yarn`

pkg package.json # After running `yarn` or `npm install`

Features

  • Make a single OpenRPC document from multiple files that are linked via $ref
  • Execute JSON-RPC requests to methods defined inside an OpenRPC document
  • Validate an OpenRPC document
  • YAML support

Usage

Use the help command or the --help option to get more info about the commands and their options.

openrpc-cli COMMAND [OPTIONS] FILE

FILE can be either a JSON file or a YAML file with a yaml or yml extension.

Bundle

Make a single OpenRPC document from multiple files that are linked via $ref

$ openrpc-cli bundle FILE

Options

  -f, --format=json|yaml  the output format [default: json]
  -o, --output=<file>     place the output into <file>, the default output is 'stdout'
  -s, --substitute        substitute $ref pointers with their resolved value

Examples

$ openrpc-cli bundle root-openrpc.json > output.json
$ openrpc-cli bundle root-openrpc.yaml > output.json
$ openrpc-cli bundle root-openrpc.yml > output.json

$ openrpc-cli bundle -f yaml root-openrpc.json > output.yaml

$ openrpc-cli bundle -o output.json root-openrpc.json
$ openrpc-cli bundle -f yaml -o output.yaml root-openrpc.json

$ openrpc-cli bundle -s root-openrpc.json
$ openrpc-cli bundle -s -f yaml root-openrpc.json
$ openrpc-cli bundle -s -f yaml -o output.yaml root-openrpc.json

Inspect

Execute JSON-RPC requests to methods defined inside an OpenRPC document

$ openrpc-cli inspect FILE

When connecting to a server, the following protocols are supported.

  • HTTP/HTTPS
  • WebSocket

Validate

Validate an OpenRPC document

$ openrpc-cli validate FILE

Dependencies

This project is inspired by swagger-cli and it makes use of the following great open-source libraries (in alphabetical order).

DependencyLicense
ajvMIT License
chalkMIT License
cli-highlightISC License
Inquirer.jsMIT License
JS-YAMLMIT License
JSON Schema $Ref ParserMIT License
oclifMIT License
OpenRPC Client JSApache License 2.0

License

This project is under the Apache License 2.0.

Notes

This project was forked from https://github.com/etclabscore/bounty-openrpc-project and was authored by: https://github.com/habenamar