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

api-platform / core / 15250451308

26 May 2025 09:29AM UTC coverage: 26.388% (+0.008%) from 26.38%
15250451308

push

github

soyuka
fix(openapi): `example` and `default` with nullable value not being shown

0 of 3 new or added lines in 2 files covered. (0.0%)

11122 existing lines in 371 files now uncovered.

13009 of 49299 relevant lines covered (26.39%)

44.73 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
    }
24✔
41

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

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

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