13 个版本
| 0.2.6 | 2024年6月21日 | 
|---|---|
| 0.2.5 | 2024年6月18日 | 
| 0.1.5 | 2024年1月13日 | 
| 0.1.0 | 2023年12月29日 | 
#459 在 网络编程
每月105次下载
72KB
 2K  SLoC
✍️ oreq
OpenAPI 请求提示
从 OpenAPI 交互式创建 curl 参数的工具。
如何使用

示例
基本用例
$ 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'
使用 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",
    ....
从管道读取模式
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'
用法
oreq [OPTIONS] <SCHEMA>
选项
-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
参数
<SCHEMA>    OpenAPI schema path
正在进行中 🚧
待办事项
- 解决外部引用
依赖项
~13–21MB
~300K SLoC