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

api-platform / core / 19862662656

02 Dec 2025 02:47PM UTC coverage: 25.22% (+0.002%) from 25.218%
19862662656

push

github

web-flow
fix(symfony): skip argument resolver when context is not api platform (#7579)

fixes #7574

3 of 3 new or added lines in 1 file covered. (100.0%)

422 existing lines in 19 files now uncovered.

14571 of 57775 relevant lines covered (25.22%)

28.49 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;
367✔
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();
367✔
UNCOV
48
        $operation = $this->initializeOperation($request);
367✔
49

50
        if (
UNCOV
51
            !($attributes = RequestAttributesExtractor::extractAttributes($request))
367✔
UNCOV
52
            || !$attributes['receive']
367✔
UNCOV
53
            || !$operation
367✔
UNCOV
54
            || !$operation->getJsonStream()
367✔
UNCOV
55
            || $this->format !== $request->attributes->get('input_format')
367✔
56
        ) {
UNCOV
57
            return;
367✔
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