Skip to content

Embedded objects on DTO aren't documented since 2.6.0 #4009

Description

@RobinHoutevelts

API Platform version(s) affected: >=2.6.0

Description
In 2.5.10 this DTO resulted in the following documentation output:

namespace App\ApiPlatform\Entity\Venue;

class Venue
{
    /**
     * The title of the venue.
     *
     * @Groups({"venue:read", "venue:write"})
     * @Assert\NotBlank()
     * @var string
     */
    public string $title;

    /**
     * The alternative name of the venue.
     *
     * @Groups({"venue:read", "venue:write"})
     */
    public ?string $alternativeName;

    /**
     * The contact information of the venue.
     *
     * @Groups({"venue:read", "venue:write"})
     * @Assert\Valid()
     */
    public Contact $contact;
}

class Contact
{
    /**
     * The website.
     *
     * @Groups({"venue:read", "venue:write"})
     * @Assert\Url()
     */
    public ?string $website;

    /**
     * The email address.
     *
     * @Groups({"venue:read", "venue:write"})
     * @Assert\Email()
     */
    public ?string $email;
}
ApiResource class Venue:
<?php

use App\ApiPlatform\Entity\Venue\Venue as VenueDto;

/**
 * @ApiResource(
 *     output=VenueDto::CLASS,
 *     input=VenueDto::CLASS,
 *     normalizationContext={"groups"={"venue:read"}},
 *     denormalizationContext={"groups"={"venue:write"}},
 *     collectionOperations={
 *         "get"={
 *              "normalization_context"={"groups"={"venue:collection:read"}}
 *         },
 *         "post"={
 *              "denormalization_context"={"groups"={"venue:write"}}
 *         }
 *     },
 *     itemOperations={"get", "put", "delete"}
 * )
 * @ORM\Entity(repositoryClass=VenueRepository::class)
 */
class Venue
{
    ...
}

19-42-17--cKO7D

But since >=2.6.0 it no longer documents the embedded Contact class:

19-25-19--aqZKP

How to reproduce

https://github.com/RobinHoutevelts/apipf_regression_dto_embedded_object

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions