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

api-platform / core / 7328478858

26 Dec 2023 09:45AM UTC coverage: 37.33% (+0.3%) from 37.046%
7328478858

push

github

web-flow
feat(serializer): collect cache tags using a TagCollector (#5758)

* feat(serializer): collect cache tags using a TagCollector

* simplify function signature

* fix bug in JsonApi normalizer

* minor changes as per latest review

* disable new tests for Symfony lowest

* cs

---------

Co-authored-by: Antoine Bluchet <soyuka@users.noreply.github.com>

31 of 44 new or added lines in 4 files covered. (70.45%)

3 existing lines in 1 file now uncovered.

10359 of 27750 relevant lines covered (37.33%)

28.57 hits per line

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

55.1
/src/Serializer/AbstractItemNormalizer.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\Serializer;
15

16
use ApiPlatform\Api\IriConverterInterface as LegacyIriConverterInterface;
17
use ApiPlatform\Api\ResourceClassResolverInterface as LegacyResourceClassResolverInterface;
18
use ApiPlatform\Exception\InvalidArgumentException;
19
use ApiPlatform\Exception\ItemNotFoundException;
20
use ApiPlatform\Metadata\ApiProperty;
21
use ApiPlatform\Metadata\CollectionOperationInterface;
22
use ApiPlatform\Metadata\IriConverterInterface;
23
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
24
use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
25
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
26
use ApiPlatform\Metadata\ResourceClassResolverInterface;
27
use ApiPlatform\Metadata\UrlGeneratorInterface;
28
use ApiPlatform\Metadata\Util\ClassInfoTrait;
29
use ApiPlatform\Metadata\Util\CloneTrait;
30
use ApiPlatform\Symfony\Security\ResourceAccessCheckerInterface;
31
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
32
use Symfony\Component\PropertyAccess\PropertyAccess;
33
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
34
use Symfony\Component\PropertyInfo\Type;
35
use Symfony\Component\Serializer\Encoder\CsvEncoder;
36
use Symfony\Component\Serializer\Encoder\XmlEncoder;
37
use Symfony\Component\Serializer\Exception\LogicException;
38
use Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException;
39
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
40
use Symfony\Component\Serializer\Exception\RuntimeException;
41
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
42
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
43
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
44
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
45
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
46
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
47
use Symfony\Component\Serializer\Serializer;
48

49
/**
50
 * Base item normalizer.
51
 *
52
 * @author Kévin Dunglas <dunglas@gmail.com>
53
 */
54
abstract class AbstractItemNormalizer extends AbstractObjectNormalizer
55
{
56
    use ClassInfoTrait;
57
    use CloneTrait;
58
    use ContextTrait;
59
    use InputOutputMetadataTrait;
60
    use OperationContextTrait;
61

62
    protected PropertyAccessorInterface $propertyAccessor;
63
    protected array $localCache = [];
64
    protected array $localFactoryOptionsCache = [];
65

66
    public function __construct(protected PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, protected PropertyMetadataFactoryInterface $propertyMetadataFactory, protected LegacyIriConverterInterface|IriConverterInterface $iriConverter, protected LegacyResourceClassResolverInterface|ResourceClassResolverInterface $resourceClassResolver, PropertyAccessorInterface $propertyAccessor = null, NameConverterInterface $nameConverter = null, ClassMetadataFactoryInterface $classMetadataFactory = null, array $defaultContext = [], ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, protected ?ResourceAccessCheckerInterface $resourceAccessChecker = null, protected ?TagCollectorInterface $tagCollector = null)
67
    {
68
        if (!isset($defaultContext['circular_reference_handler'])) {
176✔
69
            $defaultContext['circular_reference_handler'] = fn ($object): ?string => $this->iriConverter->getIriFromResource($object);
176✔
70
        }
71

72
        parent::__construct($classMetadataFactory, $nameConverter, null, null, \Closure::fromCallable($this->getObjectClass(...)), $defaultContext);
176✔
73
        $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
176✔
74
        $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory;
176✔
75
    }
76

77
    /**
78
     * {@inheritdoc}
79
     */
80
    public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
81
    {
82
        if (!\is_object($data) || is_iterable($data)) {
68✔
83
            return false;
32✔
84
        }
85

86
        $class = $context['force_resource_class'] ?? $this->getObjectClass($data);
44✔
87
        if (($context['output']['class'] ?? null) === $class) {
44✔
88
            return true;
4✔
89
        }
90

91
        return $this->resourceClassResolver->isResourceClass($class);
40✔
92
    }
93

94
    public function getSupportedTypes(?string $format): array
95
    {
96
        return [
80✔
97
            'object' => true,
80✔
98
        ];
80✔
99
    }
100

101
    /**
102
     * {@inheritdoc}
103
     */
104
    public function hasCacheableSupportsMethod(): bool
105
    {
106
        if (method_exists(Serializer::class, 'getSupportedTypes')) {
×
107
            trigger_deprecation(
×
108
                'api-platform/core',
×
109
                '3.1',
×
110
                'The "%s()" method is deprecated, use "getSupportedTypes()" instead.',
×
111
                __METHOD__
×
112
            );
×
113
        }
114

115
        return true;
×
116
    }
117

118
    /**
119
     * {@inheritdoc}
120
     *
121
     * @throws LogicException
122
     */
123
    public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
124
    {
125
        $resourceClass = $context['force_resource_class'] ?? $this->getObjectClass($object);
68✔
126
        if ($outputClass = $this->getOutputClass($context)) {
68✔
127
            if (!$this->serializer instanceof NormalizerInterface) {
4✔
128
                throw new LogicException('Cannot normalize the output because the injected serializer is not a normalizer');
×
129
            }
130

131
            unset($context['output'], $context['operation'], $context['operation_name']);
4✔
132
            $context['resource_class'] = $outputClass;
4✔
133
            $context['api_sub_level'] = true;
4✔
134
            $context[self::ALLOW_EXTRA_ATTRIBUTES] = false;
4✔
135

136
            return $this->serializer->normalize($object, $format, $context);
4✔
137
        }
138

139
        // Never remove this, with `application/json` we don't use our AbstractCollectionNormalizer and we need
140
        // to remove the collection operation from our context or we'll introduce security issues
141
        if (isset($context['operation']) && $context['operation'] instanceof CollectionOperationInterface) {
68✔
142
            unset($context['operation_name']);
×
143
            unset($context['operation']);
×
144
            unset($context['iri']);
×
145
        }
146

147
        if ($this->resourceClassResolver->isResourceClass($resourceClass)) {
68✔
148
            $context = $this->initContext($resourceClass, $context);
64✔
149
        }
150

151
        $context['api_normalize'] = true;
68✔
152
        $iri = $context['iri'] ??= $this->iriConverter->getIriFromResource($object, UrlGeneratorInterface::ABS_URL, $context['operation'] ?? null, $context);
68✔
153

154
        /*
155
         * When true, converts the normalized data array of a resource into an
156
         * IRI, if the normalized data array is empty.
157
         *
158
         * This is useful when traversing from a non-resource towards an attribute
159
         * which is a resource, as we do not have the benefit of {@see ApiProperty::isReadableLink}.
160
         *
161
         * It must not be propagated to resources, as {@see ApiProperty::isReadableLink}
162
         * should take effect.
163
         */
164
        $emptyResourceAsIri = $context['api_empty_resource_as_iri'] ?? false;
68✔
165
        unset($context['api_empty_resource_as_iri']);
68✔
166

167
        if (!$this->tagCollector && isset($context['resources'])) {
68✔
UNCOV
168
            $context['resources'][$iri] = $iri;
×
169
        }
170

171
        $context['object'] = $object;
68✔
172
        $context['format'] = $format;
68✔
173

174
        $data = parent::normalize($object, $format, $context);
68✔
175

176
        $context['data'] = $data;
64✔
177
        unset($context['property_metadata']);
64✔
178
        unset($context['api_attribute']);
64✔
179

180
        if ($emptyResourceAsIri && \is_array($data) && 0 === \count($data)) {
64✔
NEW
181
            $context['data'] = $iri;
×
182

NEW
183
            if ($this->tagCollector) {
×
NEW
184
                $this->tagCollector->collect($context);
×
185
            }
186

UNCOV
187
            return $iri;
×
188
        }
189

190
        if ($this->tagCollector) {
64✔
191
            $this->tagCollector->collect($context);
36✔
192
        }
193

194
        return $data;
64✔
195
    }
196

197
    /**
198
     * {@inheritdoc}
199
     */
200
    public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
201
    {
202
        if (($context['input']['class'] ?? null) === $type) {
12✔
203
            return true;
×
204
        }
205

206
        return $this->localCache[$type] ?? $this->localCache[$type] = $this->resourceClassResolver->isResourceClass($type);
12✔
207
    }
208

209
    /**
210
     * {@inheritdoc}
211
     */
212
    public function denormalize(mixed $data, string $class, string $format = null, array $context = []): mixed
213
    {
214
        $resourceClass = $class;
28✔
215

216
        if ($inputClass = $this->getInputClass($context)) {
28✔
217
            if (!$this->serializer instanceof DenormalizerInterface) {
×
218
                throw new LogicException('Cannot denormalize the input because the injected serializer is not a denormalizer');
×
219
            }
220

221
            unset($context['input'], $context['operation'], $context['operation_name']);
×
222
            $context['resource_class'] = $inputClass;
×
223

224
            try {
225
                return $this->serializer->denormalize($data, $inputClass, $format, $context);
×
226
            } catch (NotNormalizableValueException $e) {
×
227
                throw new UnexpectedValueException('The input data is misformatted.', $e->getCode(), $e);
×
228
            }
229
        }
230

231
        if (null === $objectToPopulate = $this->extractObjectToPopulate($resourceClass, $context, static::OBJECT_TO_POPULATE)) {
28✔
232
            $normalizedData = \is_scalar($data) ? [$data] : $this->prepareForDenormalization($data);
28✔
233
            $class = $this->getClassDiscriminatorResolvedClass($normalizedData, $class, $context);
28✔
234
        }
235

236
        $context['api_denormalize'] = true;
28✔
237

238
        if ($this->resourceClassResolver->isResourceClass($class)) {
28✔
239
            $resourceClass = $this->resourceClassResolver->getResourceClass($objectToPopulate, $class);
28✔
240
            $context['resource_class'] = $resourceClass;
28✔
241
        }
242

243
        if (\is_string($data)) {
28✔
244
            try {
245
                return $this->iriConverter->getResourceFromIri($data, $context + ['fetch_data' => true]);
×
246
            } catch (ItemNotFoundException $e) {
×
247
                throw new UnexpectedValueException($e->getMessage(), $e->getCode(), $e);
×
248
            } catch (InvalidArgumentException $e) {
×
249
                throw new UnexpectedValueException(sprintf('Invalid IRI "%s".', $data), $e->getCode(), $e);
×
250
            }
251
        }
252

253
        if (!\is_array($data)) {
28✔
254
            throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('The type of the "%s" resource must be "array" (nested document) or "string" (IRI), "%s" given.', $resourceClass, \gettype($data)), $data, [Type::BUILTIN_TYPE_ARRAY, Type::BUILTIN_TYPE_STRING], $context['deserialization_path'] ?? null);
×
255
        }
256

257
        $previousObject = $this->clone($objectToPopulate);
28✔
258
        $object = parent::denormalize($data, $class, $format, $context);
28✔
259

260
        if (!$this->resourceClassResolver->isResourceClass($class)) {
16✔
261
            return $object;
×
262
        }
263

264
        // Bypass the post-denormalize attribute revert logic if the object could not be
265
        // cloned since we cannot possibly revert any changes made to it.
266
        if (null !== $objectToPopulate && null === $previousObject) {
16✔
267
            return $object;
×
268
        }
269

270
        $options = $this->getFactoryOptions($context);
16✔
271
        $propertyNames = iterator_to_array($this->propertyNameCollectionFactory->create($resourceClass, $options));
16✔
272

273
        // Revert attributes that aren't allowed to be changed after a post-denormalize check
274
        foreach (array_keys($data) as $attribute) {
16✔
275
            $attribute = $this->nameConverter ? $this->nameConverter->denormalize((string) $attribute) : $attribute;
16✔
276
            if (!\in_array($attribute, $propertyNames, true)) {
16✔
277
                continue;
×
278
            }
279

280
            if (!$this->canAccessAttributePostDenormalize($object, $previousObject, $attribute, $context)) {
16✔
281
                if (null !== $previousObject) {
×
282
                    $this->setValue($object, $attribute, $this->propertyAccessor->getValue($previousObject, $attribute));
×
283
                } else {
284
                    $propertyMetadata = $this->propertyMetadataFactory->create($resourceClass, $attribute, $options);
×
285
                    $this->setValue($object, $attribute, $propertyMetadata->getDefault());
×
286
                }
287
            }
288
        }
289

290
        return $object;
16✔
291
    }
292

293
    /**
294
     * Method copy-pasted from symfony/serializer.
295
     * Remove it after symfony/serializer version update @see https://github.com/symfony/symfony/pull/28263.
296
     *
297
     * {@inheritdoc}
298
     *
299
     * @internal
300
     */
301
    protected function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, array|bool $allowedAttributes, string $format = null): object
