|
@@ -1,17 +1,19 @@
|
|
|
<?php
|
|
|
|
|
|
use Knuckles\Scribe\Extracting\Strategies;
|
|
|
+use Knuckles\Scribe\Config;
|
|
|
+use function Knuckles\Scribe\Config\{removeStrategies, configureStrategy};
|
|
|
|
|
|
return [
|
|
|
// The HTML <title> for the generated documentation. If this is empty, Scribe will infer it from config('app.name').
|
|
|
- 'title' => null,
|
|
|
+ 'title' => config('app.name').' API Documentation',
|
|
|
|
|
|
// A short description of your API. Will be included in the docs webpage, Postman collection and OpenAPI spec.
|
|
|
'description' => '',
|
|
|
|
|
|
// The base URL displayed in the docs. If this is empty, Scribe will use the value of config('app.url') at generation time.
|
|
|
// If you're using `laravel` type, you can set this to a dynamic string, like '{{ config("app.tenant_url") }}' to get a dynamic base URL.
|
|
|
- 'base_url' => null,
|
|
|
+ 'base_url' => config("app.url"),
|
|
|
|
|
|
'routes' => [
|
|
|
[
|
|
@@ -41,10 +43,10 @@ return [
|
|
|
// - "laravel" will generate the documentation as a Blade view, so you can add routing and authentication.
|
|
|
// - "external_static" and "external_laravel" do the same as above, but generate a basic template,
|
|
|
// passing the OpenAPI spec as a URL, allowing you to easily use the docs with an external generator
|
|
|
- 'type' => 'static',
|
|
|
+ 'type' => 'external_laravel',
|
|
|
|
|
|
// See https://scribe.knuckles.wtf/laravel/reference/config#theme for supported options
|
|
|
- 'theme' => 'default',
|
|
|
+ 'theme' => 'scalar',
|
|
|
|
|
|
'static' => [
|
|
|
// HTML documentation, assets and Postman collection will be generated to this folder.
|
|
@@ -80,7 +82,7 @@ return [
|
|
|
'enabled' => true,
|
|
|
|
|
|
// The base URL for the API tester to use (for example, you can set this to your staging URL).
|
|
|
- // Leave as null to use the current app URL when generating (config("app.url")).
|
|
|
+ // Leave as null to be the same as the displayed URL (config("scribe.base_url")).
|
|
|
'base_url' => null,
|
|
|
|
|
|
// [Laravel Sanctum] Fetch a CSRF token before each request, and add it as an X-XSRF-TOKEN header.
|
|
@@ -200,61 +202,41 @@ INTRO
|
|
|
],
|
|
|
|
|
|
// The strategies Scribe will use to extract information about your routes at each stage.
|
|
|
- // If you create or install a custom strategy, add it here.
|
|
|
+ // Use configureStrategy() to specify settings for a strategy in the list.
|
|
|
+ // Use removeStrategies() to remove an included strategy.
|
|
|
'strategies' => [
|
|
|
'metadata' => [
|
|
|
- Strategies\Metadata\GetFromDocBlocks::class,
|
|
|
- Strategies\Metadata\GetFromMetadataAttributes::class,
|
|
|
+ ...Config\Defaults::METADATA_STRATEGIES,
|
|
|
],
|
|
|
'urlParameters' => [
|
|
|
- Strategies\UrlParameters\GetFromLaravelAPI::class,
|
|
|
- Strategies\UrlParameters\GetFromUrlParamAttribute::class,
|
|
|
- Strategies\UrlParameters\GetFromUrlParamTag::class,
|
|
|
+ ...Config\Defaults::URL_PARAMETERS_STRATEGIES,
|
|
|
],
|
|
|
'queryParameters' => [
|
|
|
- Strategies\QueryParameters\GetFromFormRequest::class,
|
|
|
- Strategies\QueryParameters\GetFromInlineValidator::class,
|
|
|
- Strategies\QueryParameters\GetFromQueryParamAttribute::class,
|
|
|
- Strategies\QueryParameters\GetFromQueryParamTag::class,
|
|
|
+ ...Config\Defaults::QUERY_PARAMETERS_STRATEGIES,
|
|
|
],
|
|
|
'headers' => [
|
|
|
- Strategies\Headers\GetFromHeaderAttribute::class,
|
|
|
- Strategies\Headers\GetFromHeaderTag::class,
|
|
|
- [
|
|
|
- 'override',
|
|
|
- [
|
|
|
- 'Content-Type' => 'application/json',
|
|
|
- 'Accept' => 'application/json',
|
|
|
- ]
|
|
|
- ]
|
|
|
+ ...Config\Defaults::HEADERS_STRATEGIES,
|
|
|
+ Strategies\StaticData::withSettings(data: [
|
|
|
+ 'Content-Type' => 'application/json',
|
|
|
+ 'Accept' => 'application/json',
|
|
|
+ ]),
|
|
|
],
|
|
|
'bodyParameters' => [
|
|
|
- Strategies\BodyParameters\GetFromFormRequest::class,
|
|
|
- Strategies\BodyParameters\GetFromInlineValidator::class,
|
|
|
- Strategies\BodyParameters\GetFromBodyParamAttribute::class,
|
|
|
- Strategies\BodyParameters\GetFromBodyParamTag::class,
|
|
|
+ ...Config\Defaults::BODY_PARAMETERS_STRATEGIES,
|
|
|
],
|
|
|
- 'responses' => [
|
|
|
- Strategies\Responses\UseResponseAttributes::class,
|
|
|
- Strategies\Responses\UseTransformerTags::class,
|
|
|
- Strategies\Responses\UseApiResourceTags::class,
|
|
|
- Strategies\Responses\UseResponseTag::class,
|
|
|
- Strategies\Responses\UseResponseFileTag::class,
|
|
|
- [
|
|
|
- Strategies\Responses\ResponseCalls::class,
|
|
|
- [
|
|
|
- 'only' => ['GET *'],
|
|
|
- // Disable debug mode when generating response calls to avoid error stack traces in responses
|
|
|
- 'config' => [
|
|
|
- 'app.debug' => false,
|
|
|
- ],
|
|
|
+ 'responses' => configureStrategy(
|
|
|
+ Config\Defaults::RESPONSES_STRATEGIES,
|
|
|
+ Strategies\Responses\ResponseCalls::withSettings(
|
|
|
+ only: ['GET *'],
|
|
|
+ // Disable debug mode when generating response calls to avoid error stack traces in responses
|
|
|
+ config: [
|
|
|
+ 'app.debug' => false,
|
|
|
]
|
|
|
- ]
|
|
|
- ],
|
|
|
+ )
|
|
|
+ ),
|
|
|
'responseFields' => [
|
|
|
- Strategies\ResponseFields\GetFromResponseFieldAttribute::class,
|
|
|
- Strategies\ResponseFields\GetFromResponseFieldTag::class,
|
|
|
- ],
|
|
|
+ ...Config\Defaults::RESPONSE_FIELDS_STRATEGIES,
|
|
|
+ ]
|
|
|
],
|
|
|
|
|
|
// For response calls, API resource responses and transformer responses,
|