Skip to content

Commit

Permalink
Serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
laryjulien committed Nov 17, 2021
1 parent f0fa899 commit 402609e
Show file tree
Hide file tree
Showing 63 changed files with 118 additions and 98 deletions.
2 changes: 1 addition & 1 deletion src/Core/EventListener/ReadListener.php
Expand Up @@ -20,10 +20,10 @@
use ApiPlatform\Core\Identifier\IdentifierConverterInterface;
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface;
use ApiPlatform\Core\Metadata\Resource\ToggleableOperationAttributeTrait;
use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\Exception\InvalidIdentifierException;
use ApiPlatform\Exception\RuntimeException;
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\Symfony\EventListener\ReadListener as SymfonyReadListener;
use ApiPlatform\Util\CloneTrait;
use ApiPlatform\Util\OperationRequestInitiatorTrait;
Expand Down
2 changes: 1 addition & 1 deletion src/Core/JsonApi/Serializer/CollectionNormalizer.php
Expand Up @@ -15,8 +15,8 @@

use ApiPlatform\Core\Api\ResourceClassResolverInterface;
use ApiPlatform\Core\Metadata\Resource\ResourceMetadata;
use ApiPlatform\Core\Serializer\AbstractCollectionNormalizer;
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
use ApiPlatform\Serializer\AbstractCollectionNormalizer;
use ApiPlatform\Util\IriHelper;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;

Expand Down
6 changes: 3 additions & 3 deletions src/Core/JsonApi/Serializer/ItemNormalizer.php
Expand Up @@ -18,12 +18,12 @@
use ApiPlatform\Core\Metadata\Property\PropertyMetadata;
use ApiPlatform\Core\Metadata\Resource\ResourceMetadata;
use ApiPlatform\Core\Security\ResourceAccessCheckerInterface;
use ApiPlatform\Core\Serializer\AbstractItemNormalizer;
use ApiPlatform\Core\Serializer\CacheKeyTrait;
use ApiPlatform\Core\Serializer\ContextTrait;
use ApiPlatform\Exception\ItemNotFoundException;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
use ApiPlatform\Serializer\AbstractItemNormalizer;
use ApiPlatform\Serializer\CacheKeyTrait;
use ApiPlatform\Serializer\ContextTrait;
use ApiPlatform\Util\ClassInfoTrait;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\Type;
Expand Down
4 changes: 2 additions & 2 deletions src/Core/JsonLd/Serializer/ItemNormalizer.php
Expand Up @@ -22,8 +22,8 @@
use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface;
use ApiPlatform\Core\Security\ResourceAccessCheckerInterface;
use ApiPlatform\Core\Serializer\AbstractItemNormalizer;
use ApiPlatform\Core\Serializer\ContextTrait;
use ApiPlatform\Serializer\AbstractItemNormalizer;
use ApiPlatform\Serializer\ContextTrait;
use ApiPlatform\Util\ClassInfoTrait;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\Serializer\Exception\LogicException;
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Orm/Extension/EagerLoadingExtension.php
Expand Up @@ -17,7 +17,6 @@
use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
use ApiPlatform\Core\Metadata\Property\PropertyMetadata;
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface;
use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\Doctrine\Orm\Util\EagerLoadingTrait;
use ApiPlatform\Doctrine\Orm\Util\QueryBuilderHelper;
use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface;
Expand All @@ -28,6 +27,7 @@
use ApiPlatform\Exception\RuntimeException;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Query\Expr\Join;
Expand Down
2 changes: 1 addition & 1 deletion src/Elasticsearch/Serializer/ItemNormalizer.php
Expand Up @@ -21,7 +21,7 @@
use Symfony\Component\Serializer\SerializerInterface;