302
    {
303
        if (null !== $object = $this->extractObjectToPopulate($class, $context, static::OBJECT_TO_POPULATE)) {
28✔
304
            unset($context[static::OBJECT_TO_POPULATE]);
×
305

306
            return $object;
×
307
        }
308

309
        $class = $this->getClassDiscriminatorResolvedClass($data, $class, $context);
28✔
310
        $reflectionClass = new \ReflectionClass($class);
28✔
311

312
        $constructor = $this->getConstructor($data, $class, $context, $reflectionClass, $allowedAttributes);
28✔
313
        if ($constructor) {
28✔
314
            $constructorParameters = $constructor->getParameters();
28✔
315

316
            $params = [];
28✔
317
            foreach ($constructorParameters as $constructorParameter) {
28✔
318
                $paramName = $constructorParameter->name;
×
319
                $key = $this->nameConverter ? $this->nameConverter->normalize($paramName, $class, $format, $context) : $paramName;
×
320

321
                $allowed = false === $allowedAttributes || (\is_array($allowedAttributes) && \in_array($paramName, $allowedAttributes, true));
×
322
                $ignored = !$this->isAllowedAttribute($class, $paramName, $format, $context);
×
323
                if ($constructorParameter->isVariadic()) {
×
324
                    if ($allowed && !$ignored && (isset($data[$key]) || \array_key_exists($key, $data))) {
×
325
                        if (!\is_array($data[$paramName])) {
×
326
                            throw new RuntimeException(sprintf('Cannot create an instance of %s from serialized data because the variadic parameter %s can only accept an array.', $class, $constructorParameter->name));
×
327
                        }
328

329
                        $params[] = $data[$paramName];
×
330
                    }
331
                } elseif ($allowed && !$ignored && (isset($data[$key]) || \array_key_exists($key, $data))) {
×
332
                    $constructorContext = $context;
×
333
                    $constructorContext['deserialization_path'] = $context['deserialization_path'] ?? $key;
×
334
                    try {
335
                        $params[] = $this->createConstructorArgument($data[$key], $key, $constructorParameter, $constructorContext, $format);
×
336
                    } catch (NotNormalizableValueException $exception) {
×
337
                        if (!isset($context['not_normalizable_value_exceptions'])) {
×
338
                            throw $exception;
×
339
                        }
340
                        $context['not_normalizable_value_exceptions'][] = $exception;
×
341
                    }
342

343
                    // Don't run set for a parameter passed to the constructor
344
                    unset($data[$key]);
×
345
                } elseif (isset($context[static::DEFAULT_CONSTRUCTOR_ARGUMENTS][$class][$key])) {
×
346
                    $params[] = $context[static::DEFAULT_CONSTRUCTOR_ARGUMENTS][$class][$key];
×
347
                } elseif ($constructorParameter->isDefaultValueAvailable()) {
×
348
                    $params[] = $constructorParameter->getDefaultValue();
×
349
                } else {
350
                    if (!isset($context['not_normalizable_value_exceptions'])) {
×
351
                        throw new MissingConstructorArgumentsException(sprintf('Cannot create an instance of "%s" from serialized data because its constructor requires parameter "%s" to be present.', $class, $constructorParameter->name), 0, null, [$constructorParameter->name]);
×
352
                    }
353

354
                    $exception = NotNormalizableValueException::createForUnexpectedDataType(sprintf('Failed to create object because the class misses the "%s" property.', $constructorParameter->name), $data, ['unknown'], $context['deserialization_path'] ?? null, true);
×
355
                    $context['not_normalizable_value_exceptions'][] = $exception;
×
356
                }
357
            }
358

359
            if (\count($context['not_normalizable_value_exceptions'] ?? []) > 0) {
28✔
360
                return $reflectionClass->newInstanceWithoutConstructor();
×
361
            }
362

363
            if ($constructor->isConstructor()) {
28✔
364
                return $reflectionClass->newInstanceArgs($params);
28✔
365
            }
366

367
            return $constructor->invokeArgs(null, $params);
×
368
        }
369

370
        return new $class();
×
371
    }
372

373
    protected function getClassDiscriminatorResolvedClass(array $data, string $class, array $context = []): string
374
    {
375
        if (null === $this->classDiscriminatorResolver || (null === $mapping = $this->classDiscriminatorResolver->getMappingForClass($class))) {
28✔
376
            return $class;
28✔
377
        }
378

379
        if (!isset($data[$mapping->getTypeProperty()])) {
×
380
            throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('Type property "%s" not found for the abstract object "%s".', $mapping->getTypeProperty(), $class), null, ['string'], isset($context['deserialization_path']) ? $context['deserialization_path'].'.'.$mapping->getTypeProperty() : $mapping->getTypeProperty());
×
381
        }
382

383
        $type = $data[$mapping->getTypeProperty()];
×
384
        if (null === ($mappedClass = $mapping->getClassForType($type))) {
×
385
            throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('The type "%s" is not a valid value.', $type), $type, ['string'], isset($context['deserialization_path']) ? $context['deserialization_path'].'.'.$mapping->getTypeProperty() : $mapping->getTypeProperty(), true);
×
386
        }
387

388
        return $mappedClass;
×
389
    }
390

391
    protected function createConstructorArgument($parameterData, string $key, \ReflectionParameter $constructorParameter, array &$context, string $format = null): mixed
392
    {
393
        return $this->createAndValidateAttributeValue($constructorParameter->name, $parameterData, $format, $context);
×
394
    }
395

396
    /**
397
     * {@inheritdoc}
398
     *
399
     * Unused in this context.
400
     *
401
     * @return string[]
402
     */
403
    protected function extractAttributes($object, $format = null, array $context = []): array
404
    {
405
        return [];
×
406
    }
407

408
    /**
409
     * {@inheritdoc}
410
     */
411
    protected function getAllowedAttributes(string|object $classOrObject, array $context, bool $attributesAsString = false): array|bool
412
    {
413
        if (!$this->resourceClassResolver->isResourceClass($context['resource_class'])) {
80✔
414
            return parent::getAllowedAttributes($classOrObject, $context, $attributesAsString);
4✔
415
        }
416

417
        $resourceClass = $this->resourceClassResolver->getResourceClass(null, $context['resource_class']); // fix for abstract classes and interfaces
76✔
418
        $options = $this->getFactoryOptions($context);
76✔
419
        $propertyNames = $this->propertyNameCollectionFactory->create($resourceClass, $options);
76✔
420

421
        $allowedAttributes = [];
76✔
422
        foreach ($propertyNames as $propertyName) {
76✔
423
            $propertyMetadata = $this->propertyMetadataFactory->create($resourceClass, $propertyName, $options);
76✔
424

425
            if (
426
                $this->isAllowedAttribute($classOrObject, $propertyName, null, $context)
76✔
427
                && (isset($context['api_normalize']) && $propertyMetadata->isReadable()
76✔
428
                    || isset($context['api_denormalize']) && ($propertyMetadata->isWritable() || !\is_object($classOrObject) && $propertyMetadata->isInitializable())
76✔
429
                )
430
            ) {
431
                $allowedAttributes[] = $propertyName;
76✔
432
            }
433
        }
434

435
        return $allowedAttributes;
76✔
436
    }
437

438
    /**
439
     * {@inheritdoc}
440
     */
441
    protected function isAllowedAttribute(object|string $classOrObject, string $attribute, string $format = null, array $context = []): bool
442
    {
443
        if (!parent::isAllowedAttribute($classOrObject, $attribute, $format, $context)) {
80✔
444
            return false;
×
445
        }
446

447
        return $this->canAccessAttribute(\is_object($classOrObject) ? $classOrObject : null, $attribute, $context);
80✔
448
    }
449

450
    /**
451
     * Check if access to the attribute is granted.
452
     */
453
    protected function canAccessAttribute(?object $object, string $attribute, array $context = []): bool
454
    {
455
        if (!$this->resourceClassResolver->isResourceClass($context['resource_class'])) {
80✔
456
            return true;
4✔
457
        }
458

459
        $options = $this->getFactoryOptions($context);
76✔
460
        $propertyMetadata = $this->propertyMetadataFactory->create($context['resource_class'], $attribute, $options);
76✔
461
        $security = $propertyMetadata->getSecurity();
76✔
462
        if (null !== $this->resourceAccessChecker && $security) {
76✔
463
            return $this->resourceAccessChecker->isGranted($context['resource_class'], $security, [
×
464
                'object' => $object,
×
465
            ]);
×
466
        }
467

468
        return true;
76✔
469
    }
470

471
    /**
472
     * Check if access to the attribute is granted.
473
     */
474
    protected function canAccessAttributePostDenormalize(?object $object, ?object $previousObject, string $attribute, array $context = []): bool
475
    {
476
        $options = $this->getFactoryOptions($context);
16✔
477
        $propertyMetadata = $this->propertyMetadataFactory->create($context['resource_class'], $attribute, $options);
16✔
478
        $security = $propertyMetadata->getSecurityPostDenormalize();
16✔
479
        if ($this->resourceAccessChecker && $security) {
16✔
480
            return $this->resourceAccessChecker->isGranted($context['resource_class'], $security, [
×
481
                'object' => $object,
×
482
                'previous_object' => $previousObject,
×
483
            ]);
×
484
        }
485

486
        return true;
16✔
487
    }
488

489
    /**
490
     * {@inheritdoc}
491
     */
492
    protected function setAttributeValue(object $object, string $attribute, mixed $value, string $format = null, array $context = []): void
493
    {
494
        try {
495
            $this->setValue($object, $attribute, $this->createAttributeValue($attribute, $value, $format, $context));
28✔
496
        } catch (NotNormalizableValueException $exception) {
12✔
497
            // Only throw if collecting denormalization errors is disabled.
498
            if (!isset($context['not_normalizable_value_exceptions'])) {
8✔
499
                throw $exception;
8✔
500
            }
501
        }
502
    }
503

504
    /**
505
     * Validates the type of the value. Allows using integers as floats for JSON formats.
506
     *
507
     * @throws NotNormalizableValueException
508
     */
509
    protected function validateType(string $attribute, Type $type, mixed $value, string $format = null, array $context = []): void
510
    {
511
        $builtinType = $type->getBuiltinType();
16✔
512
        if (Type::BUILTIN_TYPE_FLOAT === $builtinType && null !== $format && str_contains($format, 'json')) {
16✔
513
            $isValid = \is_float($value) || \is_int($value);
×
514
        } else {
515
            $isValid = \call_user_func('is_'.$builtinType, $value);
16✔
516
        }
517

518
        if (!$isValid) {
16✔
519
            throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('The type of the "%s" attribute must be "%s", "%s" given.', $attribute, $builtinType, \gettype($value)), $value, [$builtinType], $context['deserialization_path'] ?? null);
×
520
        }
