Closed
Description
API Platform version(s) affected: 3.2.13
Description
It's not possible to overwrite the $ref
using the ApiProperty
within a DTO.
How to reproduce
Create two DTOs, both with groups (As it seems API Platform uses those to generate a default OpenAPI definition). Overwrite the OpenAPI definition for these DTOs as we don't want to use the default definition convention.
// Main DTO
final class AccountOutputDto implements ExampleAwareInterface
{
#[
SerializedName('2fa'),
ApiProperty(
// Works in API Platform 3.1 but not in 3.2
openapiContext: ['$ref' => '#/components/schemas/Account.TwoFactorAuthenticationDto'],
),
Groups([AccountGroupEnum::V1_ACCOUNT_READ, AccountGroupEnum::V2_ACCOUNT_READ]),
]
// Use the other DTO
private TwoFactorAuthenticationDto $twoFactorAuthentication;
#[
ApiProperty(
openapiContext: [
// Works as intended
'items' => ['$ref' => '#/components/schemas/Account.DeviceDto'],
]
),
Groups([AccountGroupEnum::V1_ACCOUNT_READ, AccountGroupEnum::V2_ACCOUNT_READ])
]
private array $devices;
}
Actual: #/components/schemas/TwoFactorAuthenticationDto-v2.account.read_v2.hypermedia.read_generic.api
Expected: #/components/schemas/Account.TwoFactorAuthenticationDto
Additional Context
The same exact snippet works in the previous version of API Platform (3.1).
Related to api-platform/api-platform#2634
Metadata
Metadata
Assignees
Labels
No labels