Enum types are not being generated by the Typescript Generator
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- php, typescript
- Ambito
- tooling
Direzione di ricerca
Inizia con il comando documentato npm init @api-platform/client usando il generatore TypeScript e un’entità come Person con l’enum Gender mostrato. Esamina l’interfaccia Person generata e traccia come la proprietà gender diventa any. Il lavoro è completato quando l’output generato rappresenta i valori dell’enum e usa quell’enum nell’interfaccia invece di any.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
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
- Lingua principale
- TypeScript
- Stelle
- 376
- Fork
- 132
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di api-platform/create-client
-
[potential Security Alert] New `test-vue-app` script added in `@api-platform/client-generator@0.8.0` Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
api-platform/create-client#396 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
api-platform/create-client#397 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
api-platform/create-client#395 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
api-platform/create-client#394 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
api-platform/create-client#393 · 1 commento ·
Tutte le issue di api-platform/create-client
Issue simili
-
blocklist removal
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
pastelsky/bundlephobia#1122 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100