forked from api-platform/core
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi-platform.php
More file actions
221 lines (189 loc) · 6.8 KB
/
Copy pathapi-platform.php
File metadata and controls
221 lines (189 loc) · 6.8 KB
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
<?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <dunglas@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
use ApiPlatform\Metadata\Operation\UnderscorePathSegmentNameGenerator;
use ApiPlatform\Metadata\UrlGeneratorInterface;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Symfony\Component\Serializer\NameConverter\SnakeCaseToCamelCaseNameConverter;
return [
'title' => 'API Platform',
'description' => 'My awesome API',
'version' => '1.0.0',
'show_webby' => true,
'routes' => [
'domain' => null,
// Global middleware applied to every API Platform routes
// 'middleware' => [],
],
'resources' => [
app_path('Models'),
app_path('ApiResource'),
],
'formats' => [
'jsonld' => ['application/ld+json'],
'json' => ['application/json'],
// 'jsonapi' => ['application/vnd.api+json'],
// 'csv' => ['text/csv'],
],
'patch_formats' => [
'json' => ['application/merge-patch+json'],
],
// When true, 'required' validation rules are replaced with 'sometimes'
// on PATCH operations, allowing partial updates without requiring all fields.
'partial_patch_validation' => false,
// When true (default), HEAD requests skip response body construction so
// collections are not iterated. Set to false to process HEAD like GET.
'enable_head_request_optimization' => true,
'docs_formats' => [
'jsonld' => ['application/ld+json'],
// 'jsonapi' => ['application/vnd.api+json'],
'jsonopenapi' => ['application/vnd.openapi+json'],
'html' => ['text/html'],
],
'error_formats' => [
'jsonproblem' => ['application/problem+json'],
],
'defaults' => [
'pagination_enabled' => true,
'pagination_partial' => false,
'pagination_client_enabled' => false,
'pagination_client_items_per_page' => false,
'pagination_client_partial' => false,
'pagination_items_per_page' => 30,
'pagination_maximum_items_per_page' => 30,
'route_prefix' => '/api',
'middleware' => [],
],
'pagination' => [
'page_parameter_name' => 'page',
'enabled_parameter_name' => 'pagination',
'items_per_page_parameter_name' => 'itemsPerPage',
'partial_parameter_name' => 'partial',
],
'jsonapi' => [
// When false, the JSON:API `data.id` uses the resource scalar identifier
// and a `data.links.self` IRI is added. When true (default), `data.id`
// is the resource IRI.
'use_iri_as_id' => true,
// Allow client-generated IDs on JSON:API POST per
// https://jsonapi.org/format/#crud-creating-client-ids. Off by default
// to avoid id spoofing on public endpoints.
'allow_client_generated_id' => false,
],
'graphql' => [
'enabled' => false,
'nesting_separator' => '__',
'introspection' => ['enabled' => true],
'max_query_complexity' => 500,
'max_query_depth' => 200,
// 'middleware' => null,
],
'graphiql' => [
// 'enabled' => true,
// 'domain' => null,
// 'middleware' => null,
],
// set to null if you want to keep snake_case
'name_converter' => SnakeCaseToCamelCaseNameConverter::class,
'exception_to_status' => [
AuthenticationException::class => 401,
AuthorizationException::class => 403,
],
'redoc' => [
'enabled' => true,
],
'scalar' => [
'enabled' => true,
'extra_configuration' => [],
],
'swagger_ui' => [
'enabled' => true,
// 'apiKeys' => [
// 'api' => [
// 'name' => 'Authorization',
// 'type' => 'header',
// ],
// ],
// 'oauth' => [
// 'enabled' => true,
// 'type' => 'oauth2',
// 'flow' => 'authorizationCode',
// 'tokenUrl' => '',
// 'authorizationUrl' =>'',
// 'refreshUrl' => '',
// 'scopes' => ['scope1' => 'Description scope 1'],
// 'pkce' => true,
// ],
// 'license' => [
// 'name' => 'Apache 2.0',
// 'url' => 'https://www.apache.org/licenses/LICENSE-2.0.html',
// ],
// 'contact' => [
// 'name' => 'API Support',
// 'url' => 'https://www.example.com/support',
// 'email' => 'support@example.com',
// ],
// 'http_auth' => [
// 'Personal Access Token' => [
// 'scheme' => 'bearer',
// 'bearerFormat' => 'JWT',
// ],
// ],
//
// 'with_credentials' => true,
],
// 'openapi' => [
// 'tags' => [],
// ],
'url_generation_strategy' => UrlGeneratorInterface::ABS_PATH,
// Class implementing PathSegmentNameGeneratorInterface used to derive route
// segments from resource short names (e.g. `ProductOrder` -> `product_orders`).
// Set to DashPathSegmentNameGenerator::class for dasherized segments
// (e.g. `product-orders`).
'path_segment_name_generator' => UnderscorePathSegmentNameGenerator::class,
'serializer' => [
'hydra_prefix' => false,
// 'datetime_format' => \DateTimeInterface::RFC3339,
],
// we recommend using "file" or "acpu"
'cache' => 'file',
// Path to an Eloquent model metadata file produced by `php artisan api-platform:metadata:dump`.
// When set (and APP_DEBUG is false), the model attributes and relations are read from this file
// at boot instead of being introspected from the database, allowing the app to boot without a
// live DB (e.g. during `docker build`, `composer install`, or static analysis in CI). Commit the
// file to VCS or bake it into your image, and re-run the command when your models change. Leave
// null to disable.
'metadata_dump' => null,
// MCP (Model Context Protocol) configuration
'mcp' => [
'enabled' => true,
],
// install `api-platform/http-cache`
// 'http_cache' => [
// 'etag' => false,
// 'max_age' => null,
// 'shared_max_age' => null,
// 'vary' => null,
// 'public' => null,
// 'stale_while_revalidate' => null,
// 'stale_if_error' => null,
// 'invalidation' => [
// 'urls' => [],
// 'scoped_clients' => [],
// 'max_header_length' => 7500,
// 'request_options' => [],
// 'purger' => ApiPlatform\HttpCache\SouinPurger::class,
// ],
// ],
'error_handler' => [
'extend_laravel_handler' => true,
],
];