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

api-platform / core / 20895290858

11 Jan 2026 12:40PM UTC coverage: 25.25% (-3.6%) from 28.875%
20895290858

Pull #7667

github

VincentLanglet
Fix
Pull Request #7667: POC NameConverterAwareInterface

0 of 22 new or added lines in 7 files covered. (0.0%)

14884 existing lines in 487 files now uncovered.

14719 of 58293 relevant lines covered (25.25%)

30.74 hits per line

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

100.0
/src/Symfony/EventListener/JsonStreamerDeserializeListener.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\Symfony\EventListener;
15

16
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
17
use ApiPlatform\State\ProviderInterface;
18
use ApiPlatform\State\Util\OperationRequestInitiatorTrait;
19
use ApiPlatform\State\Util\RequestAttributesExtractor;
20
use Symfony\Component\HttpKernel\Event\RequestEvent;
21

22
/**
23
 * Deserializes the data sent in the requested format using JSON Streamer.
24
 *
25
 * @author Kévin Dunglas <dunglas@gmail.com>
26
 */
27
final class JsonStreamerDeserializeListener
28
{
29
    use OperationRequestInitiatorTrait;
30

31
    /**
32
     * @param ProviderInterface<object> $jsonStreamerProvider
33
     */
34
    public function __construct(
35
        private ProviderInterface $jsonStreamerProvider,
36
        private readonly string $format,
37
        ?ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null,
38
    ) {
UNCOV
39
        $this->resourceMetadataCollectionFactory = $resourceMetadataFactory;
394✔
40
    }
41

42
    /**
43
     * Deserializes the data sent in the requested format.
44
     */
45
    public function onKernelRequest(RequestEvent $event): void
46
    {
UNCOV
47
        $request = $event->getRequest();
394✔
UNCOV
48
        $operation = $this->initializeOperation($request);
394✔
49

50
        if (
UNCOV
51
            !($attributes = RequestAttributesExtractor::extractAttributes($request))
394✔
UNCOV
52
            || !$attributes['receive']
394✔
UNCOV
53
            || !$operation
394✔
UNCOV
54
            || !$operation->getJsonStream()
394✔
UNCOV
55
            || $this->format !== $request->attributes->get('input_format')
394✔
56
        ) {
UNCOV
57
            return;
394✔
58
        }
59

UNCOV
60
        $data = $this->jsonStreamerProvider->provide($operation, $request->attributes->get('_api_uri_variables') ?? [], [
2✔
UNCOV
61
            'request' => $request,
2✔
UNCOV
62
            'uri_variables' => $request->attributes->get('_api_uri_variables') ?? [],
2✔
UNCOV
63
            'resource_class' => $operation->getClass(),
2✔
UNCOV
64
        ]);
2✔
65

UNCOV
66
        $request->attributes->set('data', $data);
2✔
67
    }
68
}
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

© 2026 Coveralls, Inc