Open gigo6000 opened 1 year ago
API Platform version(s) affected: 3.0
Description I'm using the Typescript Generator to generate some interfaces and I have some enum types in the Entity, for example:
<?php //Enum namespace App\Enum; enum Gender: string { case FEMALE = 'female'; case MALE = 'male'; }
<?php // Entity class Person { ... #[ORM\Column(type: "string", length: 6, nullable: true, enumType: Gender::class)] private $gender; ...
but when I generate the interfaces, they are generated as type any.
any
How to reproduce Create an entity with an enum type. Use the Typescript generator to generate the corresponding interface:
npm init @api-platform/client http://localhost/api src/ -- --generator typescript
The interface generated will be of type any instead of having the proper enum type:
export interface Person { ... gender?: any; ... }
Possible Solution
The generator should generate the corresponding enum and implement it in the interface:
export interface Person { ... gender?: gender; ... } export enum gender { FEMALE = 'female', MALE = 'male', }
Additional Context
API Platform version(s) affected: 3.0
Description
I'm using the Typescript Generator to generate some interfaces and I have some enum types in the Entity, for example:
but when I generate the interfaces, they are generated as type
any
.How to reproduce
Create an entity with an enum type. Use the Typescript generator to generate the corresponding interface:
The interface generated will be of type
any
instead of having the proper enum type:Possible Solution
The generator should generate the corresponding enum and implement it in the interface:
Additional Context