forked from ActiveLearningStudio/ActiveLearningStudio-API
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapidoc.php
301 lines (269 loc) · 10.5 KB
/
apidoc.php
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<?php
return [
'autoload' => true,
/*
* The type of documentation output to generate.
* - "static" will generate a static HTMl page in the /public/docs folder,
* - "laravel" will generate the documentation as a Blade view,
* so you can add routing and authentication.
*/
'type' => 'laravel',
/*
* Static output folder: HTML documentation and assets will be generated in this folder.
*/
'output_folder' => 'public/docs',
/*
* Settings for `laravel` type output.
*/
'laravel' => [
/*
* Whether to automatically create a docs endpoint for you to view your generated docs.
* If this is false, you can still set up routing manually.
*/
'autoload' => true,
/*
* URL path to use for the docs endpoint (if `autoload` is true).
*
* By default, `/doc` opens the HTML page, and `/doc.json` downloads the Postman collection.
*/
'docs_url' => '/doc',
/*
* Middleware to attach to the docs endpoint (if `autoload` is true).
*/
'middleware' => [],
],
/*
* The router to be used (Laravel or Dingo).
*/
'router' => 'laravel',
/*
* The storage to be used when generating assets.
* By default, uses 'local'. If you are using Laravel Vapor, please use S3 and make sure
* the correct bucket is correctly configured in the .env file
*/
'storage' => 'local',
/*
* The base URL to be used in examples and the Postman collection.
* By default, this will be the value of config('app.url').
*/
'base_url' => null,
/*
* Generate a Postman collection in addition to HTML docs.
* For 'static' docs, the collection will be generated to public/docs/collection.json.
* For 'laravel' docs, it will be generated to storage/app/apidoc/collection.json.
* The `ApiDoc::routes()` helper will add routes for both the HTML and the Postman collection.
*/
'postman' => [
/*
* Specify whether the Postman collection should be generated.
*/
'enabled' => true,
/*
* The name for the exported Postman collection. Default: config('app.name')." API"
*/
'name' => null,
/*
* The description for the exported Postman collection.
*/
'description' => null,
/*
* The "Auth" section that should appear in the postman collection. See the schema docs for more information:
* https://schema.getpostman.com/json/collection/v2.0.0/docs/index.html
*/
'auth' => null,
],
/*
* The routes for which documentation should be generated.
* Each group contains rules defining which routes should be included ('match', 'include' and 'exclude' sections)
* and rules which should be applied to them ('apply' section).
*/
'routes' => [
[
/*
* Specify conditions to determine what routes will be parsed in this group.
* A route must fulfill ALL conditions to pass.
*/
'match' => [
/*
* Match only routes whose domains match this pattern (use * as a wildcard to match any characters).
*/
'domains' => [
'*',
// 'domain1.*',
],
/*
* Match only routes whose paths match this pattern (use * as a wildcard to match any characters).
*/
'prefixes' => [
'api/*',
// 'users/*',
],
/*
* Match only routes registered under this version. This option is ignored for Laravel router.
* Note that wildcards are not supported.
*/
'versions' => [
'v1',
],
],
/*
* Include these routes when generating documentation,
* even if they did not match the rules above.
* Note that the route must be referenced by name here (wildcards are supported).
*/
'include' => [
// 'users.index', 'healthcheck*'
],
/*
* Exclude these routes when generating documentation,
* even if they matched the rules above.
* Note that the route must be referenced by name here (wildcards are supported).
*/
'exclude' => [
'h5p.ajax.*',
'h5p.export',
'metrics.*',
'membership.*',
'api/error'
],
/*
* Specify rules to be applied to all the routes in this group when generating documentation
*/
'apply' => [
/*
* Specify headers to be added to the example requests
*/
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
// 'Authorization' => 'Bearer {token}',
// 'Api-Version' => 'v2',
],
/*
* If no @response or @transformer declarations are found for the route,
* we'll try to get a sample response by attempting an API call.
* Configure the settings for the API call here.
*/
'response_calls' => [
/*
* API calls will be made only for routes in this group matching these HTTP methods (GET, POST, etc).
* List the methods here or use '*' to mean all methods. Leave empty to disable API calls.
*/
'methods' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
/*
* Laravel config variables which should be set for the API call.
* This is a good place to ensure that notifications, emails
* and other external services are not triggered
* during the documentation API calls
*/
'config' => [
'app.env' => 'documentation',
'app.debug' => false,
// 'service.key' => 'value',
],
/*
* Cookies which should be sent with the API call.
*/
'cookies' => [
// 'name' => 'value'
],
/*
* Query parameters which should be sent with the API call.
*/
'queryParams' => [
// 'key' => 'value',
],
/*
* Body parameters which should be sent with the API call.
*/
'bodyParams' => [
// 'key' => 'value',
],
],
],
],
],
'strategies' => [
'metadata' => [
\Mpociot\ApiDoc\Extracting\Strategies\Metadata\GetFromDocBlocks::class,
],
'urlParameters' => [
\Mpociot\ApiDoc\Extracting\Strategies\UrlParameters\GetFromUrlParamTag::class,
],
'queryParameters' => [
\Mpociot\ApiDoc\Extracting\Strategies\QueryParameters\GetFromQueryParamTag::class,
],
'headers' => [
\Mpociot\ApiDoc\Extracting\Strategies\RequestHeaders\GetFromRouteRules::class,
],
'bodyParameters' => [
\Mpociot\ApiDoc\Extracting\Strategies\BodyParameters\GetFromBodyParamTag::class,
],
'responses' => [
\Mpociot\ApiDoc\Extracting\Strategies\Responses\UseTransformerTags::class,
\Mpociot\ApiDoc\Extracting\Strategies\Responses\UseResponseTag::class,
\Mpociot\ApiDoc\Extracting\Strategies\Responses\UseResponseFileTag::class,
\Mpociot\ApiDoc\Extracting\Strategies\Responses\UseApiResourceTags::class,
\Mpociot\ApiDoc\Extracting\Strategies\Responses\ResponseCalls::class,
],
],
/*
* Custom logo path. The logo will be copied from this location
* during the generate process. Set this to false to use the default logo.
*
* Change to an absolute path to use your custom logo. For example:
* 'logo' => resource_path('views') . '/api/logo.png'
*
* If you want to use this, please be aware of the following rules:
* - the image size must be 230 x 52
*/
'logo' => resource_path('views') . '/api/logo.png',
/*
* Name for the group of routes which do not have a @group set.
*/
'default_group' => 'general',
/*
* Example requests for each endpoint will be shown in each of these languages.
* Supported options are: bash, javascript, php, python
* You can add a language of your own, but you must publish the package's views
* and define a corresponding view for it in the partials/example-requests directory.
* See https://laravel-apidoc-generator.readthedocs.io/en/latest/generating-documentation.html
*
*/
'example_languages' => [
'bash',
'javascript',
'php',
'python',
],
/*
* Configure how responses are transformed using @transformer and @transformerCollection
* Requires league/fractal package: composer require league/fractal
*
*/
'fractal' => [
/* If you are using a custom serializer with league/fractal,
* you can specify it here.
*
* Serializers included with league/fractal:
* - \League\Fractal\Serializer\ArraySerializer::class
* - \League\Fractal\Serializer\DataArraySerializer::class
* - \League\Fractal\Serializer\JsonApiSerializer::class
*
* Leave as null to use no serializer or return a simple JSON.
*/
'serializer' => null,
],
/*
* If you would like the package to generate the same example values for parameters on each run,
* set this to any number (eg. 1234)
*
*/
'faker_seed' => null,
/*
* If you would like to customize how routes are matched beyond the route configuration you may
* declare your own implementation of RouteMatcherInterface
*
*/
'routeMatcher' => \Mpociot\ApiDoc\Matching\RouteMatcher::class,
];