Skip to content

Enum handling in serialization changed in 4.2.17 #7785

@kralmichal

Description

@kralmichal

API Platform version(s) affected: 4.2.17

Description
When uprading from 4.2.16 Enum is no longer serialzed th same. See $locale

enum Locale: string
{
    case CS = 'cs';
    case EN = 'en';
}

#[Groups(['user:read', 'api:read', 'log:context']), ]
final readonly class UserSummaryView
{
    /**
     * @param (value-of<UserRole>)[] $roles
     */
    public function __construct(
        public UuidInterface $id,
        public string $name,
        public Locale $locale,
    ) {
    }
}

4.2.16

{
    "@context": "\/api\/contexts\/UserSummaryView",
    "@id": "\/api\/v1\/users\/me",
    "@type": "UserSummaryView",
    "id": "019bf62e-9883-70ae-b4e4-b75a7a568ea5",
    "name": "michal3",
    "locale": "cs",
}

4.2.17

{
    "@context": "\/api\/contexts\/UserSummaryView",
    "@id": "\/api\/v1\/users\/me",
    "@type": "UserSummaryView",
    "id": "019bf62e-9883-70ae-b4e4-b75a7a568ea5",
    "name": "michal3",
    "locale": {
        "@type": "Locale",
        "@id": "\/api\/.well-known\/genid\/b5b354de979217933bf9"
    },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions