You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When I generate openapi documentation (using the api:openapi:export command) the output response has been updated from 3.1 version. A nested resource doesn't have its jsonld properties (as @id)
How to reproduce
category class
<?php
namespace App\Catalog\Infrastructure\ApiPlatform\Resource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use Symfony\Component\Serializer\Annotation\Groups;
#[Get(uriTemplate: '/categories/{id}', uriVariables: ['id'])]
#[GetCollection(uriTemplate: '/categories')]
class Category
{
public function __construct(
#[Groups(['get'])]
private readonly string $name,
)
{
}
public function getName(): string
{
return $this->name;
}
}
Product class
<?php
namespace App\Catalog\Infrastructure\ApiPlatform\Resource;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use App\Catalog\Infrastructure\ApiPlatform\Provider\GetProductCollectionProvider;
use App\Catalog\Infrastructure\ApiPlatform\Provider\GetProductItemProvider;
use Symfony\Component\Serializer\Annotation\Groups;
#[Get(
uriTemplate: '/products/{sku}',
uriVariables: ['sku'],
normalizationContext: ['groups' => ['get']],
provider: GetProductItemProvider::class
)]
class Product
{
public function __construct(
#[ApiProperty(identifier: true)]
#[Groups(['get'])]
public readonly string $sku,
#[Groups(['get'])]
public readonly string $title,
#[Groups(['get'])]
public readonly Category $category,
)
{
}
}
the openapi json contains an entry Category.jsonld with @id, @type and @context and an entry Category.jsonld-get without. The product has a property
API Platform version(s) affected: 3.2.x
Description
When I generate openapi documentation (using the
api:openapi:export
command) the output response has been updated from 3.1 version. A nested resource doesn't have its jsonld properties (as@id
)How to reproduce
category class
Product class
the openapi json contains an entry
Category.jsonld
with@id
,@type
and@context
and an entryCategory.jsonld-get
without. The product has a propertyBefore 3.2,
Category.jsonld-get
had@id
,@type
and@context
attributesThank you for your help
The text was updated successfully, but these errors were encountered: