forked from api-platform/core
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathXmlResourceExtractor.php
More file actions
576 lines (500 loc) · 26.4 KB
/
Copy pathXmlResourceExtractor.php
File metadata and controls
576 lines (500 loc) · 26.4 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
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
<?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);
namespace ApiPlatform\Metadata\Extractor;
use ApiPlatform\Doctrine\Odm\State\Options as OdmOptions;
use ApiPlatform\Doctrine\Orm\State\Options as OrmOptions;
use ApiPlatform\Elasticsearch\State\Options as ElasticsearchOptions;
use ApiPlatform\Metadata\Exception\InvalidArgumentException;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\HeaderParameter;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\QueryParameter;
use ApiPlatform\OpenApi\Model\ExternalDocumentation;
use ApiPlatform\OpenApi\Model\Operation as OpenApiOperation;
use ApiPlatform\OpenApi\Model\Parameter as OpenApiParameter;
use ApiPlatform\OpenApi\Model\RequestBody;
use ApiPlatform\OpenApi\Model\Response;
use ApiPlatform\State\OptionsInterface;
use Symfony\Component\Config\Util\XmlUtils;
use Symfony\Component\WebLink\Link;
/**
* Extracts an array of metadata from a list of XML files.
*
* @author Vincent Chalamon <vincentchalamon@gmail.com>
*/
final class XmlResourceExtractor extends AbstractResourceExtractor
{
use ResourceExtractorTrait;
public const SCHEMA = __DIR__.'/schema/resources.xsd';
/**
* {@inheritdoc}
*/
protected function extractPath(string $path): void
{
try {
/** @var \SimpleXMLElement $xml */
$xml = simplexml_import_dom(XmlUtils::loadFile($path, self::SCHEMA));
} catch (\InvalidArgumentException $e) {
// Ensure it's not a resource
try {
simplexml_import_dom(XmlUtils::loadFile($path, XmlPropertyExtractor::SCHEMA));
} catch (\InvalidArgumentException) {
throw new InvalidArgumentException(\sprintf('Error while parsing %s: %s', $path, $e->getMessage()), $e->getCode(), $e);
}
// It's a property: ignore error
return;
}
foreach ($xml->resource as $resource) {
$base = $this->buildExtendedBase($resource);
$this->resources[$this->resolve((string) $resource['class'])][] = array_merge($base, [
'operations' => $this->buildOperations($resource, $base),
'graphQlOperations' => $this->buildGraphQlOperations($resource, $base),
]);
}
}
private function buildExtendedBase(\SimpleXMLElement $resource): array
{
return array_merge($this->buildBase($resource), [
'uriTemplate' => $this->phpize($resource, 'uriTemplate', 'string'),
'routePrefix' => $this->phpize($resource, 'routePrefix', 'string'),
'stateless' => $this->phpize($resource, 'stateless', 'bool'),
'sunset' => $this->phpize($resource, 'sunset', 'string'),
'acceptPatch' => $this->phpize($resource, 'acceptPatch', 'string'),
'status' => $this->phpize($resource, 'status', 'integer'),
'host' => $this->phpize($resource, 'host', 'string'),
'condition' => $this->phpize($resource, 'condition', 'string'),
'controller' => $this->phpize($resource, 'controller', 'string'),
'types' => $this->buildArrayValue($resource, 'type'),
'formats' => $this->buildFormats($resource, 'formats'),
'inputFormats' => $this->buildFormats($resource, 'inputFormats'),
'outputFormats' => $this->buildFormats($resource, 'outputFormats'),
'uriVariables' => $this->buildUriVariables($resource),
'defaults' => isset($resource->defaults->values) ? $this->buildValues($resource->defaults->values) : null,
'requirements' => $this->buildRequirements($resource),
'options' => isset($resource->options->values) ? $this->buildValues($resource->options->values) : null,
'schemes' => $this->buildArrayValue($resource, 'scheme'),
'cacheHeaders' => $this->buildCacheHeaders($resource),
'hydraContext' => isset($resource->hydraContext->values) ? $this->buildValues($resource->hydraContext->values) : null,
'jsonldContext' => isset($resource->jsonldContext->values) ? $this->buildValues($resource->jsonldContext->values) : null,
'openapi' => $this->buildOpenapi($resource),
'paginationViaCursor' => $this->buildPaginationViaCursor($resource),
'exceptionToStatus' => $this->buildExceptionToStatus($resource),
'queryParameterValidationEnabled' => $this->phpize($resource, 'queryParameterValidationEnabled', 'bool'),
'strictQueryParameterValidation' => $this->phpize($resource, 'strictQueryParameterValidation', 'bool'),
'hideHydraOperation' => $this->phpize($resource, 'hideHydraOperation', 'bool'),
'stateOptions' => $this->buildStateOptions($resource),
'links' => $this->buildLinks($resource),
'headers' => $this->buildHeaders($resource),
'parameters' => $this->buildParameters($resource),
]);
}
private function buildBase(\SimpleXMLElement $resource): array
{
return [
'shortName' => $this->phpize($resource, 'shortName', 'string'),
'description' => $this->phpize($resource, 'description', 'string'),
'urlGenerationStrategy' => $this->phpize($resource, 'urlGenerationStrategy', 'integer'),
'deprecationReason' => $this->phpize($resource, 'deprecationReason', 'string'),
'messenger' => $this->phpize($resource, 'messenger', 'bool|string'),
'mercure' => $this->buildMercure($resource),
'input' => $this->phpize($resource, 'input', 'bool|string'),
'output' => $this->phpize($resource, 'output', 'bool|string'),
'fetchPartial' => $this->phpize($resource, 'fetchPartial', 'bool'),
'forceEager' => $this->phpize($resource, 'forceEager', 'bool'),
'paginationClientEnabled' => $this->phpize($resource, 'paginationClientEnabled', 'bool'),
'paginationClientItemsPerPage' => $this->phpize($resource, 'paginationClientItemsPerPage', 'bool'),
'paginationClientPartial' => $this->phpize($resource, 'paginationClientPartial', 'bool'),
'paginationEnabled' => $this->phpize($resource, 'paginationEnabled', 'bool'),
'paginationFetchJoinCollection' => $this->phpize($resource, 'paginationFetchJoinCollection', 'bool'),
'paginationUseOutputWalkers' => $this->phpize($resource, 'paginationUseOutputWalkers', 'bool'),
'paginationItemsPerPage' => $this->phpize($resource, 'paginationItemsPerPage', 'integer'),
'paginationMaximumItemsPerPage' => $this->phpize($resource, 'paginationMaximumItemsPerPage', 'integer'),
'paginationPartial' => $this->phpize($resource, 'paginationPartial', 'bool'),
'paginationType' => $this->phpize($resource, 'paginationType', 'string'),
'processor' => $this->phpize($resource, 'processor', 'string'),
'provider' => $this->phpize($resource, 'provider', 'string'),
'security' => $this->phpize($resource, 'security', 'string'),
'securityMessage' => $this->phpize($resource, 'securityMessage', 'string'),
'securityPostDenormalize' => $this->phpize($resource, 'securityPostDenormalize', 'string'),
'securityPostDenormalizeMessage' => $this->phpize($resource, 'securityPostDenormalizeMessage', 'string'),
'securityPostValidation' => $this->phpize($resource, 'securityPostValidation', 'string'),
'securityPostValidationMessage' => $this->phpize($resource, 'securityPostValidationMessage', 'string'),
'normalizationContext' => isset($resource->normalizationContext->values) ? $this->buildValues($resource->normalizationContext->values) : null,
'denormalizationContext' => isset($resource->denormalizationContext->values) ? $this->buildValues($resource->denormalizationContext->values) : null,
'collectDenormalizationErrors' => $this->phpize($resource, 'collectDenormalizationErrors', 'bool'),
'validationContext' => isset($resource->validationContext->values) ? $this->buildValues($resource->validationContext->values) : null,
'filters' => $this->buildArrayValue($resource, 'filter'),
'order' => isset($resource->order->values) ? $this->buildValues($resource->order->values) : null,
'extraProperties' => $this->buildExtraProperties($resource, 'extraProperties'),
'read' => $this->phpize($resource, 'read', 'bool'),
'write' => $this->phpize($resource, 'write', 'bool'),
'jsonStream' => $this->phpize($resource, 'jsonStream', 'bool'),
'map' => $this->phpize($resource, 'map', 'bool'),
];
}
private function buildFormats(\SimpleXMLElement $resource, string $key): ?array
{
if (!isset($resource->{$key}->format)) {
return null;
}
$data = [];
foreach ($resource->{$key}->format as $format) {
if (isset($format['name'])) {
$data[(string) $format['name']] = (string) $format;
continue;
}
$data[] = (string) $format;
}
return $data;
}
private function buildOpenapi(\SimpleXMLElement $resource): bool|OpenApiOperation|null
{
if (!isset($resource->openapi) && !isset($resource['openapi'])) {
return null;
}
if (isset($resource['openapi']) && \in_array((string) $resource['openapi'], ['1', '0', 'true', 'false'], true)) {
return $this->phpize($resource, 'openapi', 'bool');
}
$openapi = $resource->openapi;
$data = [];
$attributes = $openapi->attributes();
/*
* \SimpleXMLElement should not be read in an iteration because of a known bug in SimpleXML lib that resets the iterator
* and leads to infinite loop
* https://bugs.php.net/bug.php?id=55098
* https://github.com/php/php-src/issues/12208
* https://github.com/php/php-src/issues/12192
*
* attribute names are stored in an iteration and values are fetched in another one
*/
$attributeNames = [];
foreach ($attributes as $name => $attribute) {
$attributeNames[] = $name;
}
foreach ($attributeNames as $attributeName) {
$data[$attributeName] = $this->phpize($attributes, $attributeName, 'deprecated' === $attributeName ? 'bool' : 'string');
}
$data['tags'] = $this->buildArrayValue($openapi, 'tag');
if (isset($openapi->responses->response)) {
foreach ($openapi->responses->response as $response) {
$data['responses'][(string) $response->attributes()->status] = new Response(
description: $this->phpize($response, 'description', 'string'),
content: isset($response->content->values) ? new \ArrayObject($this->buildValues($response->content->values)) : null,
headers: isset($response->headers->values) ? new \ArrayObject($this->buildValues($response->headers->values)) : null,
links: isset($response->links->values) ? new \ArrayObject($this->buildValues($response->links->values)) : null,
);
}
}
$data['externalDocs'] = isset($openapi->externalDocs) ? new ExternalDocumentation(
description: $this->phpize($resource, 'description', 'string'),
url: $this->phpize($resource, 'url', 'string'),
) : null;
if (isset($openapi->parameters->parameter)) {
foreach ($openapi->parameters->parameter as $parameter) {
$data['parameters'][(string) $parameter->attributes()->name] = new OpenApiParameter(
name: $this->phpize($parameter, 'name', 'string'),
in: $this->phpize($parameter, 'in', 'string'),
description: $this->phpize($parameter, 'description', 'string'),
required: $this->phpize($parameter, 'required', 'bool'),
deprecated: $this->phpize($parameter, 'deprecated', 'bool', false),
allowEmptyValue: $this->phpize($parameter, 'allowEmptyValue', 'bool', null),
schema: isset($parameter->schema->values) ? $this->buildValues($parameter->schema->values) : [],
style: $this->phpize($parameter, 'style', 'string'),
explode: $this->phpize($parameter, 'explode', 'bool', false),
allowReserved: $this->phpize($parameter, 'allowReserved', 'bool', null),
example: $this->phpize($parameter, 'example', 'string'),
examples: isset($parameter->examples->values) ? new \ArrayObject($this->buildValues($parameter->examples->values)) : null,
content: isset($parameter->content->values) ? new \ArrayObject($this->buildValues($parameter->content->values)) : null,
);
}
}
$data['requestBody'] = isset($openapi->requestBody) ? new RequestBody(
description: $this->phpize($openapi->requestBody, 'description', 'string'),
content: isset($openapi->requestBody->content->values) ? new \ArrayObject($this->buildValues($openapi->requestBody->content->values)) : null,
required: $this->phpize($openapi->requestBody, 'required', 'bool'),
) : null;
$data['callbacks'] = isset($openapi->callbacks->values) ? new \ArrayObject($this->buildValues($openapi->callbacks->values)) : null;
$data['security'] = isset($openapi->security->values) ? $this->buildValues($openapi->security->values) : null;
if (isset($openapi->servers->server)) {
foreach ($openapi->servers->server as $server) {
$data['servers'][] = [
'description' => $this->phpize($server, 'description', 'string'),
'url' => $this->phpize($server, 'url', 'string'),
'variables' => isset($server->variables->values) ? $this->buildValues($server->variables->values) : null,
];
}
}
$data['extensionProperties'] = isset($openapi->extensionProperties->values) ? $this->buildValues($openapi->extensionProperties->values) : null;
foreach ($data as $key => $value) {
if (null === $value) {
unset($data[$key]);
}
}
return new OpenApiOperation(...$data);
}
private function buildUriVariables(\SimpleXMLElement $resource): ?array
{
if (!isset($resource->uriVariables->uriVariable)) {
return null;
}
$uriVariables = [];
foreach ($resource->uriVariables->uriVariable as $data) {
$parameterName = (string) $data['parameterName'];
if (1 === (null === $data->attributes() ? 0 : \count($data->attributes()))) {
$uriVariables[$parameterName] = $parameterName;
continue;
}
if ($fromProperty = $this->phpize($data, 'fromProperty', 'string')) {
$uriVariables[$parameterName]['from_property'] = $fromProperty;
}
if ($toProperty = $this->phpize($data, 'toProperty', 'string')) {
$uriVariables[$parameterName]['to_property'] = $toProperty;
}
if ($fromClass = $this->resolve($this->phpize($data, 'fromClass', 'string'))) {
$uriVariables[$parameterName]['from_class'] = $fromClass;
}
if ($toClass = $this->resolve($this->phpize($data, 'toClass', 'string'))) {
$uriVariables[$parameterName]['to_class'] = $toClass;
}
if (isset($data->identifiers->values)) {
$uriVariables[$parameterName]['identifiers'] = $this->buildValues($data->identifiers->values);
}
if (null !== ($compositeIdentifier = $this->phpize($data, 'compositeIdentifier', 'bool'))) {
$uriVariables[$parameterName]['composite_identifier'] = $compositeIdentifier;
}
}
return $uriVariables;
}
private function buildCacheHeaders(\SimpleXMLElement $resource): ?array
{
if (!isset($resource->cacheHeaders->cacheHeader)) {
return null;
}
$data = [];
foreach ($resource->cacheHeaders->cacheHeader as $cacheHeader) {
if (isset($cacheHeader->values->value)) {
$data[(string) $cacheHeader['name']] = $this->buildValues($cacheHeader->values);
continue;
}
$data[(string) $cacheHeader['name']] = XmlUtils::phpize((string) $cacheHeader);
}
return $data;
}
private function buildRequirements(\SimpleXMLElement $resource): ?array
{
if (!isset($resource->requirements->requirement)) {
return null;
}
$data = [];
foreach ($resource->requirements->requirement as $requirement) {
$data[(string) $requirement->attributes()->property] = (string) $requirement;
}
return $data;
}
private function buildMercure(\SimpleXMLElement $resource): array|bool|null
{
if (!isset($resource->mercure)) {
return null;
}
if (null !== $resource->mercure->attributes()->private) {
return ['private' => $this->phpize($resource->mercure->attributes(), 'private', 'bool')];
}
return true;
}
private function buildPaginationViaCursor(\SimpleXMLElement $resource): ?array
{
if (!isset($resource->paginationViaCursor->paginationField)) {
return null;
}
$data = [];
foreach ($resource->paginationViaCursor->paginationField as $paginationField) {
$data[(string) $paginationField['field']] = (string) $paginationField['direction'];
}
return $data;
}
private function buildExceptionToStatus(\SimpleXMLElement $resource): ?array
{
if (!isset($resource->exceptionToStatus->exception)) {
return null;
}
$data = [];
foreach ($resource->exceptionToStatus->exception as $exception) {
$data[(string) $exception['class']] = (int) $exception['statusCode'];
}
return $data;
}
private function buildExtraProperties(\SimpleXMLElement $resource, ?string $key = null): ?array
{
if (null !== $key) {
if (!isset($resource->{$key})) {
return null;
}
$resource = $resource->{$key};
}
return $this->buildValues($resource->values);
}
private function buildOperations(\SimpleXMLElement $resource, array $root): ?array
{
if (!isset($resource->operations->operation)) {
return null;
}
$data = [];
foreach ($resource->operations->operation as $operation) {
$datum = $this->buildExtendedBase($operation);
foreach ($datum as $key => $value) {
if (null === $value) {
$datum[$key] = $root[$key];
}
}
if (\in_array((string) $operation['class'], [GetCollection::class, Post::class], true)) {
$datum['itemUriTemplate'] = $this->phpize($operation, 'itemUriTemplate', 'string');
} elseif (isset($operation['itemUriTemplate'])) {
throw new InvalidArgumentException(\sprintf('"itemUriTemplate" option is not allowed on a %s operation.', $operation['class']));
}
$data[] = array_merge($datum, [
'collection' => $this->phpize($operation, 'collection', 'bool'),
'class' => (string) $operation['class'],
'method' => $this->phpize($operation, 'method', 'string'),
'read' => $this->phpize($operation, 'read', 'bool'),
'deserialize' => $this->phpize($operation, 'deserialize', 'bool'),
'validate' => $this->phpize($operation, 'validate', 'bool'),
'write' => $this->phpize($operation, 'write', 'bool'),
'serialize' => $this->phpize($operation, 'serialize', 'bool'),
'queryParameterValidate' => $this->phpize($operation, 'queryParameterValidate', 'bool'),
'priority' => $this->phpize($operation, 'priority', 'integer'),
'name' => $this->phpize($operation, 'name', 'string'),
'routeName' => $this->phpize($operation, 'routeName', 'string'),
]);
}
return $data;
}
private function buildGraphQlOperations(\SimpleXMLElement $resource, array $root): ?array
{
if (!isset($resource->graphQlOperations->graphQlOperation)) {
return null;
}
$data = [];
foreach ($resource->graphQlOperations->graphQlOperation as $operation) {
$datum = $this->buildBase($operation);
foreach ($datum as $key => $value) {
if (null === $value) {
$datum[$key] = $root[$key];
}
}
$data[] = array_merge($datum, [
'resolver' => $this->phpize($operation, 'resolver', 'string'),
'args' => $this->buildArgs($operation),
'extraArgs' => $this->buildExtraArgs($operation),
'class' => (string) $operation['class'],
'read' => $this->phpize($operation, 'read', 'bool'),
'deserialize' => $this->phpize($operation, 'deserialize', 'bool'),
'validate' => $this->phpize($operation, 'validate', 'bool'),
'write' => $this->phpize($operation, 'write', 'bool'),
'serialize' => $this->phpize($operation, 'serialize', 'bool'),
'priority' => $this->phpize($operation, 'priority', 'integer'),
'name' => $this->phpize($operation, 'name', 'string'),
]);
}
return $data;
}
private function buildStateOptions(\SimpleXMLElement $resource): ?OptionsInterface
{
$stateOptions = $resource->stateOptions ?? null;
if (!$stateOptions) {
return null;
}
if (isset($stateOptions->elasticsearchOptions) && class_exists(ElasticsearchOptions::class)) {
return new ElasticsearchOptions(
isset($stateOptions->elasticsearchOptions['index']) ? (string) $stateOptions->elasticsearchOptions['index'] : null,
);
}
if (isset($stateOptions->doctrineOdmOptions) && class_exists(OdmOptions::class)) {
return new OdmOptions(
isset($stateOptions->doctrineOdmOptions['documentClass']) ? (string) $stateOptions->doctrineOdmOptions['documentClass'] : null,
);
}
if (isset($stateOptions->doctrineOrmOptions) && class_exists(OrmOptions::class)) {
return new OrmOptions(
isset($stateOptions->doctrineOrmOptions['entityClass']) ? (string) $stateOptions->doctrineOrmOptions['entityClass'] : null,
);
}
return null;
}
/**
* @return Link[]
*/
private function buildLinks(\SimpleXMLElement $resource): ?array
{
if (!$resource->links) {
return null;
}
$links = [];
foreach ($resource->links as $link) {
$links[] = new Link(rel: (string) $link->link->attributes()->rel, href: (string) $link->link->attributes()->href);
}
return $links;
}
/**
* @return array<string, string>
*/
private function buildHeaders(\SimpleXMLElement $resource): ?array
{
if (!$resource->headers) {
return null;
}
$headers = [];
foreach ($resource->headers as $header) {
$headers[(string) $header->header->attributes()->key] = (string) $header->header->attributes()->value;
}
return $headers;
}
/**
* @return array<string, \ApiPlatform\Metadata\Parameter>
*/
private function buildParameters(\SimpleXMLElement $resource): ?array
{
if (!$resource->parameters) {
return null;
}
$parameters = [];
foreach ($resource->parameters->parameter as $parameter) {
$key = (string) $parameter->attributes()->key;
$cl = ('header' === (string) $parameter->attributes()->in) ? HeaderParameter::class : QueryParameter::class;
$parameters[$key] = new $cl(
key: $key,
required: $this->phpize($parameter, 'required', 'bool'),
schema: isset($parameter->schema->values) ? $this->buildValues($parameter->schema->values) : null,
openApi: isset($parameter->openapi) ? new OpenApiParameter(
name: $this->phpize($parameter->openapi, 'name', 'string'),
in: $this->phpize($parameter->openapi, 'in', 'string'),
description: $this->phpize($parameter->openapi, 'description', 'string'),
required: $this->phpize($parameter->openapi, 'required', 'bool'),
deprecated: $this->phpize($parameter->openapi, 'deprecated', 'bool'),
allowEmptyValue: $this->phpize($parameter->openapi, 'allowEmptyValue', 'bool'),
schema: isset($parameter->openapi->schema->values) ? $this->buildValues($parameter->openapi->schema->values) : null,
style: $this->phpize($parameter->openapi, 'style', 'string'),
explode: $this->phpize($parameter->openapi, 'explode', 'bool'),
allowReserved: $this->phpize($parameter->openapi, 'allowReserved', 'bool'),
example: $this->phpize($parameter->openapi, 'example', 'string'),
examples: isset($parameter->openapi->examples->values) ? new \ArrayObject($this->buildValues($parameter->openapi->examples->values)) : null,
content: isset($parameter->openapi->content->values) ? new \ArrayObject($this->buildValues($parameter->openapi->content->values)) : null,
) : null,
provider: $this->phpize($parameter, 'provider', 'string'),
filter: $this->phpize($parameter, 'filter', 'string'),
property: $this->phpize($parameter, 'property', 'string'),
description: $this->phpize($parameter, 'description', 'string'),
priority: $this->phpize($parameter, 'priority', 'integer'),
extraProperties: $this->buildExtraProperties($parameter, 'extraProperties') ?? [],
);
}
return $parameters;
}
}