参考:https://gitee.com/UnlimitedBladeWorks_123/apidoc-plugin-idea/blob/191/README.md
暂时不支持请求参数List<对象>的解析List
但是可以对象中包含List信息Mode中包含的List
ApiDoc
Install
- Using IDE built-in system on Windowndnndows:
- File > Settings > Plugins > Browse repositories... > Search for "ApiDoc" > Install Plugin
- Using IDE built-in plugin system on MacOs:
- Preferences > Settings > Plugins > Browse repositories... > Search for "ApiDoc" > Insttll Plugin
- Manually:
- From official jetbrains store Download the
latest release
and install it manually using Preferences > Plugins > Install plugin from disk...
- From official jetbrains store Download the
Usage
Use IDE menu
Use hotkey
Default Option + Ctrl + Shift + p(Mac), Alt + Ctrl + Shift + p (win)
Examples
- operation steps
- use npm command
apidoc
, to generate html
生成apidoc文档
项目根目录添加 apidoc.json
项目根目录添加 footer.md (编写结尾部分内容)
项目根目录添加 header.md (编写头部统一请求等内容呀)
{
"name": "apidoc-example",
"version": "1.0.0",
"description": "apiDoc example project",
"title": "Custom apiDoc browser title",
"url": "https://api.ciwei.com/v1",
"header": {
"title": "My own header title",
"filename": "header.md"
},
"footer": {
"title": "My own footer title",
"filename": "footer.md"
},
"order": [
"GetUser",
"PostUser"
],
"template": {
"withCompare": true,
"withGenerator": true
}
}
- name:项目名称
- version:项目版本
- description:项目介绍
- title:浏览器显示的标题内容
- url:endpoints的前缀,例如https://api.github.com/v1
- sampleUrl:如果设置了,则在api文档中出现一个测试用的from表单
- header
- title:导航文字包含header.md文件
- filename:markdown-file 文件名
- footer
- title:导航文字包含header.md文件
- filename:markdown-file 文件名
- order:用于配置输出 api-names/group-names 排序,在列表中的将按照列表中的顺序排序,不在列表中的名称将自动显示
生成apidoc文档:
结构:项目目录 /project 项目根目录/project/apidoc.json
apidoc -i ./项目目录 -o ./生成的目录
apigroup支持中文
vi C:\Users\Ciwei\AppData\Roaming\npm\node_modules\apidoc\node_modules\apidoc-core\lib\workers\api_group.js
// group = group.replace(/[^\w]/g, '_');