forked from apidoc/apidoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-warnings.js
78 lines (71 loc) · 2.07 KB
/
example-warnings.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// ------------------------------------------------------------------------------------------
// Parameter Warnings Sample File, ALL samples will return warnings
// ------------------------------------------------------------------------------------------
/**
* @api {post} /user Missing URL parameter
* @apiVersion 0.2.0
* @apiName PostUser
* @apiGroup User
* @apiPermission none
*
* @apiDescription @apiParam 'name' was defined but does not appear in URL of @api
*
* @apiParam {String} name Name of the User.
*
* @apiSuccess {String} id The Users-ID.
*
* @apiUse CreateUserError
*/
/**
* @api {GET} /resource/:resId/sub/:subId Undocumented URL Parameter
* @apiName GetSubResource
* @apiGroup Warnings
*
* @apiDescription URL contains a parameter ':resId' that is not documented as @apiParam in @api
*
* @apiParam {String} subId
*/
/**
* @api {GET} /resource/:resId Mismatched URL Parameter
* @apiName GetResource
* @apiGroup Warnings
*
* @apiDescription URL contains a parameter ':resId' that is not documented as @apiParam in @api
*
* @apiParam {String} id
*/
/**
*
* We could even push further and add a warning if there is an api param that doesn't correspond
* to anything (so the other way around). Code that would emit a warning
*/
/**
* @api {get} /user/:id Unused URL Parameter
* @apiName GetUnused
* @apiGroup Warnings
*
* @apiDescription ':oops' was defined but does not appear in URL of @api
*
* @apiParam {Number} id user id
* @apiParam {String} oops some leftover
*/
/**
*
* Example taken from test case by @Lucas-C
*/
/**
* @api {post} /api/school/students/:studentId/cloth Multiple Warnings
* @apiName createCloth
* @apiGroup Warnings
*
* @apiDescription @apiParam 'id' was defined but does not appear in URL of @api
* URL contains a parameter ':studentId' that is not documented as @apiParam in @api
*
* @apiParam id
* @apiParam (body) {String} [name]
* @apiSuccess {Number} code 200
* @apiSuccessExample {json} Success-Response:
* {
* status: 200
* }
*/