Skip to content

Commit

Permalink
Rename to TypeDescriber
Browse files Browse the repository at this point in the history
  • Loading branch information
DjordyKoert committed Oct 18, 2024
1 parent 54599b8 commit c99d116
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 70 deletions.
26 changes: 13 additions & 13 deletions config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,57 +163,57 @@
</service>

<!-- Experimental schema describers (symfony/type-info) -->
<service id="nelmio_api_doc.schema_describer.chain" class="Nelmio\ApiDocBundle\SchemaDescriber\ChainDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.chain" class="Nelmio\ApiDocBundle\TypeDescriber\ChainDescriber" public="false">
<argument type="tagged" tag="nelmio_api_doc.schema_describer" />

<tag name="nelmio_api_doc.schema_describer" priority="100" />
</service>

<service id="nelmio_api_doc.schema_describer.bool" class="Nelmio\ApiDocBundle\SchemaDescriber\BoolDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.bool" class="Nelmio\ApiDocBundle\TypeDescriber\BoolDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>

<service id="nelmio_api_doc.schema_describer.dictionary" class="Nelmio\ApiDocBundle\SchemaDescriber\DictionaryDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.dictionary" class="Nelmio\ApiDocBundle\TypeDescriber\DictionaryDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>

<service id="nelmio_api_doc.schema_describer.float" class="Nelmio\ApiDocBundle\SchemaDescriber\FloatDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.float" class="Nelmio\ApiDocBundle\TypeDescriber\FloatDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>

<service id="nelmio_api_doc.schema_describer.integer" class="Nelmio\ApiDocBundle\SchemaDescriber\IntegerDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.integer" class="Nelmio\ApiDocBundle\TypeDescriber\IntegerDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>

<service id="nelmio_api_doc.schema_describer.intersection" class="Nelmio\ApiDocBundle\SchemaDescriber\IntersectionDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.intersection" class="Nelmio\ApiDocBundle\TypeDescriber\IntersectionDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>

<service id="nelmio_api_doc.schema_describer.list" class="Nelmio\ApiDocBundle\SchemaDescriber\ListDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.list" class="Nelmio\ApiDocBundle\TypeDescriber\ListDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>

<service id="nelmio_api_doc.schema_describer.mixed" class="Nelmio\ApiDocBundle\SchemaDescriber\MixedDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.mixed" class="Nelmio\ApiDocBundle\TypeDescriber\MixedDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>

<service id="nelmio_api_doc.schema_describer.nullable" class="Nelmio\ApiDocBundle\SchemaDescriber\NullableDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.nullable" class="Nelmio\ApiDocBundle\TypeDescriber\NullableDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>

<service id="nelmio_api_doc.schema_describer.object_class" class="Nelmio\ApiDocBundle\SchemaDescriber\ObjectClassDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.object_class" class="Nelmio\ApiDocBundle\TypeDescriber\ObjectClassDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>

<service id="nelmio_api_doc.schema_describer.object" class="Nelmio\ApiDocBundle\SchemaDescriber\ObjectDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.object" class="Nelmio\ApiDocBundle\TypeDescriber\ObjectDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>

<service id="nelmio_api_doc.schema_describer.string" class="Nelmio\ApiDocBundle\SchemaDescriber\StringDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.string" class="Nelmio\ApiDocBundle\TypeDescriber\StringDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>

<service id="nelmio_api_doc.schema_describer.union" class="Nelmio\ApiDocBundle\SchemaDescriber\UnionDescriber" public="false">
<service id="nelmio_api_doc.schema_describer.union" class="Nelmio\ApiDocBundle\TypeDescriber\UnionDescriber" public="false">
<tag name="nelmio_api_doc.schema_describer" />
</service>
</services>
Expand Down
14 changes: 7 additions & 7 deletions src/ModelDescriber/ObjectModelDescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Nelmio\ApiDocBundle\ModelDescriber\Annotations\AnnotationsReader;
use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use Nelmio\ApiDocBundle\PropertyDescriber\PropertyDescriberInterface;
use Nelmio\ApiDocBundle\SchemaDescriber\SchemaDescriberInterface;
use Nelmio\ApiDocBundle\TypeDescriber\TypeDescriberInterface;
use OpenApi\Annotations as OA;
use OpenApi\Generator;
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
Expand All @@ -35,7 +35,7 @@ class ObjectModelDescriber implements ModelDescriberInterface, ModelRegistryAwar
private PropertyInfoExtractorInterface $propertyInfo;
private ?ClassMetadataFactoryInterface $classMetadataFactory;
private ?Reader $doctrineReader;
/** @var PropertyDescriberInterface|PropertyDescriberInterface[]|SchemaDescriberInterface */
/** @var PropertyDescriberInterface|PropertyDescriberInterface[]|TypeDescriberInterface */
private $propertyDescriber;
/** @var string[] */
private array $mediaTypes;
Expand All @@ -44,9 +44,9 @@ class ObjectModelDescriber implements ModelDescriberInterface, ModelRegistryAwar
private bool $useValidationGroups;

