apiDoc构建源代码注释的接口文档
RESTful web API Documentation Generator. http://apidocjs.com
入门
前言
本文档中的所有示例都使用Javadoc-Style(可用于C#,Go,Dart,Java,JavaScript,PHP,TypeScript和所有其他支持Javadoc的语言):
/*** This is a comment.*/
安装
npm install apidoc -g
配置(apidoc.json)
apidoc.json
项目中的可选项root dir包含有关项目的常用信息,如标题,简短说明,版本和配置选项,如页眉/页脚设置或模板特定选项。
Name | Description |
---|---|
name | Name of your project. |
If no apidoc.json with the field exists, then apiDoc try to determine the the value from package.json .
|
|
version | Version of your project. |
If no apidoc.json with the field exists, then apiDoc try to determine the the value from package.json .
|
|
description | Introduction of your project. |
If no apidoc.json with the field exists, then apiDoc try to determine the the value from package.json .
|
|
title | Browser title text. |
url |
Prefix for api path (endpoints), e.g. https://api.github.com/v1
|
sampleUrl | If set, a form to test an api method (send a request) will be visible. See @apiSampleRequest for more details. |
header | |
title | Navigation text for the included header.md file. |
(watch Header / Footer) | |
filename | Filename (markdown-file) for the included header.md file. |
footer | |
title | Navigation text for the included footer.md file. |
filename | Filename (markdown-file) for the included footer.md file. |
order | A list of api-names / group-names for ordering the output. Not defined names are automatically displayed last. |
"order": ["Error","Define","PostTitleAndError","PostError"
]
|
在您的项目中,apidoc.json
您可以添加页眉和页脚。
{ "header": { "title": "My own header title", "filename": "header.md" }, "footer": { "title": "My own footer title", "filename": "footer.md" } }
以下设置是特定于apiDoc的默认模板的。
Name | Type | Description |
---|---|---|
template | ||
forceLanguage | String | Disable browser language auto-detection and set a specific locale. |
Example: de , en .
|
||
View available locales here. | ||
withCompare | Boolean |
Enable comparison with older api versions. Default: true
|
withGenerator | Boolean |
Output the generator information at the footer. Default: true
|
jQueryAjaxSetup | Object | Set default values for Ajax requests. |
apidoc.json实例
{"name": "项目名称","version": "1.0.0","description": "介绍你的项目","title": "浏览器标题文本","url" : "Api路径前缀,例如:http://localhost:8080","sampleUrl": "所有方法都将具有API测试表单http://localhost:10086","header": {"title": "页头标题Overview","filename": "header.md"},"footer": {"title": "页脚标题","filename": "footer.md"},"template": {"withCompare": true,"withGenerator": true}
}
继承
使用继承,您可以定义文档的可重用片段。
定义一个继承块,请使用apiDefine
。
引用一个块,使用apiUse
。
继承仅适用于1个父级
``/**
**@apiDefine** UserNotFoundError
*- @apiError UserNotFound The id of the User was not found. *
- @apiErrorExample Error-Response:
- HTTP/1.1 404 Not Found
- {
- "error": "UserNotFound"
- } */
/**
- @api {get} /user/:id Request User information
- @apiName GetUser
- @apiGroup User *
- @apiParam {Number} id Users unique ID. *
- @apiSuccess {String} firstname Firstname of the User.
- @apiSuccess {String} lastname Lastname of the User. *
- @apiSuccessExample Success-Response:
- HTTP/1.1 200 OK
- {
- "firstname": "John",
- "lastname": "Doe"
- } *
**@apiUse** UserNotFoundError
*/
/**
- @api {put} /user/ Modify User information
- @apiName PutUser
- @apiGroup User *
- @apiParam {Number} id Users unique ID.
- @apiParam {String} [firstname] Firstname of the User.
- @apiParam {String} [lastname] Lastname of the User. *
- @apiSuccessExample Success-Response:
- HTTP/1.1 200 OK *
**@apiUse** UserNotFoundError
*/``
版本
在示例中,在选择框(主版本)上单击右上角并选择Compare changes to
。
- 主导航标记全部用绿色条改变了方法。
- 每种方法都显示与其前身相比的实际差异。
- 绿色标记添加的内容(在这种情况下,标题文本已更改,字段
registered
已添加)。- 红色标记已删除的内容。
apidoc.json
{ "name": "example-versioning", "version": "0.2.0", "description": "apiDoc versioning example" }
为了避免API文档随时间变化而导致代码膨胀,建议使用名为的单独历史文件_apidoc.js
。在更改文档块之前,将旧文档复制到此文件,apiDoc将自动包含历史信息。
_apidoc.js(单独历史文件)
``/**
- @api {get} /user/:id Get User information
**@apiVersion** 0.1.0
- @apiName GetUser
- @apiGroup User *
- @apiParam {Number} id Users unique ID. *
- @apiSuccess {String} firstname Firstname of the User.
- @apiSuccess {String} lastname Lastname of the User. *
- @apiSuccessExample Success-Response:
- HTTP/1.1 200 OK
- {
- "firstname": "John",
- "lastname": "Doe"
- } *
- @apiError UserNotFound The id of the User was not found. *
- @apiErrorExample Error-Response:
- HTTP/1.1 404 Not Found
- {
- "error": "UserNotFound"
- } */``
example.js(当前的项目文件)
``/**
- @api {get} /user/:id Get User information and Date of Registration.
**@apiVersion 0.2.0**
- @apiName GetUser
- @apiGroup User *
- @apiParam {Number} id Users unique ID. *
- @apiSuccess {String} firstname Firstname of the User.
- @apiSuccess {String} lastname Lastname of the User.
- @apiSuccess {Date} registered Date of Registration. *
- @apiSuccessExample Success-Response:
- HTTP/1.1 200 OK
- {
- "firstname": "John",
- "lastname": "Doe"
- } *
- @apiError UserNotFound The id of the User was not found. *
- @apiErrorExample Error-Response:
- HTTP/1.1 404 Not Found
- {
- "error": "UserNotFound"
- } */``
重要的是@apiVersion
在每个文档块上设置版本。
该版本可以在每个块上使用,也可以在继承块上使用。您不必在继承块上更改版本,解析器会自动检查最近的前辈。
apiDoc-PARAMS
@api
@api {method} path [title]
需要!
如果没有该指标,apiDoc解析器会忽略文档块。
唯一的例外是由@apiDefine
它们定义的文档块 ,它们不是必需的[@api](https://my.oschina.net/u/2396174)
。
用法: @api {get} /user/:id Users unique ID.
名称 | 描述 |
---|---|
method |
请求方法名称:DELETE ,GET ,POST ,PUT ,…
|
更多信息维基百科的HTTP-Request_methods | |
path | 请求路径。 |
title 可选 | 简短的标题。(用于导航和文章标题) |
例:
/*** @api {get} /user/:id*/
@apiDefine
@apiDefine name [title][description]
定义一个文档块以嵌入到@api
块或类似的api函数中@apiPermission
。
@apiDefine
每块只能使用一次
通过使用@apiUse
定义的块将被导入,或者使用标题和描述的名称将被使用。
用于定义可重用的文档块。该块可以包含在普通的api文档块中。使用@apiDefine
允许您更好地组织复杂的文档并避免复制经常性块。
定义的块可以包含所有的参数(像@apiParam
),除了其他定义的块。
用法: @apiDefine MyError
名称 | 描述 |
---|---|
name | 块/值的唯一名称。可以定义 |
不同的同名@apiVersion 。
|
|
title 可选 |
简短的标题。仅用于指定的功能,如@apiPermission 或@apiParam (name) 。
|
description 可选 |
详细说明从下一行开始,可以使用多行。仅用于像@apiPermission 。这样的命名函数。
|
例:
/*** @apiDefine MyError* @apiError UserNotFound The <code>id</code> of the User was not found.*//*** @api {get} /user/:id* @apiUse MyError*/
/*** @apiDefine admin User access only* This optional description belong to to the group admin.*//*** @api {get} /user/:id* @apiPermission admin*/
@apiDeprecated
@apiDeprecated [text]
将API方法标记为已弃用
用法: @apiDeprecated use now (#Group:Name).
名称 | 描述 |
---|---|
text | 多行文本。 |
例:
/*** @apiDeprecated*//*** @apiDeprecated use now (#Group:Name).** Example: to set a link to the GetDetails method of your group User* write (#User:GetDetails)*/
@apiDescription
@apiDescription text
API方法的详细说明。
用法: @apiDescription This is the Description.
名称 | 描述 |
---|---|
文本 | 多行描述文本。 |
例:
/*** @apiDescription This is the Description.* It is multiline capable.** Last line of Description.*/
@apiError
@apiError [(group)] [{type}] field [description]
错误返回参数。
用法: @apiError UserNotFound
名称 | 描述 |
---|---|
(group) 可选 | 所有参数将按这个名称分组。 |
没有组,默认Error 4xx 设置。
|
|
您可以使用@apiDefine设置标题和描述。 | |
{type} 可选 |
返回类型,例如{Boolean} , {Number} , {String} ,{Object} ,{String[]} (字符串数组),…
|
领域 | 返回标识符(返回的错误代码)。 |
描述 可选 | 该领域的描述。 |
例:
/*** @api {get} /user/:id* @apiError UserNotFound The <code>id</code> of the User was not found.*/
@apiErrorExample
@apiErrorExample [{type}] [title]example
错误返回消息的示例,输出为预格式化代码。
用法: @apiErrorExample {json} Error-Response: This is an example.
名称 | 描述 |
---|---|
{type} 可选 | 响应格式。 |
title 可选 | 示例的简称。 |
example | 详细的例子,multilines能力。 |
例:
/*** @api {get} /user/:id* @apiErrorExample {json} Error-Response:* HTTP/1.1 404 Not Found* {* "error": "UserNotFound"* }*/
@apiExample
@apiExample [{type}] titleexample
使用API方法的示例。以预格式化的代码输出。
在端点描述的开始处使用它作为完整的示例。
用法: @apiExample {js} Example usage: This is an example.
名称 | 描述 |
---|---|
type 可选 | 代码语言。 |
title | 示例的简称。 |
example | 详细的例子,multilines能力。 |
例:
/*** @api {get} /user/:id* @apiExample {curl} Example usage:* curl -i http://localhost/user/4711*/
@apiGroup
@apiGroup name
应该始终使用。
定义方法文档块属于哪个组。组将用于生成的输出中的主导航。结构定义不需要@apiGroup
。
用法: @apiGroup User
名称 | 描述 |
---|---|
名称 | 组的名称。也用作导航标题。 |
例:
/*** @api {get} /user/:id* @apiGroup User*/
@apiHeader
@apiHeader [(group)] [{type}] [field=defaultValue] [description]
描述传递给你的参数API-Header,例如Authorization。
与@apiParam类似的操作,只有输出高于参数。
用法: @apiHeader (MyHeaderGroup) {String} authorization Authorization value.
名称 | 描述 |
---|---|
(group) 可选 | 所有参数将按这个名称分组。 |
没有组,默认Parameter 设置。
|
|
您可以使用@apiDefine设置标题和描述。 | |
{type} 可选 |
参数类型,例如{Boolean} , {Number} , {String} ,{Object} ,{String[]} (字符串数组),…
|
[field] | 带括号的字段名称将变量定义为可选。 |
= defaultValue 可选 | 参数的默认值。 |
description 可选 | 该领域的描述。 |
例子:
/*** @api {get} /user/:id* @apiHeader {String} access-key Users unique access-key.*/
@apiHeaderExample
@apiHeaderExample [{type}] [title]example
参数请求示例。
用法: @apiHeaderExample {json} Request-Example: { "content": "This is an example content" }
名称 | 描述 |
---|---|
类型可选 | 请求格式。 |
标题可选 | 示例的简称。 |
例 | 详细的例子,multilines能力。 |
例:
/*** @api {get} /user/:id* @apiHeaderExample {json} Header-Example:* {* "Accept-Encoding": "Accept-Encoding: gzip, deflate"* }*/
@apiIgnore
@apiIgnore [hint]
将它放在块的顶部。
一个块@apiIgnore
将不被解析。如果您在源代码中保留过时或未完成的方法并且您不希望将其发布到文档中,这是有用的。
用法: @apiIgnore Not finished Method
名称 | 描述 |
---|---|
提示可选 | 短信息为什么应该忽略这个块。 |
例:
/*** @apiIgnore Not finished Method* @api {get} /user/:id*/
@apiName
@apiName name
应该始终使用。
定义方法文档块的名称。名称将用于生成的输出中的子导航。结构定义不需要@apiName
。
用法: @apiName GetUser
名称 | 描述 |
---|---|
名称 |
方法的唯一名称。@apiVersion 可以定义不同的同名。
|
格式:方法 + 路径(例如Get + User),只有一个提案,你可以任意命名。 | |
也用作导航标题。 |
例:
/*** @api {get} /user/:id* @apiName GetUser*/
@apiParam
@apiParam [(group)] [{type}] [field=defaultValue] [description]
描述传递给你的参数API-Method。
用法: @apiParam (MyGroup) {Number} id Users unique ID.
名称 | 描述 |
---|---|
(group)可选 | 所有参数将按这个名称分组。 |
没有组,默认Parameter 设置。
|
|
您可以使用@apiDefine设置标题和描述。 | |
{type} 可选 |
参数类型,例如{Boolean} ,{Number} ,{String} ,{Object} ,{String[]} (字符串数组),…
|
{type {size}} 可选 | 有关变量大小的信息。 |
{string{..5}} 最多5个字符的字符串。
|
|
{string{2..5}} 最小的字符串。2个字符和最多5个字符。
|
|
{number{100-999}} 介于100和999之间的数字。
|
|
{type = allowedValues} 可选 | 有关变量允许值的信息。 |
{string="small"} 一个只能包含单词“small”(常量)的字符串。
|
|
{string="small","huge"} 一个可以包含单词“小”或“巨大”的字符串。
|
|
{number=1,2,3,99} 一个允许值为1,2,3和99的数字。
|
可以与size组合:
{string {..5}="small","huge"}
一个字符串,它具有最多5个字符,并且只包含“small”或“huge”字样。 | | filed | 变量名。 | | [filed] | 带括号的字段名称将变量定义为可选。 | | = defaultValue 可选 | 参数的默认值。 | | description 可选 | 该领域的描述。 |
例子:
/*** @api {get} /user/:id* @apiParam {Number} id Users unique ID.*//*** @api {post} /user/* @apiParam {String} [firstname] Optional Firstname of the User.* @apiParam {String} lastname Mandatory Lastname.* @apiParam {String} country="DE" Mandatory with default value "DE".* @apiParam {Number} [age=18] Optional Age with default 18.** @apiParam (Login) {String} pass Only logged in users can post this.* In generated documentation a separate* "Login" Block will be generated.*/
@apiParamExample
@apiParamExample [{type}] [title]example
参数请求示例。
用法: @apiParamExample {json} Request-Example: { "content": "This is an example content" }
名称 | 描述 |
---|---|
type 可选 | 请求格式。 |
title 可选 | 示例的简称。 |
example | 详细的例子,multilines能力。 |
例:
/*** @api {get} /user/:id* @apiParamExample {json} Request-Example:* {* "id": 4711* }*/
@apiPermission
@apiPermission name
输出权限名称。如果名称是用@apiDefine
生成的文档定义的,则包括附加的标题和说明。
用法: @apiPermission admin
名称 | 描述 |
---|---|
名称 | 权限的唯一名称。 |
例:
/*** @api {get} /user/:id* @apiPermission none*/
@apiPrivate
@apiPrivate
将API定义为私有的,以允许创建两个API规范文档:一个排除私有API和一个包含它们的私有API。
用法: @apiPrivate
用于排除/包含私有API的命令行用法: --private false|true
例:
/*** @api {get} /user/:id* @apiPrivate*/
@apiSampleRequest
@apiSampleRequest url
将此参数与apidoc.json配置参数sampleUrl结合使用。
如果sampleUrl
设置,所有方法都将具有API测试表单(@api的端点将被附加)。
如果没有sampleUrl,只有方法@apiSampleRequest
会有一个表单。
如果@apiSampleRequest url
在方法块中设置,则此URL将用于请求(当它以http开头时,它将覆盖sampleUrl)。
如果sampleUrl
已设置并且您不想使用测试表单的方法,请将其添加@apiSampleRequest off
到文档块中。
用法: @apiSampleRequest http://test.github.com
名称 | 描述 |
---|---|
url | 网址到您的测试api服务器。 |
覆盖配置参数sampleUrl并追加@api url:
@apiSampleRequest http://www.example.com
前缀@api url:
@apiSampleRequest /my_test_path
如果配置参数sampleUrl被设置,则禁用API测试:
@apiSampleRequest off
|
例子:
这会将api请求发送到http://api.github.com/user/:id
Configuration parameter sampleUrl: "http://api.github.com"
/*** @api {get} /user/:id*/
这会将api请求发送到http://test.github.com/some_path/user/:id
它会覆盖sampleUrl。
Configuration parameter sampleUrl: "http://api.github.com"
/*** @api {get} /user/:id* @apiSampleRequest http://test.github.com/some_path/*/
这将发送api请求到http://api.github.com/test/user/:id
它扩展了sampleUrl。
Configuration parameter sampleUrl: "http://api.github.com"
/*** @api {get} /user/:id* @apiSampleRequest /test*/
这将禁用此api方法的api请求。
Configuration parameter sampleUrl: "http://api.github.com"
/*** @api {get} /user/:id* @apiSampleRequest off*/
这会将api请求发送到http://api.github.com/some_path/user/:id
它仅激活对此方法的请求,因为sampleUrl未设置。
Configuration parameter sampleUrl is not set
/*** @api {get} /user/:id* @apiSampleRequest http://api.github.com/some_path/*/
@apiSuccess
@apiSuccess [(group)] [{type}] field [description]
成功返回参数。
用法: @apiSuccess {String} firstname Firstname of the User.
名称 | 描述 |
---|---|
(group) 可选 | 所有参数将按这个名称分组。 |
没有组,默认Success 200 设置。
|
|
您可以使用@apiDefine设置标题和描述。 | |
{type} 可选 |
返回类型,例如{Boolean} , {Number} , {String} ,{Object} ,{String[]} (字符串数组),…
|
field | 返回标识符(返回的成功代码)。 |
description 可选 | 该领域的描述。 |
例:
/*** @api {get} /user/:id* @apiSuccess {String} firstname Firstname of the User.* @apiSuccess {String} lastname Lastname of the User.*/
示例(group)
,@ apiSuccessTitle提供更多组示例:
/*** @api {get} /user/:id* @apiSuccess (200) {String} firstname Firstname of the User.* @apiSuccess (200) {String} lastname Lastname of the User.*/
对象示例:
/*** @api {get} /user/:id* @apiSuccess {Boolean} active Specify if the account is active.* @apiSuccess {Object} profile User profile information.* @apiSuccess {Number} profile.age Users age.* @apiSuccess {String} profile.image Avatar-Image.*/
数组示例:
/*** @api {get} /users* @apiSuccess {Object[]} profiles List of user profiles.* @apiSuccess {Number} profiles.age Users age.* @apiSuccess {String} profiles.image Avatar-Image.*/
@apiSuccessExample
@apiSuccessExample [{type}] [title]example
成功返回消息的示例,输出为预格式化代码。
用法: @apiSuccessExample {json} Success-Response: { "content": "This is an example content" }
名称 | 描述 |
---|---|
type 可选 | 响应格式。 |
title 可选 | 示例的简称。 |
example | 详细的例子,multilines能力。 |
例:
/*** @api {get} /user/:id* @apiSuccessExample {json} Success-Response:* HTTP/1.1 200 OK* {* "firstname": "John",* "lastname": "Doe"* }*/
@apiUse
@apiUse name
包含一个带有@apiDefine
定义的块。如果与@apiVersion
相同或最近的前辈一起使用将被包括在内。
用法: @apiUse MySuccess
名称 | 描述 |
---|---|
名称 | 定义块的名称。 |
例:
/*** @apiDefine MySuccess* @apiSuccess {string} firstname The users firstname.* @apiSuccess {number} age The users age.*//*** @api {get} /user/:id* @apiUse MySuccess*/
@apiVersion
@apiVersion version
设置文档块的版本。版本也可以用于@apiDefine
。
可以在生成的输出中比较具有相同组和名称的块,但可以比较不同版本,以便您或前端开发人员可以追溯自上一版本以后API中发生的更改。
用法: @apiVersion 1.6.2
名称 | 描述 |
---|---|
version | 支持简单的版本控制(major.minor.patch)。有关语义版本规范(SemVer)的更多信息。 |
例:
/*** @api {get} /user/:id* @apiVersion 1.6.2*/
更多手表版本示例。
完整的例子
这是一个复杂的例子inherit
,versioning
文件和历史文件_apidoc.js
,解释在代码和生成文档中。
查看示例输出
文件:
- _apidoc.js
// ------------------------------------------------------------------------------------------
// General apiDoc documentation blocks and old history blocks.
// ------------------------------------------------------------------------------------------// ------------------------------------------------------------------------------------------
// Current Success.
// ------------------------------------------------------------------------------------------// ------------------------------------------------------------------------------------------
// Current Errors.
// ------------------------------------------------------------------------------------------
/*** @apiDefine CreateUserError* @apiVersion 0.2.0** @apiError NoAccessRight Only authenticated Admins can access the data.* @apiError UserNameTooShort Minimum of 5 characters required.** @apiErrorExample Response (example):* HTTP/1.1 400 Bad Request* {* "error": "UserNameTooShort"* }*/// ------------------------------------------------------------------------------------------
// Current Permissions.
// ------------------------------------------------------------------------------------------
/*** @apiDefinePermission admin Admin access rights needed.* Optionally you can write here further Informations about the permission.** An "apiDefinePermission"-block can have an "apiVersion", so you can attach the block to a specific version.** @apiVersion 0.3.0*/// ------------------------------------------------------------------------------------------
// History.
// ------------------------------------------------------------------------------------------
/*** @apiDefinePermission admin This title is visible in version 0.1.0 and 0.2.0* @apiVersion 0.1.0*//*** @api {get} /user/:id Read data of a User* @apiVersion 0.2.0* @apiName GetUser* @apiGroup User* @apiPermission admin** @apiDescription Here you can describe the function.* Multilines are possible.** @apiParam {String} id The Users-ID.** @apiSuccess {String} id The Users-ID.* @apiSuccess {Date} name Fullname of the User.** @apiError UserNotFound The <code>id</code> of the User was not found.*//*** @api {get} /user/:id Read data of a User* @apiVersion 0.1.0* @apiName GetUser* @apiGroup User* @apiPermission admin** @apiDescription Here you can describe the function.* Multilines are possible.** @apiParam {String} id The Users-ID.** @apiSuccess {String} id The Users-ID.* @apiSuccess {Date} name Fullname of the User.** @apiError UserNotFound The error description text in version 0.1.0.*//*** @api {post} /user Create a User* @apiVersion 0.2.0* @apiName PostUser* @apiGroup User* @apiPermission none** @apiDescription In this case "apiUse" is defined and used.* Define blocks with params that will be used in several functions, so you dont have to rewrite them.** @apiParam {String} name Name of the User.** @apiSuccess {String} id The Users-ID.** @apiUse CreateUserError*/
- example.js
/*** @api {get} /user/:id Read data of a User* @apiVersion 0.3.0* @apiName GetUser* @apiGroup User* @apiPermission admin** @apiDescription Compare Verison 0.3.0 with 0.2.0 and you will see the green markers with new items in version 0.3.0 and red markers with removed items since 0.2.0.** @apiParam {String} id The Users-ID.** @apiExample Example usage:* curl -i http://localhost/user/4711** @apiSuccess {String} id The Users-ID.* @apiSuccess {Date} registered Registration Date.* @apiSuccess {Date} name Fullname of the User.* @apiSuccess {String[]} nicknames List of Users nicknames (Array of Strings).* @apiSuccess {Object} profile Profile data (example for an Object)* @apiSuccess {Number} profile.age Users age.* @apiSuccess {String} profile.image Avatar-Image.* @apiSuccess {Object[]} options List of Users options (Array of Objects).* @apiSuccess {String} options.name Option Name.* @apiSuccess {String} options.value Option Value.** @apiError NoAccessRight Only authenticated Admins can access the data.* @apiError UserNotFound The <code>id</code> of the User was not found.** @apiErrorExample Response (example):* HTTP/1.1 401 Not Authenticated* {* "error": "NoAccessRight"* }*/
function getUser() { return; }/*** @api {post} /user Create a new User* @apiVersion 0.3.0* @apiName PostUser* @apiGroup User* @apiPermission none** @apiDescription In this case "apiUse" is defined and used.* Define blocks with params that will be used in several functions, so you dont have to rewrite them.** @apiParam {String} name Name of the User.** @apiSuccess {String} id The new Users-ID.** @apiUse CreateUserError*/
function postUser() { return; }/*** @api {put} /user/:id Change a new User* @apiVersion 0.3.0* @apiName PutUser* @apiGroup User* @apiPermission none** @apiDescription This function has same errors like POST /user, but errors not defined again, they were included with "apiUse"** @apiParam {String} name Name of the User.** @apiUse CreateUserError*/
function putUser() { return; }
- apidoc.json
{
"name": "apidoc-example",
"version": "0.3.0",
"description": "apiDoc example project",
"title": "Custom apiDoc browser title",
"url": "https://api.github.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
}
}
转载于:https://www.cnblogs.com/wuweixiang/p/9177015.html
apiDoc构建源代码注释的接口文档相关推荐
- 快速根据注释生成接口文档网页工具——Apidoc的使用教程
环境: 操作系统 CentOS Linux release 7.6.1810 (Core) 64位 服务器环境 "腾讯云"服务器 1,安装Node.js的npm工具环境: ...
- java 接口文档工具_一款Java基于注释的接口文档生成工具
一. 痛点 你还在手动维护接口文档嘛,花一个下午不停的复制粘贴代码里面的注释 接口字段变动,还得去更新文档,更新不及时导致文档不同步 或者你使用了swagger之类的基于注解,依靠运行时的文档工具,看 ...
- Laravel使用Apidoc注解自动生成Api接口文档
本教程从零开始搭建laravel项目,并安装Apidoc扩展及使用注解生成Api接口文档的教程,该扩展支持 多应用/版本.Markdown文档.在线接口调试.接口生成器.代码模板生成器.Mock调试数 ...
- 使用Sandcastle 基于代码注释生成接口文档
一. 工具下载: 1. Sandcastle:Sandcastle是微软官方的文档生成工具,下载地址:http://www.codeplex.com/Sandcastle 2. SHFBGuidedI ...
- 基于文档注释接口文档生成工具(代码0侵入附源码)
本文主要分享一个基于个人兴趣,旨在提高工作效率,开发了一个基于文档注释,接口文档生成工具,欢迎大佬指点. 源码以及使用demo地址 :传送门 1.前置介绍 1.1前世 现在大多数项目都走向了前后端分离 ...
- 接口返回的类型是html页面_1.10 PhalApi 2.x 接口文档
接口文档 在线接口文档 PhalApi提供一些非常实用而又贴心的功能特性,其中最具特色的就是自动生成的在线可视化文档.在线接口文档主要分为两大类,分别是: 在线接口列表文档 在线接口详情文档 当客户端 ...
- Swagger:搭建Swagger API接口文档
文章目录 Swagger 1.1导语: 1.2 Swagger是什么?它能干什么? 1.3Swagger简介 1.4 Swaggerr特点: SpringBoot 集成Swagger 1. 导包 2. ...
- swagger接口文档使用
swagger接口文档 一,swagger简介 前后端分离 swagger 诞生 二,springboot集成swagger 依赖 编写helloworld接口 配置swagger ==> co ...
- vvv在线文档导出工具_使用ApiPost工具快速生成在线接口文档
ApiPost是一个支持团队协作,并可直接生成文档的API调试.管理工具.它支持模拟POST.GET.PUT等常见请求,是后台接口开发者或前端.接口测试人员不可多得的工具 .使用者不仅可以利用apio ...
最新文章
- 数据分析利器Jupyter Notebook!
- app开发外包的流程、需求、报价,需要知道的细节!
- 一文读懂对抗生成网络的3种模型
- MySQL 报错MySQL server syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT'
- Linux下golang开发环境搭建
- 精通java益处_你真的精通Java吗?
- 人工智能学习书单推荐
- python怎么重复程序_利用Python程序完成ABAQUS中的一些重复性操作
- python mysqldb insert_python MySQLdb使用教程详解
- 剧情介绍:“遗愿清单”
- 云南开放大学《机械制造基础-形考作业1-6(主观题)》
- NGFW——安全策略的处理流程
- LInux的网络设置之(Bridged)桥接模式
- C# 金额转中文大写
- 正在检测目标单片机...
- 你好,你算什么东西?
- 基于matlab的磁悬浮控制系统,基于MATLAB的磁悬浮控制系统研究
- 基础IO(上)——Linux
- BZOJ 1875[SDOI2009]HH去散步
- 使用51单片机 驱动DHT22温湿度模块 串口显示温湿度
热门文章
- JavaScript算法【特殊篇】数组去重的十种实用方案
- win10环境下VTK7.1的编译和Qt调用VTK的详细教程二(VS2013编译支持Qt的VTK库)
- OmniVision的CMOS 图像传感器技术发展路线
- URL Safe base64 与 base64相互转换
- java集成hibernate_JavaWeb_(Spring框架)Spring整合Hibernate
- 融云 php web在线客户,GitHub - yy526063395/Web-IM-mini: PHP+layIM+融云简单实现版
- html与css重置代码,发个自己的CSS重置基础代码
- ie com接口 php_PHP webservie连接.net接口
- cpu消耗 pytorch_高效 PyTorch :如何消除训练瓶颈
- 查询数据库前十条数据_入门数据分析的一些建议