autogeneratedapi

自动生成api文档

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
autogeneratedapi
Minified + gzip package size for autogeneratedapi in KB

Readme

Auto Generated Api

一、作用

该插件是为了解决前端在根据API文档,编写请求接口(request)时,重复的复制Api文档的请求参数到代码中,这一不必要的重复性劳动。

image.png image.png

二、安装

1、安装Node.js

该插件是使用JavaScript编写,运行在Node.js环境上,在Node.js官方网站即可下载https://nodejs.org/en/.

2、安装ApiDoc

该插件是在Apidoc之上编写,需要安装ApiDoc,允许npm install apidoc -g安装,了解如何使用ApiDoc请查看官方网站http://apidocjs.com/

3、安装AutoGeneratedApi

Cmd命令行中输入npm install autogeneratedapi -g即可完成安装。

三、使用

1、查看帮助

C:\>generate -h

  Usage: generate [options]


  Options:

    -s, --source [value]       源代码文件夹(必须)
    -d, --destination [value]  API文档存放文件夹(必须)
    -h, --help                           output usage information

  Examples:

    generate --source C:\Users\Mr.pan\Desktop\SourceCode --destination C:\Users\Mr.pan\Desktop\ApiDocument

2、实例

cmd中运行命令generate --source 源代码文件夹 --destination API文档存放文件夹

C:\>generate --source C:\Users\Mr.pan\Desktop\dayangcode\PcbaProject\Java_workspace\customer\src\main\java\com\blt\customer\user\controller --destination C:\Users\Mr.pan\Desktop\新建文件夹
【INFO】: C: & cd C:\Users\Mr.pan\Desktop\新建文件夹 & apidoc -i C:\Users\Mr.pan\Desktop\dayangcode\PcbaProject\Java_workspace\customer\src\main\java\com\blt\customer\user\controller
warn: parser plugin 'return' not found in block: 1
warn: parser plugin 'return' not found in block: 2
warn: parser plugin 'return' not found in block: 3
warn: parser plugin 'param' not found in block: 4
warn: parser plugin 'param' not found in block: 4
warn: parser plugin 'return' not found in block: 4
warn: parser plugin 'param' not found in block: 5
warn: parser plugin 'param' not found in block: 5
warn: parser plugin 'return' not found in block: 5
warn: parser plugin 'param' not found in block: 6
warn: parser plugin 'param' not found in block: 6
warn: parser plugin 'return' not found in block: 6
warn: parser plugin 'param' not found in block: 7
warn: parser plugin 'param' not found in block: 7
warn: parser plugin 'return' not found in block: 7
warn: parser plugin 'param' not found in block: 0
warn: parser plugin 'param' not found in block: 0
warn: parser plugin 'return' not found in block: 0
info: Done.

【INFO】: 开始对API文档进行解析.
【INFO】: 1、重新组装API文档路径
【INFO】: 2、读取API文档
【INFO】: 3、转换API文档为JSON对象
【INFO】: 4、解析API文档
【INFO】: 5、将解析结果写入文件
【INFO】: 6、完成

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.