GitHub - SessionHu/json-apidoc-gen: Simple CLI tool for generating BAC document template (original) (raw)

JSON APIDoc Generator (json-apidoc-gen)

Haskell

JSON APIDoc Generator is a simple command-line tool written in Haskell for generating BAC document templates from JSON inputs.

Features

Installation

Build from Source

Dependencies:

Steps:

  1. Clone the repository:
    git clone https://github.com/SessionHu/json-apidoc-gen.git
    cd json-apidoc-gen
  2. Build the project using Cabal:
  3. Run the CLI tool:

Usage

Arguments

Usage:
  --mininal  only output `JSON Response` forms
  --help     display this help and exit
  --version  output version information and exit

JSON Input

The tool reads JSON data from the standard input. You can provide input in the following ways:

Command Output

The tool generates a documentation template in Markdown format and outputs it to the standard output. Usually you can pipe or redirect it to another file. The typical structure includes:

Example

Given the following JSON data:

{ "code": 0, "msg": "0", "ttl": 1, "data": { "hello": "world", "bili": [ "qwq", "awa", "sess" ], "count": 114514 } }

The tool generates the following documentation template:

title

https://

*请求方法: *

认证方式:

URL 参数:

JSON 回复:

根对象:

字段 类型 内容 备注
code number
data object
msg string
ttl number

data 对象:

字段 类型 内容 备注
bili string[]
count number
hello string

示例:

curl -
查看响应示例:
{
  "code": 0,
  "data": {
    "bili": [
      "qwq",
      "awa",
      "sess"
    ],
    "count": 114514,
    "hello": "world"
  },
  "msg": "0",
  "ttl": 1
}

Error Handling

Known Issues

License

This project is licensed under the GNU General Public License v3.0.


Thank you for using JSON APIDoc Generator! If you encounter any issues or have suggestions for improvement, feel free to submit an Issue.