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

api-platform / core / 15133993414

20 May 2025 09:30AM UTC coverage: 26.313% (-1.2%) from 27.493%
15133993414

Pull #7161

github

web-flow
Merge e2c03d45f into 5459ba375
Pull Request #7161: fix(metadata): infer parameter string type from schema

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

11019 existing lines in 363 files now uncovered.

12898 of 49018 relevant lines covered (26.31%)

34.33 hits per line

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

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

16
use ApiPlatform\Documentation\Entrypoint;
17
use ApiPlatform\Metadata\Get;
18
use ApiPlatform\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface;
19
use ApiPlatform\Metadata\Resource\ResourceNameCollection;
20
use ApiPlatform\OpenApi\Serializer\LegacyOpenApiNormalizer;
21
use ApiPlatform\State\ProcessorInterface;
22
use ApiPlatform\State\ProviderInterface;
23
use Symfony\Component\HttpFoundation\Request;
24

25
/**
26
 * Generates the API entrypoint.
27
 *
28
 * @author Kévin Dunglas <dunglas@gmail.com>
29
 */
30
final class EntrypointAction
31
{
32
    private static ResourceNameCollection $resourceNameCollection;
33

34
    public function __construct(
35
        private readonly ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory,
36
        private readonly ProviderInterface $provider,
37
        private readonly ProcessorInterface $processor,
38
        private readonly array $documentationFormats = [],
39
    ) {
UNCOV
40
    }
16✔
41

42
    public function __invoke(Request $request)
43
    {
UNCOV
44
        static::$resourceNameCollection = $this->resourceNameCollectionFactory->create();
16✔
UNCOV
45
        $context = [
16✔
UNCOV
46
            'request' => $request,
16✔
UNCOV
47
            'spec_version' => (string) $request->query->get(LegacyOpenApiNormalizer::SPEC_VERSION),
16✔
UNCOV
48
        ];
16✔
UNCOV
49
        $request->attributes->set('_api_platform_disable_listeners', true);
16✔
UNCOV
50
        $operation = new Get(
16✔
UNCOV
51
            outputFormats: $this->documentationFormats,
16✔
UNCOV
52
            read: true,
16✔
UNCOV
53
            serialize: true,
16✔
UNCOV
54
            class: Entrypoint::class,
16✔
UNCOV
55
            provider: [self::class, 'provide']
16✔
UNCOV
56
        );
16✔
UNCOV
57
        $request->attributes->set('_api_operation', $operation);
16✔
UNCOV
58
        $body = $this->provider->provide($operation, [], $context);
16✔
UNCOV
59
        $operation = $request->attributes->get('_api_operation');
16✔
60

UNCOV
61
        return $this->processor->process($body, $operation, [], $context);
16✔
62
    }
63

64
    public static function provide(): Entrypoint
65
    {
UNCOV
66
        return new Entrypoint(static::$resourceNameCollection);
11✔
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

© 2025 Coveralls, Inc