如何在apiDocJs中的一个类文件中使用两个@apiName函数?

时间:2016-06-20 20:17:14

标签: java node.js npm api-doc

我有一个可以处理多个路径的servlet,并根据它做不同的事情。我想使用http://apidocjs.com记录类文件中的不同函数,但无法弄清楚如何让两个函数显示出来。当我尝试这个(见下文)时,只有第一个出现:

/**
 * @api {get} /authenticate/user?
 * @apiName Authenticator
 * @apiGroup Authentication
 *
 * @apiDescription Authenticate a user
 *
 * @apiSampleRequest /authenticate/user
 *
 * @apiParam    {String}            username                    User name
 * @apiParam    {String}            password                    User password
 *
 * @apiSuccess  {JSONObject}        user                        User
 *
 * @apiExample Success-Response (example):
 *     {
 *       ...
 *     }
 *
 * @apiExample Error-Response (example):
 *     {
 *          ...
 *     }
 *
 * @api {get} /authenticate/app?
 * @apiName Authenticator
 * @apiGroup Authentication
 *
 * @apiDescription Authenticate an app
 *
 * @apiSampleRequest /authenticate/app
 *
 * @apiParam    {String}            appId                   App Id
 * @apiParam    {String}            appKey                  Secret Key
 *
 * @apiSuccess  {JSONObject}        app                     App
 *
 * @apiExample Success-Response (example):
 *     {
 *       ...
 *     }
 *
 * @apiExample Error-Response (example):
 *     {
 *          ...
 *     }
 */

1 个答案:

答案 0 :(得分:1)

刚刚发现如果将它拆分为两个注释块,它将起作用:

/**
 * @api {get} /authenticate/user?
 * @apiName Authenticator
 * @apiGroup Authentication
 *
 * @apiDescription Authenticate a user
 *
 * @apiSampleRequest /authenticate/user
 *
 * @apiParam    {String}            username                    User name
 * @apiParam    {String}            password                    User password
 *
 * @apiSuccess  {JSONObject}        user                        User
 *
 * @apiExample Success-Response (example):
 *     {
 *       ...
 *     }
 *
 * @apiExample Error-Response (example):
 *     {
 *          ...
 *     }
 */

/**
 * @api {get} /authenticate/app?
 * @apiName Authenticator
 * @apiGroup Authentication
 *
 * @apiDescription Authenticate an app
 *
 * @apiSampleRequest /authenticate/app
 *
 * @apiParam    {String}            appId                   App Id
 * @apiParam    {String}            appKey                  Secret Key
 *
 * @apiSuccess  {JSONObject}        app                     App
 *
 * @apiExample Success-Response (example):
 *     {
 *       ...
 *     }
 *
 * @apiExample Error-Response (example):
 *     {
 *          ...
 *     }
 */