• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 18046663088

26 Sep 2025 06:52PM UTC coverage: 0.0% (-21.8%) from 21.793%
18046663088

Pull #7397

github

web-flow
Merge 638ad9207 into 00fbdf724
Pull Request #7397: fix(jsonschema/jsonld): force input schema to json format instead of jsonld format

0 of 16 new or added lines in 1 file covered. (0.0%)

11928 existing lines in 393 files now uncovered.

0 of 53912 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Metadata/Metadata.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Metadata;
15

16
use ApiPlatform\State\OptionsInterface;
17

18
/**
19
 * @psalm-inheritors ApiResource|Operation
20
 */
21
abstract class Metadata
22
{
23
    protected ?Parameters $parameters = null;
24

25
    /**
26
     * @param class-string                                                                      $class
27
     * @param string|null                                                                       $deprecationReason       https://api-platform.com/docs/core/deprecations/#deprecating-resource-classes-operations-and-properties
28
     * @param string|\Stringable|null                                                           $security                https://api-platform.com/docs/core/security
29
     * @param string|\Stringable|null                                                           $securityPostDenormalize https://api-platform.com/docs/core/security/#executing-access-control-rules-after-denormalization
30
     * @param mixed|null                                                                        $mercure
31
     * @param mixed|null                                                                        $messenger
32
     * @param mixed|null                                                                        $input
33
     * @param mixed|null                                                                        $output
34
     * @param mixed|null                                                                        $provider
35
     * @param mixed|null                                                                        $processor
36
     * @param Parameters|array<string, Parameter>                                               $parameters
37
     * @param callable|string|array<string, \Illuminate\Contracts\Validation\Rule|array|string> $rules                   Laravel rules can be a FormRequest class, a callable or an array of rules
38
     */
39
    public function __construct(
40
        protected ?string $shortName = null,
41
        protected ?string $class = null,
42
        protected ?string $description = null,
43
        protected ?int $urlGenerationStrategy = null,
44
        protected ?string $deprecationReason = null,
45
        protected ?array $normalizationContext = null,
46
        protected ?array $denormalizationContext = null,
47
        protected ?bool $collectDenormalizationErrors = null,
48
        protected ?array $validationContext = null,
49
        protected ?array $filters = null,
50
        protected $mercure = null,
51
        protected $messenger = null,
52
        protected $input = null,
53
        protected $output = null,
54
        protected ?array $order = null,
55
        protected ?bool $fetchPartial = null,
56
        protected ?bool $forceEager = null,
57
        protected ?bool $paginationEnabled = null,
58
        protected ?string $paginationType = null,
59
        protected ?int $paginationItemsPerPage = null,
60
        protected ?int $paginationMaximumItemsPerPage = null,
61
        protected ?bool $paginationPartial = null,
62
        protected ?bool $paginationClientEnabled = null,
63
        protected ?bool $paginationClientItemsPerPage = null,
64
        protected ?bool $paginationClientPartial = null,
65
        protected ?bool $paginationFetchJoinCollection = null,
66
        protected ?bool $paginationUseOutputWalkers = null,
67
        protected string|\Stringable|null $security = null,
68
        protected ?string $securityMessage = null,
69
        protected string|\Stringable|null $securityPostDenormalize = null,
70
        protected ?string $securityPostDenormalizeMessage = null,
71
        protected string|\Stringable|null $securityPostValidation = null,
72
        protected ?string $securityPostValidationMessage = null,
73
        protected $provider = null,
74
        protected $processor = null,
75
        protected ?OptionsInterface $stateOptions = null,
76
        array|Parameters|null $parameters = null,
77
        protected mixed $rules = null,
78
        protected ?string $policy = null,
79
        protected array|string|null $middleware = null,
80
        protected ?bool $queryParameterValidationEnabled = null,
81
        protected ?bool $strictQueryParameterValidation = null,
82
        protected ?bool $hideHydraOperation = null,
83
        protected ?bool $jsonStream = null,
84
        protected array $extraProperties = [],
85
    ) {
UNCOV
86
        if (\is_array($parameters) && $parameters) {
×
UNCOV
87
            $parameters = new Parameters($parameters);
×
88
        }
89

UNCOV
90
        $this->parameters = $parameters;
×
91
    }
92

93
    public function getShortName(): ?string
94
    {
UNCOV
95
        return $this->shortName;
×
96
    }
97

98
    public function withShortName(string $shortName): static
99
    {
UNCOV
100
        $self = clone $this;
×
UNCOV
101
        $self->shortName = $shortName;
×
102

UNCOV
103
        return $self;
×
104
    }
105

106
    /**
107
     * @return class-string|null
108
     */
109
    public function getClass(): ?string
110
    {
UNCOV
111
        return $this->class;
×
112
    }
113

114
    /**
115
     * @param class-string $class
116
     */
117
    public function withClass(string $class): static
118
    {
UNCOV
119
        $self = clone $this;
×
UNCOV
120
        $self->class = $class;
×
121

UNCOV
122
        return $self;
×
123
    }
124

125
    public function getDescription(): ?string
126
    {
UNCOV
127
        return $this->description;
×
128
    }
129

130
    public function withDescription(?string $description = null): static
131
    {
UNCOV
132
        $self = clone $this;
×
UNCOV
133
        $self->description = $description;
×
134

UNCOV
135
        return $self;
×
136
    }
137

138
    public function getUrlGenerationStrategy(): ?int
139
    {
UNCOV
140
        return $this->urlGenerationStrategy;
×
141
    }
142

143
    public function withUrlGenerationStrategy(int $urlGenerationStrategy): static
144
    {
145
        $self = clone $this;
×
146
        $self->urlGenerationStrategy = $urlGenerationStrategy;
×
147

148
        return $self;
×
149
    }
150

151
    public function getDeprecationReason(): ?string
152
    {
UNCOV
153
        return $this->deprecationReason;
×
154
    }
155

156
    /**
157
     * @param string $deprecationReason
158
     */
159
    public function withDeprecationReason($deprecationReason): static
160
    {
161
        $self = clone $this;
×
162
        $self->deprecationReason = $deprecationReason;
×
163

164
        return $self;
×
165
    }
166

167
    public function getNormalizationContext(): ?array
168
    {
UNCOV
169
        return $this->normalizationContext;
×
170
    }
171

172
    public function withNormalizationContext(array $normalizationContext): static
173
    {
UNCOV
174
        $self = clone $this;
×
UNCOV
175
        $self->normalizationContext = $normalizationContext;
×
176

UNCOV
177
        return $self;
×
178
    }
179

180
    public function getDenormalizationContext(): ?array
181
    {
UNCOV
182
        return $this->denormalizationContext;
×
183
    }
184

185
    public function withDenormalizationContext(array $denormalizationContext): static
186
    {
UNCOV
187
        $self = clone $this;
×
UNCOV
188
        $self->denormalizationContext = $denormalizationContext;
×
189

UNCOV
190
        return $self;
×
191
    }
192

193
    public function getCollectDenormalizationErrors(): ?bool
194
    {
UNCOV
195
        return $this->collectDenormalizationErrors;
×
196
    }
197

198
    public function withCollectDenormalizationErrors(?bool $collectDenormalizationErrors = null): static
199
    {
UNCOV
200
        $self = clone $this;
×
UNCOV
201
        $self->collectDenormalizationErrors = $collectDenormalizationErrors;
×
202

UNCOV
203
        return $self;
×
204
    }
205

206
    public function getValidationContext(): ?array
207
    {
UNCOV
208
        return $this->validationContext;
×
209
    }
210

211
    public function withValidationContext(array $validationContext): static
212
    {
213
        $self = clone $this;
×
214
        $self->validationContext = $validationContext;
×
215

216
        return $self;
×
217
    }
218

219
    /**
220
     * @return string[]|null
221
     */
222
    public function getFilters(): ?array
223
    {
UNCOV
224
        return $this->filters;
×
225
    }
226

227
    public function withFilters(array $filters): static
228
    {
UNCOV
229
        $self = clone $this;
×
UNCOV
230
        $self->filters = $filters;
×
231

UNCOV
232
        return $self;
×
233
    }
234

235
    public function getMercure(): mixed
236
    {
UNCOV
237
        return $this->mercure;
×
238
    }
239

240
    public function withMercure(mixed $mercure): static
241
    {
UNCOV
242
        $self = clone $this;
×
UNCOV
243
        $self->mercure = $mercure;
×
244

UNCOV
245
        return $self;
×
246
    }
247

248
    public function getMessenger(): mixed
249
    {
UNCOV
250
        return $this->messenger;
×
251
    }
252

253
    public function withMessenger(mixed $messenger): static
254
    {
255
        $self = clone $this;
×
256
        $self->messenger = $messenger;
×
257

258
        return $self;
×
259
    }
260

261
    public function getInput(): mixed
262
    {
UNCOV
263
        return $this->input;
×
264
    }
265

266
    public function withInput(mixed $input): static
267
    {
UNCOV
268
        $self = clone $this;
×
UNCOV
269
        $self->input = $input;
×
270

UNCOV
271
        return $self;
×
272
    }
273

274
    public function getOutput(): mixed
275
    {
UNCOV
276
        return $this->output;
×
277
    }
278

279
    public function withOutput(mixed $output): static
280
    {
UNCOV
281
        $self = clone $this;
×
UNCOV
282
        $self->output = $output;
×
283

UNCOV
284
        return $self;
×
285
    }
286

287
    public function getOrder(): ?array
288
    {
UNCOV
289
        return $this->order;
×
290
    }
291

292
    public function withOrder(array $order): static
293
    {
294
        $self = clone $this;
×
295
        $self->order = $order;
×
296

297
        return $self;
×
298
    }
299

300
    public function getFetchPartial(): ?bool
301
    {
UNCOV
302
        return $this->fetchPartial;
×
303
    }
304

305
    public function withFetchPartial(bool $fetchPartial): static
306
    {
307
        $self = clone $this;
×
308
        $self->fetchPartial = $fetchPartial;
×
309

310
        return $self;
×
311
    }
312

313
    public function getForceEager(): ?bool
314
    {
UNCOV
315
        return $this->forceEager;
×
316
    }
317

318
    public function withForceEager(bool $forceEager): static
319
    {
320
        $self = clone $this;
×
321
        $self->forceEager = $forceEager;
×
322

323
        return $self;
×
324
    }
325

326
    public function getPaginationEnabled(): ?bool
327
    {
UNCOV
328
        return $this->paginationEnabled;
×
329
    }
330

331
    public function withPaginationEnabled(bool $paginationEnabled): static
332
    {
333
        $self = clone $this;
×
334
        $self->paginationEnabled = $paginationEnabled;
×
335

336
        return $self;
×
337
    }
338

339
    public function getPaginationType(): ?string
340
    {
UNCOV
341
        return $this->paginationType;
×
342
    }
343

344
    public function withPaginationType(string $paginationType): static
345
    {
346
        $self = clone $this;
×
347
        $self->paginationType = $paginationType;
×
348

349
        return $self;
×
350
    }
351

352
    public function getPaginationItemsPerPage(): ?int
353
    {
UNCOV
354
        return $this->paginationItemsPerPage;
×
355
    }
356

357
    public function withPaginationItemsPerPage(int $paginationItemsPerPage): static
358
    {
UNCOV
359
        $self = clone $this;
×
UNCOV
360
        $self->paginationItemsPerPage = $paginationItemsPerPage;
×
361

UNCOV
362
        return $self;
×
363
    }
364

365
    public function getPaginationMaximumItemsPerPage(): ?int
366
    {
UNCOV
367
        return $this->paginationMaximumItemsPerPage;
×
368
    }
369

370
    public function withPaginationMaximumItemsPerPage(int $paginationMaximumItemsPerPage): static
371
    {
372
        $self = clone $this;
×
373
        $self->paginationMaximumItemsPerPage = $paginationMaximumItemsPerPage;
×
374

375
        return $self;
×
376
    }
377

378
    public function getPaginationPartial(): ?bool
379
    {
UNCOV
380
        return $this->paginationPartial;
×
381
    }
382

383
    public function withPaginationPartial(bool $paginationPartial): static
384
    {
385
        $self = clone $this;
×
386
        $self->paginationPartial = $paginationPartial;
×
387

388
        return $self;
×
389
    }
390

391
    public function getPaginationClientEnabled(): ?bool
392
    {
UNCOV
393
        return $this->paginationClientEnabled;
×
394
    }
395

396
    public function withPaginationClientEnabled(bool $paginationClientEnabled): static
397
    {
UNCOV
398
        $self = clone $this;
×
UNCOV
399
        $self->paginationClientEnabled = $paginationClientEnabled;
×
400

UNCOV
401
        return $self;
×
402
    }
403

404
    public function getPaginationClientItemsPerPage(): ?bool
405
    {
UNCOV
406
        return $this->paginationClientItemsPerPage;
×
407
    }
408

409
    public function withPaginationClientItemsPerPage(bool $paginationClientItemsPerPage): static
410
    {
UNCOV
411
        $self = clone $this;
×
UNCOV
412
        $self->paginationClientItemsPerPage = $paginationClientItemsPerPage;
×
413

UNCOV
414
        return $self;
×
415
    }
416

417
    public function getPaginationClientPartial(): ?bool
418
    {
UNCOV
419
        return $this->paginationClientPartial;
×
420
    }
421

422
    public function withPaginationClientPartial(bool $paginationClientPartial): static
423
    {
UNCOV
424
        $self = clone $this;
×
UNCOV
425
        $self->paginationClientPartial = $paginationClientPartial;
×
426

UNCOV
427
        return $self;
×
428
    }
429

430
    public function getPaginationFetchJoinCollection(): ?bool
431
    {
UNCOV
432
        return $this->paginationFetchJoinCollection;
×
433
    }
434

435
    public function withPaginationFetchJoinCollection(bool $paginationFetchJoinCollection): static
436
    {
437
        $self = clone $this;
×
438
        $self->paginationFetchJoinCollection = $paginationFetchJoinCollection;
×
439

440
        return $self;
×
441
    }
442

443
    public function getPaginationUseOutputWalkers(): ?bool
444
    {
UNCOV
445
        return $this->paginationUseOutputWalkers;
×
446
    }
447

448
    public function withPaginationUseOutputWalkers(bool $paginationUseOutputWalkers): static
449
    {
450
        $self = clone $this;
×
451
        $self->paginationUseOutputWalkers = $paginationUseOutputWalkers;
×
452

453
        return $self;
×
454
    }
455

456
    public function getSecurity(): ?string
457
    {
UNCOV
458
        return $this->security instanceof \Stringable ? (string) $this->security : $this->security;
×
459
    }
460

461
    public function withSecurity(string|\Stringable|null $security = null): static
462
    {
UNCOV
463
        $self = clone $this;
×
UNCOV
464
        $self->security = $security;
×
465

UNCOV
466
        return $self;
×
467
    }
468

469
    public function getSecurityMessage(): ?string
470
    {
UNCOV
471
        return $this->securityMessage;
×
472
    }
473

474
    public function withSecurityMessage(string $securityMessage): static
475
    {
476
        $self = clone $this;
×
477
        $self->securityMessage = $securityMessage;
×
478

479
        return $self;
×
480
    }
481

482
    public function getSecurityPostDenormalize(): ?string
483
    {
UNCOV
484
        return $this->securityPostDenormalize instanceof \Stringable ? (string) $this->securityPostDenormalize : $this->securityPostDenormalize;
×
485
    }
486

487
    public function withSecurityPostDenormalize(string|\Stringable|null $securityPostDenormalize = null): static
488
    {
489
        $self = clone $this;
×
490
        $self->securityPostDenormalize = $securityPostDenormalize;
×
491

492
        return $self;
×
493
    }
494

495
    public function getSecurityPostDenormalizeMessage(): ?string
496
    {
UNCOV
497
        return $this->securityPostDenormalizeMessage;
×
498
    }
499

500
    public function withSecurityPostDenormalizeMessage(string $securityPostDenormalizeMessage): static
501
    {
502
        $self = clone $this;
×
503
        $self->securityPostDenormalizeMessage = $securityPostDenormalizeMessage;
×
504

505
        return $self;
×
506
    }
507

508
    public function getSecurityPostValidation(): ?string
509
    {
UNCOV
510
        return $this->securityPostValidation instanceof \Stringable ? (string) $this->securityPostValidation : $this->securityPostValidation;
×
511
    }
512

513
    public function withSecurityPostValidation(string|\Stringable|null $securityPostValidation = null): static
514
    {
515
        $self = clone $this;
×
516
        $self->securityPostValidation = $securityPostValidation;
×
517

518
        return $self;
×
519
    }
520

521
    public function getSecurityPostValidationMessage(): ?string
522
    {
UNCOV
523
        return $this->securityPostValidationMessage;
×
524
    }
525

526
    public function withSecurityPostValidationMessage(?string $securityPostValidationMessage = null): static
527
    {
528
        $self = clone $this;
×
529
        $self->securityPostValidationMessage = $securityPostValidationMessage;
×
530

531
        return $self;
×
532
    }
533

534
    public function getProcessor(): callable|string|null
535
    {
UNCOV
536
        return $this->processor;
×
537
    }
538

539
    public function withProcessor(callable|string|null $processor): static
540
    {
UNCOV
541
        $self = clone $this;
×
UNCOV
542
        $self->processor = $processor;
×
543

UNCOV
544
        return $self;
×
545
    }
546

547
    public function getProvider(): callable|string|null
548
    {
UNCOV
549
        return $this->provider;
×
550
    }
551

552
    public function withProvider(callable|string|null $provider): static
553
    {
UNCOV
554
        $self = clone $this;
×
UNCOV
555
        $self->provider = $provider;
×
556

UNCOV
557
        return $self;
×
558
    }
559

560
    public function getStateOptions(): ?OptionsInterface
561
    {
UNCOV
562
        return $this->stateOptions;
×
563
    }
564

565
    public function withStateOptions(?OptionsInterface $stateOptions): static
566
    {
UNCOV
567
        $self = clone $this;
×
UNCOV
568
        $self->stateOptions = $stateOptions;
×
569

UNCOV
570
        return $self;
×
571
    }
572

573
    /**
574
     * @return string|callable|array<string, \Illuminate\Contracts\Validation\Rule|array|string>
575
     */
576
    public function getRules(): mixed
577
    {
UNCOV
578
        return $this->rules;
×
579
    }
580

581
    /**
582
     * @param string|callable|array<string, \Illuminate\Contracts\Validation\Rule|array|string> $rules
583
     */
584
    public function withRules(mixed $rules): static
585
    {
586
        $self = clone $this;
×
587
        $self->rules = $rules;
×
588

589
        return $self;
×
590
    }
591

592
    public function getParameters(): ?Parameters
593
    {
UNCOV
594
        return $this->parameters;
×
595
    }
596

597
    public function withParameters(array|Parameters $parameters): static
598
    {
UNCOV
599
        $self = clone $this;
×
UNCOV
600
        $self->parameters = \is_array($parameters) ? new Parameters($parameters) : $parameters;
×
601

UNCOV
602
        return $self;
×
603
    }
604

605
    public function getQueryParameterValidationEnabled(): ?bool
606
    {
UNCOV
607
        return $this->queryParameterValidationEnabled;
×
608
    }
609

610
    public function withQueryParameterValidationEnabled(bool $queryParameterValidationEnabled): static
611
    {
612
        $self = clone $this;
×
613
        $self->queryParameterValidationEnabled = $queryParameterValidationEnabled;
×
614

615
        return $self;
×
616
    }
617

618
    public function getPolicy(): ?string
619
    {
UNCOV
620
        return $this->policy;
×
621
    }
622

623
    public function withPolicy(string $policy): static
624
    {
625
        $self = clone $this;
×
626
        $self->policy = $policy;
×
627

628
        return $self;
×
629
    }
630

631
    public function getMiddleware(): mixed
632
    {
UNCOV
633
        return $this->middleware;
×
634
    }
635

636
    public function withMiddleware(string|array $middleware): static
637
    {
638
        $self = clone $this;
×
639
        $self->middleware = $middleware;
×
640

641
        return $self;
×
642
    }
643

644
    public function getExtraProperties(): ?array
645
    {
UNCOV
646
        return $this->extraProperties;
×
647
    }
648

649
    public function withExtraProperties(array $extraProperties = []): static
650
    {
UNCOV
651
        $self = clone $this;
×
UNCOV
652
        $self->extraProperties = $extraProperties;
×
653

UNCOV
654
        return $self;
×
655
    }
656

657
    public function getStrictQueryParameterValidation(): ?bool
658
    {
UNCOV
659
        return $this->strictQueryParameterValidation;
×
660
    }
661

662
    public function withStrictQueryParameterValidation(bool $strictQueryParameterValidation): static
663
    {
664
        $self = clone $this;
×
665
        $self->strictQueryParameterValidation = $strictQueryParameterValidation;
×
666

667
        return $self;
×
668
    }
669

670
    public function getHideHydraOperation(): ?bool
671
    {
UNCOV
672
        return $this->hideHydraOperation;
×
673
    }
674

675
    public function withHideHydraOperation(bool $hideHydraOperation): static
676
    {
UNCOV
677
        $self = clone $this;
×
UNCOV
678
        $self->hideHydraOperation = $hideHydraOperation;
×
679

UNCOV
680
        return $self;
×
681
    }
682

683
    public function getJsonStream(): ?bool
684
    {
UNCOV
685
        return $this->jsonStream;
×
686
    }
687

688
    public function withJsonStream(bool $jsonStream): static
689
    {
690
        $self = clone $this;
×
691
        $self->jsonStream = $jsonStream;
×
692

693
        return $self;
×
694
    }
695
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc