-
-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pass serialization context to name converter (#2167)
* feat: pass serialization context to name converter * fix: cs * fix: ci php 7.3 failing * fix: ci php 7.3 failing * fix: ci, decorate name converter * fix: ci, decorate name converter * move NameConverter test logic to FunctionTest * fix baseline * remove unnecessary spaces
- Loading branch information
1 parent
9ff1d64
commit c55d9ef
Showing
12 changed files
with
140 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Nelmio\ApiDocBundle\Tests\Functional\Entity; | ||
|
||
class EntityThroughNameConverter | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Nelmio\ApiDocBundle\Tests\Functional\ModelDescriber; | ||
|
||
use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; | ||
use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter; | ||
|
||
class NameConverter implements AdvancedNameConverterInterface | ||
{ | ||
/** | ||
* @var MetadataAwareNameConverter | ||
*/ | ||
private $inner; | ||
|
||
public function __construct(MetadataAwareNameConverter $inner) | ||
{ | ||
$this->inner = $inner; | ||
} | ||
|
||
public function normalize(string $propertyName, string $class = null, string $format = null, array $context = []): string | ||
{ | ||
if (!isset($context['secret_name_converter_value'])) { | ||
return $this->inner->normalize($propertyName, $class, $format, $context); | ||
} | ||
|
||
return 'name_converter_context_'.$propertyName; | ||
} | ||
|
||
public function denormalize(string $propertyName, string $class = null, string $format = null, array $context = []): string | ||
{ | ||
throw new \RuntimeException('Was not expected to be called'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters