Skip to content

[Feature]: Expand enums automatically when passed to enum in Property attribute #2479

@riyadamr

Description

@riyadamr

Description

When passing an Enum class name (e.g., ColorEnum::class) as the enum parameter of Property attribute, the attribute could automatically expands the Enum into its possible values.

So instead of having :

#[OA\Property(
    enum: [
        ColorEnum::BLUE,
        ColorEnum::GREEN,
        ColorEnum::RED,
    ]
)]
public string $color;

We could have :

#[OA\Property(
    enum: ColorEnum:class
)]
public string $color;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions