命令行
apidoc -i example/ -o apiDocs/
-i
读取用于生成文档的目录,比如src目录
-o
生成api文档静态页面的目录
-t
自定义的模板目录,默认使用apiDoc的模板
-f “.*.java$”
解析符合正则表达式的文件
-h
显示帮助信息
配置 apidoc.json
{
"name": "apidoc-example",
"version": "0.3.0",
"description": "apidoc example project",
"title": "Custom apiDoc browser title",
"url" : "https://api.github.com/v1",
"sampleUrl": "https://api.github.com/v1",
"header": {
"title": "My own header title",
"filename": "header.md"
},
"footer": {
"title": "My own footer title",
"filename": "footer.md"
},
"template": {
"withCompare": true,
"withGenerator": true
}
}
name
文档内容的最大标题
version
文档的版本号,一般保持在最新
description
文档的描述
title
显示网页的title
url
每个api地址前缀
sampleUrl
请求示例工具的地址前缀,当有此项时,会出现该工具
header/footer
文档的头部和尾部
title
头/尾部标题
filename
头部markdown文件
template
withCompare
自动生成版本比较功能的文件,默认 true
withGenerator
生成默认的apidoc版权,默认 true
@api {method} path [title]
method 请求方式: get/post/put…
path User/register
title 标题
@apiDescription text
api描述
@apiError [(group)] [{type}] field [description]
@apiErrorExample [{type}] [title]
example
@apiExample [{type}] title
example
@apiGroup name
@apiHeader [(group)] [{type}] [field=defaultValue] [description]
@apiHeaderExample [{type}] [title]
example
@apiIgnore [hint]
@apiName name
@apiParam [(group)] [{type}] [field=defaultValue] [description]
@apiParamExample [{type}] [title]
example
@apiPermission name
@apiSampleRequest url
@apiSuccess [(group)] [{type}] field [description]
@apiSuccessExample [{type}] [title]
example
@apiUse name
@apiVersion version
Comments