I am using apiDoc for documentation in a Sails.js application. And last week I saw that someone defines the answers used by several controllers in a file called api_definitions.js
Example
/*
* @apiDefine UserSuccessExample
* @apiSuccessExample Success-Response:
* HTTP/1.1 201 OK
* {
* "message": "User Created successfully",
* "user" : {
* "displayname": "somedisplayname",
* "lastname": "ALastName",
* "firstname": "AFirstName",
* "email": "sososo@soos.so",
* "phonenumber": "0839293288"
* },
* "token" : "ey.jkernekrerkerkeekwewekwbejwbewbebewbwkebebbwbeibwubfebfebwiee"
* }
*/
And in each of the controllers refers to it using the usual Use parameter @apiUse UserSuccessExample . But when I tried this, I got an error message in my console: it was not detected:
Error
error: Referenced groupname does not exist / it is not defined with @apiDefine.
{ File: 'api/controllers/UserController.js',
Block: 2,
Element: '@apiUse',
Groupname: 'UserSuccessExample',
Definition: '@apiUse group',
Example: '@apiDefine MyValidGroup Some title\n@apiUse MyValidGroup' }
user3994005
source
share