|
1 | 1 | <?php
|
2 | 2 |
|
| 3 | +use Knuckles\Scribe\Extracting\Strategies; |
3 | 4 | use App\Docs\Strategies\AddPaginationParameters;
|
4 | 5 |
|
5 | 6 | return [
|
|
28 | 29 | */
|
29 | 30 | 'routes' => [
|
30 | 31 | [
|
| 32 | + /* |
| 33 | + * Specify conditions to determine what routes will be a part of this group. |
| 34 | + * A route must fulfill ALL conditions to be included. |
| 35 | + */ |
| 36 | + 'match' => [ |
31 | 37 | /*
|
32 |
| - * Specify conditions to determine what routes will be a part of this group. |
33 |
| - * A route must fulfill ALL conditions to be included. |
| 38 | + * Match only routes whose domains match this pattern (use * as a wildcard to match any characters). Example: 'api.*'. |
34 | 39 | */
|
35 |
| - 'match' => [ |
36 |
| - /* |
37 |
| - * Match only routes whose domains match this pattern (use * as a wildcard to match any characters). Example: 'api.*'. |
38 |
| - */ |
39 |
| - 'domains' => ['*'], |
40 |
| - |
41 |
| - /* |
42 |
| - * Match only routes whose paths match this pattern (use * as a wildcard to match any characters). Example: 'users/*'. |
43 |
| - */ |
44 |
| - 'prefixes' => ['api/*'], |
45 |
| - |
46 |
| - /* |
47 |
| - * [Dingo router only] Match only routes registered under this version. Wildcards are not supported. |
48 |
| - */ |
49 |
| - 'versions' => ['v1'], |
50 |
| - ], |
51 |
| - |
| 40 | + 'domains' => ['*'], |
52 | 41 | /*
|
53 |
| - * Include these routes even if they did not match the rules above. |
54 |
| - * The route can be referenced by name or path here. Wildcards are supported. |
| 42 | + * Match only routes whose paths match this pattern (use * as a wildcard to match any characters). Example: 'users/*'. |
55 | 43 | */
|
56 |
| - 'include' => [ |
57 |
| - // 'users.index', 'healthcheck*' |
58 |
| - ], |
59 |
| - |
| 44 | + 'prefixes' => ['api/*'], |
60 | 45 | /*
|
61 |
| - * Exclude these routes even if they matched the rules above. |
62 |
| - * The route can be referenced by name or path here. Wildcards are supported. |
| 46 | + * [Dingo router only] Match only routes registered under this version. Wildcards are not supported. |
63 | 47 | */
|
64 |
| - 'exclude' => [ |
65 |
| - // '/health', 'admin.*' |
66 |
| - ], |
67 |
| - |
| 48 | + 'versions' => ['v1'], |
| 49 | + ], |
| 50 | + /* |
| 51 | + * Include these routes even if they did not match the rules above. |
| 52 | + * The route can be referenced by name or path here. Wildcards are supported. |
| 53 | + */ |
| 54 | + 'include' => [], |
| 55 | + /* |
| 56 | + * Exclude these routes even if they matched the rules above. |
| 57 | + * The route can be referenced by name or path here. Wildcards are supported. |
| 58 | + */ |
| 59 | + 'exclude' => [], |
| 60 | + /* |
| 61 | + * Settings to be applied to all the matched routes in this group when generating documentation |
| 62 | + */ |
| 63 | + 'apply' => [ |
68 | 64 | /*
|
69 |
| - * Settings to be applied to all the matched routes in this group when generating documentation |
| 65 | + * Additional headers to be added to the example requests |
70 | 66 | */
|
71 |
| - 'apply' => [ |
| 67 | + 'headers' => ['Content-Type' => 'application/json', 'Accept' => 'application/json'], |
| 68 | + /* |
| 69 | + * If no @response or @transformer declarations are found for the route, |
| 70 | + * Scribe will try to get a sample response by attempting an API call. |
| 71 | + * Configure the settings for the API call here. |
| 72 | + */ |
| 73 | + 'response_calls' => [ |
72 | 74 | /*
|
73 |
| - * Additional headers to be added to the example requests |
| 75 | + * API calls will be made only for routes in this group matching these HTTP methods (GET, POST, etc). |
| 76 | + * List the methods here or use '*' to mean all methods. Leave empty to disable API calls. |
74 | 77 | */
|
75 |
| - 'headers' => [ |
76 |
| - 'Content-Type' => 'application/json', |
77 |
| - 'Accept' => 'application/json', |
78 |
| - ], |
79 |
| - |
| 78 | + 'methods' => ['GET'], |
| 79 | + /* |
| 80 | + * Laravel config variables which should be set for the API call. |
| 81 | + * This is a good place to ensure that notifications, emails and other external services |
| 82 | + * are not triggered during the documentation API calls. |
| 83 | + * You can also create a `.env.docs` file and run the generate command with `--env docs`. |
| 84 | + */ |
| 85 | + 'config' => ['app.env' => 'documentation'], |
| 86 | + /* |
| 87 | + * Query parameters which should be sent with the API call. |
| 88 | + */ |
| 89 | + 'queryParams' => [], |
| 90 | + /* |
| 91 | + * Body parameters which should be sent with the API call. |
| 92 | + */ |
| 93 | + 'bodyParams' => [], |
80 | 94 | /*
|
81 |
| - * If no @response or @transformer declarations are found for the route, |
82 |
| - * Scribe will try to get a sample response by attempting an API call. |
83 |
| - * Configure the settings for the API call here. |
| 95 | + * Files which should be sent with the API call. |
| 96 | + * Each value should be a valid path (absolute or relative to your project directory) to a file on this machine (but not in the project root). |
84 | 97 | */
|
85 |
| - 'response_calls' => [ |
86 |
| - /* |
87 |
| - * API calls will be made only for routes in this group matching these HTTP methods (GET, POST, etc). |
88 |
| - * List the methods here or use '*' to mean all methods. Leave empty to disable API calls. |
89 |
| - */ |
90 |
| - 'methods' => ['GET'], |
91 |
| - |
92 |
| - /* |
93 |
| - * Laravel config variables which should be set for the API call. |
94 |
| - * This is a good place to ensure that notifications, emails and other external services |
95 |
| - * are not triggered during the documentation API calls. |
96 |
| - * You can also create a `.env.docs` file and run the generate command with `--env docs`. |
97 |
| - */ |
98 |
| - 'config' => [ |
99 |
| - 'app.env' => 'documentation', |
100 |
| - // 'app.debug' => false, |
101 |
| - ], |
102 |
| - |
103 |
| - /* |
104 |
| - * Query parameters which should be sent with the API call. |
105 |
| - */ |
106 |
| - 'queryParams' => [ |
107 |
| - // 'key' => 'value', |
108 |
| - ], |
109 |
| - |
110 |
| - /* |
111 |
| - * Body parameters which should be sent with the API call. |
112 |
| - */ |
113 |
| - 'bodyParams' => [ |
114 |
| - // 'key' => 'value', |
115 |
| - ], |
116 |
| - |
117 |
| - /* |
118 |
| - * Files which should be sent with the API call. |
119 |
| - * Each value should be a valid path (absolute or relative to your project directory) to a file on this machine (but not in the project root). |
120 |
| - */ |
121 |
| - 'fileParams' => [ |
122 |
| - // 'key' => 'storage/app/image.png', |
123 |
| - ], |
124 |
| - |
125 |
| - /* |
126 |
| - * Cookies which should be sent with the API call. |
127 |
| - */ |
128 |
| - 'cookies' => [ |
129 |
| - // 'name' => 'value' |
130 |
| - ], |
131 |
| - ], |
| 98 | + 'fileParams' => [], |
| 99 | + /* |
| 100 | + * Cookies which should be sent with the API call. |
| 101 | + */ |
| 102 | + 'cookies' => [], |
132 | 103 | ],
|
133 | 104 | ],
|
| 105 | + ] |
134 | 106 | ],
|
135 | 107 |
|
136 | 108 | /*
|
|
252 | 224 | /*
|
253 | 225 | * Example requests for each endpoint will be shown in each of these languages.
|
254 | 226 | * Supported options are: bash, javascript, php, python
|
255 |
| - * To add a language of your own, see https://scribe.readthedocs.io/en/latest/customization.html |
| 227 | + * To add a language of your own, see https://scribe.knuckles.wtf/laravel/advanced/adding-example-languages |
256 | 228 | *
|
257 | 229 | */
|
258 | 230 | 'example_languages' => [
|
|
298 | 270 | ],
|
299 | 271 |
|
300 | 272 | /*
|
301 |
| - * Name for the group of endpoints which do not have a @group set. |
| 273 | + * Endpoints which don't have a @group will be placed in this default group. |
302 | 274 | */
|
303 | 275 | 'default_group' => 'General',
|
304 | 276 |
|
305 | 277 | /*
|
306 | 278 | * Custom logo path. This will be used as the value of the src attribute for the <img> tag,
|
307 |
| - * so make sure it points to a public URL or path accessible from your web server. For best results, the image width should be 230px. |
308 |
| - * Set this to false to not use a logo. |
| 279 | + * so make sure it points to an accessible URL or path. Set to false to not use a logo. |
309 | 280 | *
|
310 | 281 | * For example, if your logo is in public/img:
|
311 | 282 | * - 'logo' => '../img/logo.png' // for `static` type (output folder is public/docs)
|
|
322 | 293 |
|
323 | 294 | /**
|
324 | 295 | * The strategies Scribe will use to extract information about your routes at each stage.
|
325 |
| - * If you write or install a custom strategy, add it here. |
| 296 | + * If you create or install a custom strategy, add it here. |
326 | 297 | */
|
327 | 298 | 'strategies' => [
|
328 | 299 | 'metadata' => [
|
329 |
| - \Knuckles\Scribe\Extracting\Strategies\Metadata\GetFromDocBlocks::class, |
| 300 | + Strategies\Metadata\GetFromDocBlocks::class, |
330 | 301 | ],
|
331 | 302 | 'urlParameters' => [
|
332 |
| - \Knuckles\Scribe\Extracting\Strategies\UrlParameters\GetFromLaravelAPI::class, |
333 |
| - \Knuckles\Scribe\Extracting\Strategies\UrlParameters\GetFromLumenAPI::class, |
334 |
| - \Knuckles\Scribe\Extracting\Strategies\UrlParameters\GetFromUrlParamTag::class, |
| 303 | + Strategies\UrlParameters\GetFromLaravelAPI::class, |
| 304 | + Strategies\UrlParameters\GetFromLumenAPI::class, |
| 305 | + Strategies\UrlParameters\GetFromUrlParamTag::class, |
335 | 306 | ],
|
336 | 307 | 'queryParameters' => [
|
| 308 | + Strategies\QueryParameters\GetFromFormRequest::class, |
| 309 | + Strategies\QueryParameters\GetFromInlineValidator::class, |
| 310 | + Strategies\QueryParameters\GetFromQueryParamTag::class, |
337 | 311 | AddPaginationParameters::class,
|
338 |
| - \Knuckles\Scribe\Extracting\Strategies\QueryParameters\GetFromQueryParamTag::class, |
339 | 312 | ],
|
340 | 313 | 'headers' => [
|
341 |
| - \Knuckles\Scribe\Extracting\Strategies\Headers\GetFromRouteRules::class, |
342 |
| - \Knuckles\Scribe\Extracting\Strategies\Headers\GetFromHeaderTag::class, |
| 314 | + Strategies\Headers\GetFromRouteRules::class, |
| 315 | + Strategies\Headers\GetFromHeaderTag::class, |
343 | 316 | ],
|
344 | 317 | 'bodyParameters' => [
|
345 |
| - \Knuckles\Scribe\Extracting\Strategies\BodyParameters\GetFromFormRequest::class, |
346 |
| - \Knuckles\Scribe\Extracting\Strategies\BodyParameters\GetFromInlineValidator::class, |
347 |
| - \Knuckles\Scribe\Extracting\Strategies\BodyParameters\GetFromBodyParamTag::class, |
| 318 | + Strategies\BodyParameters\GetFromFormRequest::class, |
| 319 | + Strategies\BodyParameters\GetFromInlineValidator::class, |
| 320 | + Strategies\BodyParameters\GetFromBodyParamTag::class, |
348 | 321 | ],
|
349 | 322 | 'responses' => [
|
350 |
| - \Knuckles\Scribe\Extracting\Strategies\Responses\UseTransformerTags::class, |
351 |
| - \Knuckles\Scribe\Extracting\Strategies\Responses\UseResponseTag::class, |
352 |
| - \Knuckles\Scribe\Extracting\Strategies\Responses\UseResponseFileTag::class, |
353 |
| - \Knuckles\Scribe\Extracting\Strategies\Responses\UseApiResourceTags::class, |
354 |
| - \Knuckles\Scribe\Extracting\Strategies\Responses\ResponseCalls::class, |
| 323 | + Strategies\Responses\UseTransformerTags::class, |
| 324 | + Strategies\Responses\UseResponseTag::class, |
| 325 | + Strategies\Responses\UseResponseFileTag::class, |
| 326 | + Strategies\Responses\UseApiResourceTags::class, |
| 327 | + Strategies\Responses\ResponseCalls::class, |
355 | 328 | ],
|
356 | 329 | 'responseFields' => [
|
357 |
| - \Knuckles\Scribe\Extracting\Strategies\ResponseFields\GetFromResponseFieldTag::class, |
| 330 | + Strategies\ResponseFields\GetFromResponseFieldTag::class, |
358 | 331 | ],
|
359 | 332 | ],
|
360 | 333 |
|
361 |
| - /* |
362 |
| - * Configure how responses are transformed using @transformer and @transformerCollection (requires league/fractal package) |
363 |
| - */ |
364 | 334 | 'fractal' => [
|
365 | 335 | /* If you are using a custom serializer with league/fractal, you can specify it here.
|
366 | 336 | * Leave as null to use no serializer or return simple JSON.
|
|
369 | 339 | ],
|
370 | 340 |
|
371 | 341 | /*
|
372 |
| - * [Advanced] If you would like to customize how routes are matched beyond the route configuration you may |
373 |
| - * declare your own implementation of RouteMatcherInterface |
| 342 | + * [Advanced] Custom implementation of RouteMatcherInterface to customise how routes are matched |
374 | 343 | *
|
375 | 344 | */
|
376 | 345 | 'routeMatcher' => \Knuckles\Scribe\Matching\RouteMatcher::class,
|
377 | 346 |
|
378 | 347 | /**
|
379 |
| - * For response calls, api resource responses and transformer responses, Scribe will try to start database transactions, so no changes are persisted to your database. |
380 |
| - * Tell Scribe which connections should be transacted here. If you only use the default db connection, you can leave this as is. |
| 348 | + * For response calls, API resource responses and transformer responses, |
| 349 | + * Scribe will try to start database transactions, so no changes are persisted to your database. |
| 350 | + * Tell Scribe which connections should be transacted here. |
| 351 | + * If you only use one db connection, you can leave this as is. |
381 | 352 | */
|
382 | 353 | 'database_connections_to_transact' => [config('database.default')]
|
383 | 354 | ];
|
0 commit comments