521
    }
522

523
    /**
524
     * Denormalizes a collection of objects.
525
     *
526
     * @throws NotNormalizableValueException
527
     */
528
    protected function denormalizeCollection(string $attribute, ApiProperty $propertyMetadata, Type $type, string $className, mixed $value, ?string $format, array $context): array
529
    {
530
        if (!\is_array($value)) {
12✔
531
            throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('The type of the "%s" attribute must be "array", "%s" given.', $attribute, \gettype($value)), $value, [Type::BUILTIN_TYPE_ARRAY], $context['deserialization_path'] ?? null);
4✔
532
        }
533

534
        $collectionKeyType = $type->getCollectionKeyTypes()[0] ?? null;
8✔
535
        $collectionKeyBuiltinType = $collectionKeyType?->getBuiltinType();
8✔
536
        $childContext = $this->createChildContext($this->createOperationContext($context, $className), $attribute, $format);
8✔
537
        $values = [];
8✔
538
        foreach ($value as $index => $obj) {
8✔
539
            if (null !== $collectionKeyBuiltinType && !\call_user_func('is_'.$collectionKeyBuiltinType, $index)) {
8✔
540
                throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('The type of the key "%s" must be "%s", "%s" given.', $index, $collectionKeyBuiltinType, \gettype($index)), $index, [$collectionKeyBuiltinType], ($context['deserialization_path'] ?? false) ? sprintf('key(%s)', $context['deserialization_path']) : null, true);
4✔
541
            }
542

543
            $values[$index] = $this->denormalizeRelation($attribute, $propertyMetadata, $className, $obj, $format, $childContext);
4✔
544
        }
545

546
        return $values;
4✔
547
    }
548

549
    /**
550
     * Denormalizes a relation.
551
     *
552
     * @throws LogicException
553
     * @throws UnexpectedValueException
554
     * @throws NotNormalizableValueException
555
     */
556
    protected function denormalizeRelation(string $attributeName, ApiProperty $propertyMetadata, string $className, mixed $value, ?string $format, array $context): ?object
557
    {
558
        if (\is_string($value)) {
×
559
            try {
560
                return $this->iriConverter->getResourceFromIri($value, $context + ['fetch_data' => true]);
×
561
            } catch (ItemNotFoundException $e) {
×
562
                if (!isset($context['not_normalizable_value_exceptions'])) {
×
563
                    throw new UnexpectedValueException($e->getMessage(), $e->getCode(), $e);
×
564
                }
565
                $context['not_normalizable_value_exceptions'][] = NotNormalizableValueException::createForUnexpectedDataType(
×
566
                    $e->getMessage(),
×
567
                    $value,
×
568
                    [$className],
×
569
                    $context['deserialization_path'] ?? null,
×
570
                    true,
×
571
                    $e->getCode(),
×
572
                    $e
×
573
                );
×
574

575
                return null;
×
576
            } catch (InvalidArgumentException $e) {
×
577
                if (!isset($context['not_normalizable_value_exceptions'])) {
×
578
                    throw new UnexpectedValueException(sprintf('Invalid IRI "%s".', $value), $e->getCode(), $e);
×
579
                }
580
                $context['not_normalizable_value_exceptions'][] = NotNormalizableValueException::createForUnexpectedDataType(
×
581
                    $e->getMessage(),
×
582
                    $value,
×
583
                    [$className],
×
584
                    $context['deserialization_path'] ?? null,
×
585
                    true,
×
586
                    $e->getCode(),
×
587
                    $e
×
588
                );
×
589

590
                return null;
×
591
            }
592
        }
593

594
        if ($propertyMetadata->isWritableLink()) {
×
595
            $context['api_allow_update'] = true;
×
596

597
            if (!$this->serializer instanceof DenormalizerInterface) {
×
598
                throw new LogicException(sprintf('The injected serializer must be an instance of "%s".', DenormalizerInterface::class));
×
599
            }
600

601
            $item = $this->serializer->denormalize($value, $className, $format, $context);
×
602
            if (!\is_object($item) && null !== $item) {
×
603
                throw new \UnexpectedValueException('Expected item to be an object or null.');
×
604
            }
605

606
            return $item;
×
607
        }
608

609
        if (!\is_array($value)) {
×
610
            throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('The type of the "%s" attribute must be "array" (nested document) or "string" (IRI), "%s" given.', $attributeName, \gettype($value)), $value, [Type::BUILTIN_TYPE_ARRAY, Type::BUILTIN_TYPE_STRING], $context['deserialization_path'] ?? null, true);
×
611
        }
612

613
        throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('Nested documents for attribute "%s" are not allowed. Use IRIs instead.', $attributeName), $value, [Type::BUILTIN_TYPE_ARRAY, Type::BUILTIN_TYPE_STRING], $context['deserialization_path'] ?? null, true);
×
614
    }
615

616
    /**
617
     * Gets the options for the property name collection / property metadata factories.
618
     */
619
    protected function getFactoryOptions(array $context): array
620
    {
621
        $options = [];
80✔
622
        if (isset($context[self::GROUPS])) {
80✔
623
            /* @see https://github.com/symfony/symfony/blob/v4.2.6/src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php */
624
            $options['serializer_groups'] = (array) $context[self::GROUPS];
8✔
625
        }
626

627
        $operationCacheKey = ($context['resource_class'] ?? '').($context['operation_name'] ?? '').($context['api_normalize'] ?? '');
80✔
628
        if ($operationCacheKey && isset($this->localFactoryOptionsCache[$operationCacheKey])) {
80✔
629
            return $options + $this->localFactoryOptionsCache[$operationCacheKey];
80✔
630
        }
631

632
        // This is a hot spot
633
        if (isset($context['resource_class'])) {
80✔
634
            // Note that the groups need to be read on the root operation
635
            if ($operation = ($context['root_operation'] ?? null)) {
80✔
636
                $options['normalization_groups'] = $operation->getNormalizationContext()['groups'] ?? null;
8✔
637
                $options['denormalization_groups'] = $operation->getDenormalizationContext()['groups'] ?? null;
8✔
638
                $options['operation_name'] = $operation->getName();
8✔
639
            }
640
        }
641

642
        return $options + $this->localFactoryOptionsCache[$operationCacheKey] = $options;
80✔
643
    }
644

645
    /**
646
     * {@inheritdoc}
647
     *
648
     * @throws UnexpectedValueException
649
     */
650
    protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed
651
    {
652
        $context['api_attribute'] = $attribute;
64✔
653
        $context['property_metadata'] = $propertyMetadata = $this->propertyMetadataFactory->create($context['resource_class'], $attribute, $this->getFactoryOptions($context));
64✔
654

655
        if ($context['api_denormalize'] ?? false) {
64✔
656
            return $this->propertyAccessor->getValue($object, $attribute);
×
657
        }
658

659
        $types = $propertyMetadata->getBuiltinTypes() ?? [];
64✔
660

661
        foreach ($types as $type) {
64✔
662
            if (
663
                $type->isCollection()
52✔
664
                && ($collectionValueType = $type->getCollectionValueTypes()[0] ?? null)
52✔
665
                && ($className = $collectionValueType->getClassName())
52✔
666
                && $this->resourceClassResolver->isResourceClass($className)
52✔
667
            ) {
668
                $childContext = $this->createChildContext($this->createOperationContext($context, $className), $attribute, $format);
16✔
669

670
                // @see ApiPlatform\Hal\Serializer\ItemNormalizer:getComponents logic for intentional duplicate content
671
                // @see ApiPlatform\JsonApi\Serializer\ItemNormalizer:getComponents logic for intentional duplicate content
672
                if ('jsonld' === $format && $itemUriTemplate = $propertyMetadata->getUriTemplate()) {
16✔
673
                    $operation = $this->resourceMetadataCollectionFactory->create($className)->getOperation(
×
674
                        operationName: $itemUriTemplate,
×
675
                        forceCollection: true,
×
676
                        httpOperation: true
×
677
                    );
×
678

679
                    return $this->iriConverter->getIriFromResource($object, UrlGeneratorInterface::ABS_PATH, $operation, $childContext);
×
680
                }
681

682
                $attributeValue = $this->propertyAccessor->getValue($object, $attribute);
16✔
683

684
                if (!is_iterable($attributeValue)) {
16✔
685
                    throw new UnexpectedValueException('Unexpected non-iterable value for to-many relation.');
×
686
                }
687

688
                $resourceClass = $this->resourceClassResolver->getResourceClass($attributeValue, $className);
16✔
689

690
                $data = $this->normalizeCollectionOfRelations($propertyMetadata, $attributeValue, $resourceClass, $format, $childContext);
16✔
691
                $context['data'] = $data;
16✔
692
                $context['type'] = $type;
16✔
693

694
                if ($this->tagCollector) {
16✔
695
                    $this->tagCollector->collect($context);
16✔
696
                }
697

698
                return $data;
16✔
699
            }
700

701
            if (
702
                ($className = $type->getClassName())
52✔
703
                && $this->resourceClassResolver->isResourceClass($className)
52✔
704
            ) {
705
                $childContext = $this->createChildContext($this->createOperationContext($context, $className), $attribute, $format);
24✔
706
                unset($childContext['iri'], $childContext['uri_variables'], $childContext['item_uri_template']);
24✔
707

708
                if ('jsonld' === $format && $uriTemplate = $propertyMetadata->getUriTemplate()) {
24✔
709
                    $operation = $this->resourceMetadataCollectionFactory->create($className)->getOperation(
×
710
                        operationName: $uriTemplate,
×
711
                        httpOperation: true
×
712
                    );
×
713

714
                    return $this->iriConverter->getIriFromResource($object, UrlGeneratorInterface::ABS_PATH, $operation, $childContext);
×
715
                }
716

717
                $attributeValue = $this->propertyAccessor->getValue($object, $attribute);
24✔
718

719
                if (!\is_object($attributeValue) && null !== $attributeValue) {
24✔
720
                    throw new UnexpectedValueException('Unexpected non-object value for to-one relation.');
×
721
                }
722

723
                $resourceClass = $this->resourceClassResolver->getResourceClass($attributeValue, $className);
24✔
724

725
                $data = $this->normalizeRelation($propertyMetadata, $attributeValue, $resourceClass, $format, $childContext);
24✔
726
                $context['data'] = $data;
24✔
727
                $context['type'] = $type;
24✔
728

729
                if ($this->tagCollector) {
24✔
730
                    $this->tagCollector->collect($context);
12✔
731
                }
732

733
                return $data;
24✔
734
            }
735

736
            if (!$this->serializer instanceof NormalizerInterface) {
52✔
737
                throw new LogicException(sprintf('The injected serializer must be an instance of "%s".', NormalizerInterface::class));
×
738
            }
739

740
            unset(
52✔
741
                $context['resource_class'],
52✔
742
                $context['force_resource_class'],
52✔
743
            );
52✔
744

745
            // Anonymous resources
746
            if ($className) {
52✔
747
                $childContext = $this->createChildContext($this->createOperationContext($context, $className), $attribute, $format);
16✔
748
                $childContext['output']['gen_id'] = $propertyMetadata->getGenId() ?? true;
16✔
749

750
                $attributeValue = $this->propertyAccessor->getValue($object, $attribute);
16✔
751

752
                return $this->serializer->normalize($attributeValue, $format, $childContext);
16✔
753
            }
754

755
            if ('array' === $type->getBuiltinType()) {
48✔
756
                $childContext = $this->createChildContext($context, $attribute, $format);
20✔
757
                $childContext['output']['gen_id'] = $propertyMetadata->getGenId() ?? true;
20✔
758

759
                $attributeValue = $this->propertyAccessor->getValue($object, $attribute);
20✔
760

761
                return $this->serializer->normalize($attributeValue, $format, $childContext);
20✔
762
            }
763
        }
764

765
        if (!$this->serializer instanceof NormalizerInterface) {
60✔
766
            throw new LogicException(sprintf('The injected serializer must be an instance of "%s".', NormalizerInterface::class));
×
767
        }
768

769
        unset($context['resource_class']);
60✔
770
        unset($context['force_resource_class']);
60✔
771

772
        $attributeValue = $this->propertyAccessor->getValue($object, $attribute);
60✔
773

774
        return $this->serializer->normalize($attributeValue, $format, $context);
56✔
775
    }