/**
* Item normalizer decorator that prevents {@see \ApiPlatform\Core\Serializer\ItemNormalizer}
* Item normalizer decorator that prevents {@see \ApiPlatform\Serializer\ItemNormalizer}
* from taking over for the {@see DocumentNormalizer::FORMAT} format because of priorities.
*
* @experimental
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQl/Serializer/ItemNormalizer.php
Expand Up @@ -20,8 +20,8 @@
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
use ApiPlatform\Core\Security\ResourceAccessCheckerInterface;
use ApiPlatform\Core\Serializer\ItemNormalizer as BaseItemNormalizer;
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Serializer\ItemNormalizer as BaseItemNormalizer;
use ApiPlatform\Util\ClassInfoTrait;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
Expand Down
2 changes: 1 addition & 1 deletion src/Hal/Serializer/CollectionNormalizer.php
Expand Up @@ -15,8 +15,8 @@

use ApiPlatform\Core\Api\ResourceClassResolverInterface;
use ApiPlatform\Core\Metadata\Resource\ResourceMetadata;
use ApiPlatform\Core\Serializer\AbstractCollectionNormalizer;
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
use ApiPlatform\Serializer\AbstractCollectionNormalizer;
use ApiPlatform\Util\IriHelper;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;

Expand Down
6 changes: 3 additions & 3 deletions src/Hal/Serializer/ItemNormalizer.php
Expand Up @@ -14,10 +14,10 @@
namespace ApiPlatform\Hal\Serializer;

use ApiPlatform\Core\Metadata\Property\PropertyMetadata;
use ApiPlatform\Core\Serializer\AbstractItemNormalizer;
use ApiPlatform\Core\Serializer\CacheKeyTrait;
use ApiPlatform\Core\Serializer\ContextTrait;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Serializer\AbstractItemNormalizer;
use ApiPlatform\Serializer\CacheKeyTrait;
use ApiPlatform\Serializer\ContextTrait;
use ApiPlatform\Util\ClassInfoTrait;
use Symfony\Component\PropertyInfo\Type;
use Symfony\Component\Serializer\Exception\LogicException;
Expand Down
2 changes: 1 addition & 1 deletion src/Hydra/Serializer/CollectionNormalizer.php
Expand Up @@ -20,7 +20,7 @@
use ApiPlatform\Core\Api\UrlGeneratorInterface;
use ApiPlatform\Core\JsonLd\ContextBuilderInterface;
use ApiPlatform\Core\JsonLd\Serializer\JsonLdContextTrait;
use ApiPlatform\Core\Serializer\ContextTrait;
use ApiPlatform\Serializer\ContextTrait;
use ApiPlatform\State\Pagination\PaginatorInterface;
use ApiPlatform\State\Pagination\PartialPaginatorInterface;
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Hydra/Serializer/ConstraintViolationListNormalizer.php
Expand Up @@ -14,7 +14,7 @@
namespace ApiPlatform\Hydra\Serializer;

use ApiPlatform\Core\Api\UrlGeneratorInterface;
use ApiPlatform\Core\Serializer\AbstractConstraintViolationListNormalizer;
use ApiPlatform\Serializer\AbstractConstraintViolationListNormalizer;
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;

/**
Expand Down
Expand Up @@ -13,7 +13,7 @@

namespace ApiPlatform\Problem\Serializer;

use ApiPlatform\Core\Serializer\AbstractConstraintViolationListNormalizer;
use ApiPlatform\Serializer\AbstractConstraintViolationListNormalizer;
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;

/**
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

use ApiPlatform\Core\Api\ResourceClassResolverInterface;
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface;
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

use ApiPlatform\Api\IriConverterInterface;
use ApiPlatform\Api\UrlGeneratorInterface;
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

trait CacheKeyTrait
{
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

/**
* Creates and manipulates the Serializer context.
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer\Filter;
namespace ApiPlatform\Serializer\Filter;

use ApiPlatform\Core\Api\FilterInterface as BaseFilterInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer\Filter;
namespace ApiPlatform\Serializer\Filter;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer\Filter;
namespace ApiPlatform\Serializer\Filter;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface;
use ApiPlatform\Exception\OperationNotFoundException;
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

use ApiPlatform\Api\IriConverterInterface;
use ApiPlatform\Api\UrlGeneratorInterface;
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

use Symfony\Component\Serializer\Encoder\DecoderInterface;
use Symfony\Component\Serializer\Encoder\EncoderInterface;
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer\Mapping\Factory;
namespace ApiPlatform\Serializer\Mapping\Factory;

use ApiPlatform\Util\ClassInfoTrait;
use Symfony\Component\Serializer\Mapping\ClassMetadataInterface;
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

/**
* @internal
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

use ApiPlatform\Core\Api\OperationType;
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface;
Expand Down
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

use ApiPlatform\Exception\RuntimeException;
use Symfony\Component\HttpFoundation\Request;
Expand Down
Expand Up @@ -11,12 +11,12 @@

declare(strict_types=1);

namespace ApiPlatform\Core\Serializer;
namespace ApiPlatform\Serializer;

use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface;
use ApiPlatform\Core\Serializer\Filter\FilterInterface;
use ApiPlatform\Exception\RuntimeException;
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Serializer\Filter\FilterInterface;
use ApiPlatform\Util\RequestAttributesExtractor;
use Psr\Container\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down
Expand Up @@ -13,8 +13,8 @@

namespace ApiPlatform\Symfony\Bundle\ArgumentResolver;

use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\Util\OperationRequestInitiatorTrait;
use ApiPlatform\Util\RequestAttributesExtractor;
use Symfony\Component\HttpFoundation\Request;
Expand Down
18 changes: 9 additions & 9 deletions src/Symfony/Bundle/Resources/config/api.xml
Expand Up @@ -93,29 +93,29 @@

<!-- Serializer -->

<service id="api_platform.serializer.context_builder" class="ApiPlatform\Core\Serializer\SerializerContextBuilder" public="false">
<service id="api_platform.serializer.context_builder" class="ApiPlatform\Serializer\SerializerContextBuilder" public="false">
<argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
</service>
<service id="ApiPlatform\Core\Serializer\SerializerContextBuilderInterface" alias="api_platform.serializer.context_builder" />
<service id="ApiPlatform\Serializer\SerializerContextBuilderInterface" alias="api_platform.serializer.context_builder" />

<service id="api_platform.serializer.context_builder.filter" class="ApiPlatform\Core\Serializer\SerializerFilterContextBuilder" decorates="api_platform.serializer.context_builder" public="false">
<service id="api_platform.serializer.context_builder.filter" class="ApiPlatform\Serializer\SerializerFilterContextBuilder" decorates="api_platform.serializer.context_builder" public="false">
<argument type="service" id="api_platform.metadata.resource.metadata_collection_factory" />
<argument type="service" id="api_platform.filter_locator" />
<argument type="service" id="api_platform.serializer.context_builder.filter.inner" />
</service>

<service id="api_platform.serializer.property_filter" class="ApiPlatform\Core\Serializer\Filter\PropertyFilter" public="false" abstract="true">
<service id="api_platform.serializer.property_filter" class="ApiPlatform\Serializer\Filter\PropertyFilter" public="false" abstract="true">
<argument key="$parameterName">properties</argument>
<argument key="$overrideDefaultProperties">false</argument>
<argument key="$whitelist">null</argument>
<argument key="$nameConverter" type="service" id="api_platform.name_converter" on-invalid="ignore" />
</service>
<service id="ApiPlatform\Core\Serializer\Filter\PropertyFilter" alias="api_platform.serializer.property_filter" />
<service id="ApiPlatform\Serializer\Filter\PropertyFilter" alias="api_platform.serializer.property_filter" />

<service id="api_platform.serializer.group_filter" class="ApiPlatform\Core\Serializer\Filter\GroupFilter" public="false" abstract="true" />
<service id="ApiPlatform\Core\Serializer\Filter\GroupFilter" alias="api_platform.serializer.group_filter" />
<service id="api_platform.serializer.group_filter" class="ApiPlatform\Serializer\Filter\GroupFilter" public="false" abstract="true" />
<service id="ApiPlatform\Serializer\Filter\GroupFilter" alias="api_platform.serializer.group_filter" />

<service id="api_platform.serializer.normalizer.item" class="ApiPlatform\Core\Serializer\ItemNormalizer" public="false">
<service id="api_platform.serializer.normalizer.item" class="ApiPlatform\Serializer\ItemNormalizer" public="false">
<argument type="service" id="api_platform.metadata.property.name_collection_factory" />
<argument type="service" id="api_platform.metadata.property.metadata_factory" />
<argument type="service" id="api_platform.iri_converter" />
Expand All @@ -135,7 +135,7 @@
<tag name="serializer.normalizer" priority="-895" />
</service>

<service id="api_platform.serializer.mapping.class_metadata_factory" class="ApiPlatform\Core\Serializer\Mapping\Factory\ClassMetadataFactory" decorates="serializer.mapping.class_metadata_factory" decoration-priority="-1" public="false">
<service id="api_platform.serializer.mapping.class_metadata_factory" class="ApiPlatform\Serializer\Mapping\Factory\ClassMetadataFactory" decorates="serializer.mapping.class_metadata_factory" decoration-priority="-1" public="false">
<argument type="service" id="api_platform.serializer.mapping.class_metadata_factory.inner" />
</service>

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/Resources/config/hal.xml
Expand Up @@ -5,7 +5,7 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="api_platform.hal.encoder" class="ApiPlatform\Core\Serializer\JsonEncoder" public="false">
<service id="api_platform.hal.encoder" class="ApiPlatform\Serializer\JsonEncoder" public="false">
<argument>jsonhal</argument>

<tag name="serializer.encoder" />
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/Resources/config/jsonapi.xml
Expand Up @@ -5,7 +5,7 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="api_platform.jsonapi.encoder" class="ApiPlatform\Core\Serializer\JsonEncoder" public="false">
<service id="api_platform.jsonapi.encoder" class="ApiPlatform\Serializer\JsonEncoder" public="false">
<argument>jsonapi</argument>

<tag name="serializer.encoder" />
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/Resources/config/jsonld.xml
Expand Up @@ -42,7 +42,7 @@
<tag name="serializer.normalizer" priority="-995" />
</service>

<service id="api_platform.jsonld.encoder" class="ApiPlatform\Core\Serializer\JsonEncoder" public="false">
<service id="api_platform.jsonld.encoder" class="ApiPlatform\Serializer\JsonEncoder" public="false">
<argument>jsonld</argument>

<tag name="serializer.encoder" />
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/Resources/config/problem.xml
Expand Up @@ -6,7 +6,7 @@

<services>
<!-- Serializer -->
<service id="api_platform.problem.encoder" class="ApiPlatform\Core\Serializer\JsonEncoder" public="false">
<service id="api_platform.problem.encoder" class="ApiPlatform\Serializer\JsonEncoder" public="false">
<argument>jsonproblem</argument>

<tag name="serializer.encoder" />
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/EventListener/DeserializeListener.php
Expand Up @@ -17,8 +17,8 @@
use ApiPlatform\Core\Api\FormatsProviderInterface;
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface;
use ApiPlatform\Core\Metadata\Resource\ToggleableOperationAttributeTrait;
use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\Util\OperationRequestInitiatorTrait;
use ApiPlatform\Util\RequestAttributesExtractor;
use Symfony\Component\HttpFoundation\Request;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/EventListener/ReadListener.php
Expand Up @@ -14,9 +14,9 @@
namespace ApiPlatform\Symfony\EventListener;

use ApiPlatform\Api\UriVariablesConverterInterface;
use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\Exception\InvalidIdentifierException;
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
use ApiPlatform\State\ProviderInterface;
use ApiPlatform\State\UriVariablesResolverTrait;
use ApiPlatform\Util\CloneTrait;
Expand Down

0 comments on commit 402609e

Please sign in to comment.