-
-
Notifications
You must be signed in to change notification settings - Fork 868
Open
Labels
stalestale issue/PRstale issue/PR
Description
Currently, there is support for Backed Enum in Entity that is creating component and referencing it in in open api specification.
But when adding EnumType in symfony form, it's specified as simple enum and not a reusable component, same as ChoiceType, and this is creating a lot of duplicate enum types when generating api clients, one per each form where it's used.
I guess the update should be happening here (but i'm not sure).
Current State:
Enum:
enum ExampleEnum: string
{
case ONE = 'one';
case TWO = 'two';
case THREE = 'three';
}
Form:
->add('formField', EnumType::class, ['class' => ExampleEnum::class])
generated specs:
formField:
type: string
enum: ['one', 'two', 'three']
Requested state and wanted changes:
components:
schemas:
ExampleEnum:
type: string
enum:
- one
- two
- three
formField:
$ref: '#/components/schemas/ExampleEnum'
or if form field is array of enums (multiple = true
):
formField:
type: array
items:
$ref: '#/components/schemas/ExampleEnum'
Metadata
Metadata
Assignees
Labels
stalestale issue/PRstale issue/PR