776

777
    /**
778
     * Normalizes a collection of relations (to-many).
779
     *
780
     * @throws UnexpectedValueException
781
     */
782
    protected function normalizeCollectionOfRelations(ApiProperty $propertyMetadata, iterable $attributeValue, string $resourceClass, ?string $format, array $context): array
783
    {
784
        $value = [];
16✔
785
        foreach ($attributeValue as $index => $obj) {
16✔
786
            if (!\is_object($obj) && null !== $obj) {
×
787
                throw new UnexpectedValueException('Unexpected non-object element in to-many relation.');
×
788
            }
789

790
            // update context, if concrete object class deviates from general relation class (e.g. in case of polymorphic resources)
791
            $objResourceClass = $this->resourceClassResolver->getResourceClass($obj, $resourceClass);
×
792
            $context['resource_class'] = $objResourceClass;
×
793
            if ($this->resourceMetadataCollectionFactory) {
×
794
                $context['operation'] = $this->resourceMetadataCollectionFactory->create($objResourceClass)->getOperation();
×
795
            }
796

797
            $value[$index] = $this->normalizeRelation($propertyMetadata, $obj, $resourceClass, $format, $context);
×
798
        }
799

800
        return $value;
16✔
801
    }
802

803
    /**
804
     * Normalizes a relation.
805
     *
806
     * @throws LogicException
807
     * @throws UnexpectedValueException
808
     */
809
    protected function normalizeRelation(ApiProperty $propertyMetadata, ?object $relatedObject, string $resourceClass, ?string $format, array $context): \ArrayObject|array|string|null
810
    {
811
        if (null === $relatedObject || !empty($context['attributes']) || $propertyMetadata->isReadableLink()) {
24✔
812
            if (!$this->serializer instanceof NormalizerInterface) {
16✔
813
                throw new LogicException(sprintf('The injected serializer must be an instance of "%s".', NormalizerInterface::class));
×
814
            }
815

816
            $relatedContext = $this->createOperationContext($context, $resourceClass);
16✔
817
            $normalizedRelatedObject = $this->serializer->normalize($relatedObject, $format, $relatedContext);
16✔
818
            if (!\is_string($normalizedRelatedObject) && !\is_array($normalizedRelatedObject) && !$normalizedRelatedObject instanceof \ArrayObject && null !== $normalizedRelatedObject) {
16✔
819
                throw new UnexpectedValueException('Expected normalized relation to be an IRI, array, \ArrayObject or null');
×
820
            }
821

822
            return $normalizedRelatedObject;
16✔
823
        }
824

825
        $context['iri'] = $iri = $this->iriConverter->getIriFromResource(resource: $relatedObject, context: $context);
8✔
826
        $context['data'] = $iri;
8✔
827
        $context['object'] = $relatedObject;
8✔
828
        unset($context['property_metadata']);
8✔
829
        unset($context['api_attribute']);
8✔
830

831
        if ($this->tagCollector) {
8✔
NEW
832
            $this->tagCollector->collect($context);
×
833
        } elseif (isset($context['resources'])) {
8✔
UNCOV
834
            $context['resources'][$iri] = $iri;
×
835
        }
836

837
        $push = $propertyMetadata->getPush() ?? false;
8✔
838
        if (isset($context['resources_to_push']) && $push) {
8✔
839
            $context['resources_to_push'][$iri] = $iri;
×
840
        }
841

842
        return $iri;
8✔
843
    }
844

845
    private function createAttributeValue(string $attribute, mixed $value, string $format = null, array &$context = []): mixed
846
    {
847
        try {
848
            return $this->createAndValidateAttributeValue($attribute, $value, $format, $context);
28✔
849
        } catch (NotNormalizableValueException $exception) {
12✔
850
            if (!isset($context['not_normalizable_value_exceptions'])) {
8✔
851
                throw $exception;
8✔
852
            }
853
            $context['not_normalizable_value_exceptions'][] = $exception;
×
854

855
            throw $exception;
×
856
        }
857
    }
858

859
    private function createAndValidateAttributeValue(string $attribute, mixed $value, string $format = null, array $context = []): mixed
860
    {
861
        $propertyMetadata = $this->propertyMetadataFactory->create($context['resource_class'], $attribute, $this->getFactoryOptions($context));
28✔
862
        $types = $propertyMetadata->getBuiltinTypes() ?? [];
28✔
863
        $isMultipleTypes = \count($types) > 1;
28✔
864

865
        foreach ($types as $type) {
28✔
866
            if (null === $value && ($type->isNullable() || ($context[static::DISABLE_TYPE_ENFORCEMENT] ?? false))) {
28✔
867
                return $value;
×
868
            }
869

870
            $collectionValueType = $type->getCollectionValueTypes()[0] ?? null;
28✔
871

872
            /* From @see AbstractObjectNormalizer::validateAndDenormalize() */
873
            // Fix a collection that contains the only one element
874
            // This is special to xml format only
875
            if ('xml' === $format && null !== $collectionValueType && (!\is_array($value) || !\is_int(key($value)))) {
28✔
876
                $value = [$value];
×
877
            }
878

879
            if (
880
                $type->isCollection()
28✔
881
                && null !== $collectionValueType
28✔
882
                && null !== ($className = $collectionValueType->getClassName())
28✔
883
                && $this->resourceClassResolver->isResourceClass($className)
28✔
884
            ) {
885
                $resourceClass = $this->resourceClassResolver->getResourceClass(null, $className);
12✔
886
                $context['resource_class'] = $resourceClass;
12✔
887

888
                return $this->denormalizeCollection($attribute, $propertyMetadata, $type, $resourceClass, $value, $format, $context);
12✔
889
            }
890

891
            if (
892
                null !== ($className = $type->getClassName())
20✔
893
                && $this->resourceClassResolver->isResourceClass($className)
20✔
894
            ) {
895
                $resourceClass = $this->resourceClassResolver->getResourceClass(null, $className);
8✔
896
                $childContext = $this->createChildContext($this->createOperationContext($context, $resourceClass), $attribute, $format);
8✔
897

898
                return $this->denormalizeRelation($attribute, $propertyMetadata, $resourceClass, $value, $format, $childContext);
8✔
899
            }
900

901
            if (
902
                $type->isCollection()
16✔
903
                && null !== $collectionValueType
16✔
904
                && null !== ($className = $collectionValueType->getClassName())
16✔
905
                && \is_array($value)
16✔
906
            ) {
907
                if (!$this->serializer instanceof DenormalizerInterface) {
×
908
                    throw new LogicException(sprintf('The injected serializer must be an instance of "%s".', DenormalizerInterface::class));
×
909
                }
910

911
                unset($context['resource_class']);
×
912

913
                return $this->serializer->denormalize($value, $className.'[]', $format, $context);
×
914
            }
915

916
            if (null !== $className = $type->getClassName()) {
16✔
917
                if (!$this->serializer instanceof DenormalizerInterface) {
×
918
                    throw new LogicException(sprintf('The injected serializer must be an instance of "%s".', DenormalizerInterface::class));
×
919
                }
920

921
                unset($context['resource_class']);
×
922

923
                return $this->serializer->denormalize($value, $className, $format, $context);
×
924
            }
925

926
            /* From @see AbstractObjectNormalizer::validateAndDenormalize() */
927
            // In XML and CSV all basic datatypes are represented as strings, it is e.g. not possible to determine,
928
            // if a value is meant to be a string, float, int or a boolean value from the serialized representation.
929
            // That's why we have to transform the values, if one of these non-string basic datatypes is expected.
930
            if (\is_string($value) && (XmlEncoder::FORMAT === $format || CsvEncoder::FORMAT === $format)) {
16✔
931
                if ('' === $value && $type->isNullable() && \in_array($type->getBuiltinType(), [Type::BUILTIN_TYPE_BOOL, Type::BUILTIN_TYPE_INT, Type::BUILTIN_TYPE_FLOAT], true)) {
×
932
                    return null;
×
933
                }
934

935
                switch ($type->getBuiltinType()) {
×
936
                    case Type::BUILTIN_TYPE_BOOL:
937
                        // according to http://www.w3.org/TR/xmlschema-2/#boolean, valid representations are "false", "true", "0" and "1"
938
                        if ('false' === $value || '0' === $value) {
×
939
                            $value = false;
×
940
                        } elseif ('true' === $value || '1' === $value) {
×
941
                            $value = true;
×
942
                        } else {
943
                            // union/intersect types: try the next type, if not valid, an exception will be thrown at the end
944
                            if ($isMultipleTypes) {
×
945
                                break 2;
×
946
                            }
947
                            throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('The type of the "%s" attribute for class "%s" must be bool ("%s" given).', $attribute, $className, $value), $value, [Type::BUILTIN_TYPE_BOOL], $context['deserialization_path'] ?? null);
×
948
                        }
949
                        break;
×
950
                    case Type::BUILTIN_TYPE_INT:
951
                        if (ctype_digit($value) || ('-' === $value[0] && ctype_digit(substr($value, 1)))) {
×
952
                            $value = (int) $value;
×
953
                        } else {
954
                            // union/intersect types: try the next type, if not valid, an exception will be thrown at the end
955
                            if ($isMultipleTypes) {
×
956
                                break 2;
×
957
                            }
958
                            throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('The type of the "%s" attribute for class "%s" must be int ("%s" given).', $attribute, $className, $value), $value, [Type::BUILTIN_TYPE_INT], $context['deserialization_path'] ?? null);
×
959
                        }
960
                        break;
×
961
                    case Type::BUILTIN_TYPE_FLOAT:
962
                        if (is_numeric($value)) {
×
963
                            return (float) $value;
×
964
                        }
965

966
                        switch ($value) {
967
                            case 'NaN':
×
968
                                return \NAN;
×
969
                            case 'INF':
×
970
                                return \INF;
×
971
                            case '-INF':
×
972
                                return -\INF;
×
973
                            default:
974
                                // union/intersect types: try the next type, if not valid, an exception will be thrown at the end
975
                                if ($isMultipleTypes) {
×
976
                                    break 3;
×
977
                                }
978
                                throw NotNormalizableValueException::createForUnexpectedDataType(sprintf('The type of the "%s" attribute for class "%s" must be float ("%s" given).', $attribute, $className, $value), $value, [Type::BUILTIN_TYPE_FLOAT], $context['deserialization_path'] ?? null);
×
979
                        }
980
                }
981
            }
982

983
            if ($context[static::DISABLE_TYPE_ENFORCEMENT] ?? false) {
16✔
984
                return $value;
×
985
            }
986

987
            try {
988
                $this->validateType($attribute, $type, $value, $format, $context);
16✔
989

990
                break;
16✔
991
            } catch (NotNormalizableValueException $e) {
×
992
                // union/intersect types: try the next type
993
                if (!$isMultipleTypes) {
×
994
                    throw $e;
×
995
                }
996
            }
997
        }
998

999
        return $value;
16✔
1000
    }
1001

1002
    /**
1003
     * Sets a value of the object using the PropertyAccess component.
1004
     */
1005
    private function setValue(object $object, string $attributeName, mixed $value): void
1006
    {
1007
        try {
1008
            $this->propertyAccessor->setValue($object, $attributeName, $value);
16✔
1009
        } catch (NoSuchPropertyException) {
4✔
1010
            // Properties not found are ignored
1011
        }
1012
    }
1013
}
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