#curl #openapi #cli

bin+lib oreq

The tool for interactively creating curl arguments from OpenAPI

13 releases

0.2.6 Jun 21, 2024
0.2.5 Jun 18, 2024
0.1.5 Jan 13, 2024
0.1.0 Dec 29, 2023

#1167 in Development tools

Download history 24/week @ 2024-03-28 12/week @ 2024-04-04 1/week @ 2024-05-16 1/week @ 2024-05-23 198/week @ 2024-06-06 551/week @ 2024-06-13 235/week @ 2024-06-20 1/week @ 2024-06-27

407 downloads per month

MIT license

72KB
2K SLoC

✍️ oreq

OpenAPI Request Prompts

The tool for interactively creating curl arguments from OpenAPI.

How to use

demo

Example

Basic use case

$ oreq github.yaml
   Build Request 

  Path
  /repos/{owner}/{repo}

  Method
  GET

  Path Parameters
  owner
  uzimaru0000

  repo
  oreq


-X GET 'https://api.github.com/repos/uzimaru0000/oreq'

Send a request using curl

$ oreq github.yaml | xargs curl
   Build Request 

  Path
  /repos/{owner}/{repo}

  Method
  GET

  Path Parameters
  owner
  uzimaru0000

  repo
  oreq


{
  "id": 736848036,
  "node_id": "R_kgDOK-topA",
  "name": "oreq",
  "full_name": "uzimaru0000/oreq",
  "private": false,
  "owner": {
    "login": "uzimaru0000",
    "id": 13715034,
    "node_id": "MDQ6VXNlcjEzNzE1MDM0",
    "avatar_url": "https://avatars.githubusercontent.com/u/13715034?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/uzimaru0000",
    ....

Read schema from pipe

curl -s https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.yaml | oreq -
   Build Request 

  Path
  /repos/{owner}/{repo}

  Method
  GET

  Path Parameters
  owner
  uzimaru0000

  repo
  oreq


-X GET 'https://api.github.com/repos/uzimaru0000/oreq'

USAGE

oreq [OPTIONS] <SCHEMA>

OPTIONS

-b, --base-url <BASE_URL>        Base URL
-H, --headers <HEADERS>
-p, --path <PATH>                Path to request
-X, --request <METHOD>           Method to use
-P, --param <PATH_PARAM>         Path parameters
-q, --query-param <QUERY_PARAM>  Query parameters
-f, --field <FIELD>              Request body
-h, --help                       Print help
-V, --version                    Print version

ARGS

<SCHEMA>    OpenAPI schema path

WIP 🚧

TODO

  • Resolve external reference

Dependencies

~13–22MB
~302K SLoC