/**
* @param PropertyDescriberInterface|PropertyDescriberInterface[]|SchemaDescriberInterface $propertyDescribers
* @param (NameConverterInterface&AdvancedNameConverterInterface)|null $nameConverter
* @param string[] $mediaTypes
* @param PropertyDescriberInterface|PropertyDescriberInterface[]|TypeDescriberInterface $propertyDescribers
* @param (NameConverterInterface&AdvancedNameConverterInterface)|null $nameConverter
* @param string[] $mediaTypes
*/
public function __construct(
PropertyInfoExtractorInterface $propertyInfo,
Expand All @@ -60,7 +60,7 @@ public function __construct(
if (is_iterable($propertyDescribers)) {
trigger_deprecation('nelmio/api-doc-bundle', '4.17', 'Passing an array of PropertyDescriberInterface to %s() is deprecated. Pass a single PropertyDescriberInterface instead.', __METHOD__);
} else {
if (!$propertyDescribers instanceof PropertyDescriberInterface && !$propertyDescribers instanceof SchemaDescriberInterface) {
if (!$propertyDescribers instanceof PropertyDescriberInterface && !$propertyDescribers instanceof TypeDescriberInterface) {
throw new \InvalidArgumentException(sprintf('Argument 3 passed to %s() must be an array of %s or a single %s.', __METHOD__, PropertyDescriberInterface::class, PropertyDescriberInterface::class));
}
}
Expand Down Expand Up @@ -179,7 +179,7 @@ public function describe(Model $model, OA\Schema $schema)
/*
* @experimental
*/
if ($this->propertyDescriber instanceof SchemaDescriberInterface) {
if ($this->propertyDescriber instanceof TypeDescriberInterface) {
if (false === method_exists($this->propertyInfo, 'getType')) {
throw new \RuntimeException('The PropertyInfo component is missing the "getType" method. Are you running on version 7.1?');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\SchemaDescriber;
namespace Nelmio\ApiDocBundle\TypeDescriber;

use OpenApi\Annotations\Schema;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
* @implements SchemaDescriberInterface<Type\BuiltinType>
* @implements TypeDescriberInterface<Type\BuiltinType>
*
* @experimental
*/
final class BoolDescriber implements SchemaDescriberInterface
final class BoolDescriber implements TypeDescriberInterface
{
public function describe(Type $type, Schema $schema, array $context = []): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\SchemaDescriber;
namespace Nelmio\ApiDocBundle\TypeDescriber;

use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareInterface;
use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareTrait;
use OpenApi\Annotations\Schema;
use Symfony\Component\TypeInfo\Type;

/**
* @implements SchemaDescriberInterface<Type>
* @implements TypeDescriberInterface<Type>
*
* @experimental
*/
final class ChainDescriber implements SchemaDescriberInterface, ModelRegistryAwareInterface
final class ChainDescriber implements TypeDescriberInterface, ModelRegistryAwareInterface
{
use ModelRegistryAwareTrait;

/** @var iterable<SchemaDescriberInterface> */
/** @var iterable<TypeDescriberInterface> */
private iterable $describers;

/**
* @param iterable<SchemaDescriberInterface> $describers
* @param iterable<TypeDescriberInterface> $describers
*/
public function __construct(
iterable $describers
Expand All @@ -49,7 +49,7 @@ public function describe(Type $type, Schema $schema, array $context = []): void
$describer->setModelRegistry($this->modelRegistry);
}

if ($describer instanceof SchemaDescriberAwareInterface) {
if ($describer instanceof TypeDescriberAwareInterface) {
$describer->setDescriber($this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\SchemaDescriber;
namespace Nelmio\ApiDocBundle\TypeDescriber;

use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use OpenApi\Annotations as OA;
Expand All @@ -19,11 +19,11 @@
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
* @implements SchemaDescriberInterface<CollectionType>
* @implements TypeDescriberInterface<CollectionType>
*
* @experimental
*/
final class DictionaryDescriber implements SchemaDescriberInterface, SchemaDescriberAwareInterface
final class DictionaryDescriber implements TypeDescriberInterface, TypeDescriberAwareInterface
{
use SchemaDescriberAwareTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\SchemaDescriber;
namespace Nelmio\ApiDocBundle\TypeDescriber;

use OpenApi\Annotations\Schema;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
* @implements SchemaDescriberInterface<Type\BuiltinType>
* @implements TypeDescriberInterface<Type\BuiltinType>
*
* @experimental
*/
final class FloatDescriber implements SchemaDescriberInterface
final class FloatDescriber implements TypeDescriberInterface
{
public function describe(Type $type, Schema $schema, array $context = []): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\SchemaDescriber;
namespace Nelmio\ApiDocBundle\TypeDescriber;

use OpenApi\Annotations\Schema;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
* @implements SchemaDescriberInterface<Type\BuiltinType>
* @implements TypeDescriberInterface<Type\BuiltinType>
*
* @experimental
*/
final class IntegerDescriber implements SchemaDescriberInterface
final class IntegerDescriber implements TypeDescriberInterface
{
public function describe(Type $type, Schema $schema, array $context = []): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\SchemaDescriber;
namespace Nelmio\ApiDocBundle\TypeDescriber;

use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use OpenApi\Annotations\Schema;
Expand All @@ -19,11 +19,11 @@
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
* @implements SchemaDescriberInterface<IntersectionType>
* @implements TypeDescriberInterface<IntersectionType>
*
* @experimental
*/
final class IntersectionDescriber implements SchemaDescriberInterface, SchemaDescriberAwareInterface
final class IntersectionDescriber implements TypeDescriberInterface, TypeDescriberAwareInterface
{
use SchemaDescriberAwareTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\SchemaDescriber;
namespace Nelmio\ApiDocBundle\TypeDescriber;

use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use OpenApi\Annotations as OA;
Expand All @@ -19,11 +19,11 @@
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
* @implements SchemaDescriberInterface<CollectionType>
* @implements TypeDescriberInterface<CollectionType>
*
* @experimental
*/
final class ListDescriber implements SchemaDescriberInterface, SchemaDescriberAwareInterface
final class ListDescriber implements TypeDescriberInterface, TypeDescriberAwareInterface
{
use SchemaDescriberAwareTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\SchemaDescriber;
namespace Nelmio\ApiDocBundle\TypeDescriber;

use OpenApi\Annotations\Schema;
use OpenApi\Generator;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
* @implements SchemaDescriberInterface<Type\BuiltinType>
* @implements TypeDescriberInterface<Type\BuiltinType>
*
* @experimental
*/
final class MixedDescriber implements SchemaDescriberInterface
final class MixedDescriber implements TypeDescriberInterface
{
public function describe(Type $type, Schema $schema, array $context = []): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\SchemaDescriber;
namespace Nelmio\ApiDocBundle\TypeDescriber;

use OpenApi\Annotations\Schema;
use Symfony\Component\TypeInfo\Type;

/**
* @implements SchemaDescriberInterface<Type>
* @implements TypeDescriberInterface<Type>
*
* @experimental
*/
final class NullableDescriber implements SchemaDescriberInterface, SchemaDescriberAwareInterface
final class NullableDescriber implements TypeDescriberInterface, TypeDescriberAwareInterface
{
use SchemaDescriberAwareTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\SchemaDescriber;
namespace Nelmio\ApiDocBundle\TypeDescriber;

use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareInterface;
use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareTrait;
Expand All @@ -22,11 +22,11 @@
use Symfony\Component\Uid\AbstractUid;

/**
* @implements SchemaDescriberInterface<ObjectType>
* @implements TypeDescriberInterface<ObjectType>
*
* @experimental
*/
final class ObjectClassDescriber implements SchemaDescriberInterface, ModelRegistryAwareInterface
final class ObjectClassDescriber implements TypeDescriberInterface, ModelRegistryAwareInterface
{
use ModelRegistryAwareTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\SchemaDescriber;
namespace Nelmio\ApiDocBundle\TypeDescriber;

use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareInterface;
use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareTrait;
Expand All @@ -19,11 +19,11 @@
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
* @implements SchemaDescriberInterface<BuiltinType>
* @implements TypeDescriberInterface<BuiltinType>
*
* @experimental
*/
final class ObjectDescriber implements SchemaDescriberInterface, ModelRegistryAwareInterface
final class ObjectDescriber implements TypeDescriberInterface, ModelRegistryAwareInterface
{
use ModelRegistryAwareTrait;

Expand Down
Loading

0 comments on commit c99d116

Please sign in to comment.