Skip to content

Commit 215fe89

Browse files
Create non-regression test
1 parent b4a2cfd commit 215fe89

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

features/swagger/docs.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,4 @@ Feature: Documentation support
110110
And the response should be in JSON
111111
And the header "Content-Type" should be equal to "application/json; charset=utf-8"
112112
And the JSON node "basePath" should be equal to "/"
113+
And the JSON node "foo" should be equal to "bar"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
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\Core\Tests\Fixtures\TestBundle\Serializer\Normalizer;
15+
16+
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
17+
18+
/**
19+
* @author Vincent Chalamon <[email protected]>
20+
*/
21+
final class OverrideDocumentationNormalizer implements NormalizerInterface
22+
{
23+
private $documentationNormalizer;
24+
25+
public function __construct(NormalizerInterface $documentationNormalizer)
26+
{
27+
$this->documentationNormalizer = $documentationNormalizer;
28+
}
29+
30+
public function normalize($object, $format = null, array $context = [])
31+
{
32+
$data = $this->documentationNormalizer->normalize($object, $format, $context);
33+
$data['foo'] = 'bar';
34+
35+
return $data;
36+
}
37+
38+
public function supportsNormalization($data, $format = null)
39+
{
40+
return $this->documentationNormalizer->supportsNormalization($data, $format);
41+
}
42+
}

tests/Fixtures/app/config/config_common.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,9 @@ services:
197197

198198
mercure.hub.default.publisher:
199199
class: ApiPlatform\Core\Tests\Fixtures\DummyMercurePublisher
200+
201+
app.serializer.normalizer.override_documentation:
202+
class: ApiPlatform\Core\Tests\Fixtures\TestBundle\Serializer\Normalizer\OverrideDocumentationNormalizer
203+
decorates: api_platform.swagger.normalizer.documentation
204+
public: false
205+
arguments: ['@app.serializer.normalizer.override_documentation.inner']

0 commit comments

Comments
 (0)