Enum types are not being generated by the Typescript Generator
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- php, typescript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Bắt đầu với lệnh npm init @api-platform/client được tài liệu hóa, sử dụng trình tạo TypeScript và một entity như Person với enum Gender được hiển thị. Kiểm tra interface Person được tạo và theo dõi cách thuộc tính gender trở thành any. Được xem là hoàn tất khi đầu ra được tạo biểu diễn các giá trị enum và sử dụng enum đó trong interface thay vì any.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 376
- Fork
- 133
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của api-platform/create-client
-
[potential Security Alert] New `test-vue-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
api-platform/create-client#396 ·
-
[potential Security Alert] New `test-nuxt-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
api-platform/create-client#397 ·
-
[potential Security Alert] New `test-next-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
api-platform/create-client#395 ·
-
[potential Security Alert] New `test-react-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
api-platform/create-client#394 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
api-platform/create-client#393 · 1 bình luận ·
Tất cả issue của api-platform/create-client
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
status:approved type:bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
egdev6/quorb#109 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
stage:4
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ilan-pinto/roaring-lions#598 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Frontmatter next to `src:` is applied to every imported slide, not only the first (undocumented)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày