Nested enum types have no name
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách kiểm tra các định nghĩa giao thức JSON và enum inline trong emulateTouchFromMouseEvent, sau đó so sánh nó với dispatchMouseEvent. Xác định xem các dạng enum lặp lại biểu diễn một kiểu có tên duy nhất hay các kiểu độc lập; hoàn tất khi các enum inline có các định nghĩa miền có tên và các thuộc tính hoặc tham số sử dụng các tham chiếu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Some domain types/commands/events in the JSON protocol definitions have properties/parameters of enum types that are not references to a top-level domain enum type, but that are instead inlined on the spot. For instance here is one:
...
{
"name": "emulateTouchFromMouseEvent",
"description": "Emulates touch event from the mouse event parameters.",
"experimental": true,
"parameters": [
{
"name": "type",
"description": "Type of the mouse event.",
"type": "string",
"enum": [
"mousePressed",
"mouseReleased",
"mouseMoved",
"mouseWheel"
]
...
I'm generating code from the JSON definitions, but I'm facing 2 problems with this at the moment:
- because these types are not defined at the top level as "domain types", they have no name so I have to either use a plain
Stringtype (which defeats the purpose of the enum) or generate a name (which might not be user-friendly). In the example above, a good name might beMouseEventType. This problem would affect any language that doesn't support string union types (in my case, Kotlin). - some of these enums are implicitily reused across multiple commands/events (the example above appears in
dispatchMouseEventandemulateTouchFromMouseEvent), but there is no way to tell whether they are different types and just happen to have the same enum values (and thus might change independently), or whether they are a single reused type (and thus will evolve together and always stay in sync). This means I cannot choose systematically between declaring different enum types or just one. This problem would affect the same set of languages I believe, basically all those who have to declare enums as a named type.
I haven't found any inlined object type like this (these are only refs), I only found enums suffering from this problem.
It would be great if all enums were extracted into the domain types list and only references appeared in the properties and parameters. Some enums already are defined at the top level, just not all of them.
- Ngôn ngữ chính
- JavaScript
- Star
- 1.6k
- Fork
- 281
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 ChromeDevTools/devtools-protocol
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
ChromeDevTools/devtools-protocol#311 · 1 bình luận ·
-
Reconsider versioning schemeĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
ChromeDevTools/devtools-protocol#298 · 4 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
ChromeDevTools/devtools-protocol#233 · 4 bình luận ·
-
Keep track of URL changesCó thể làm lại được @hashseed đã nhận 2203 ngày trước và không có pull request nào đang mở. Đang mở
ChromeDevTools/devtools-protocol#224 · 4 bình luận · 1 reaction · 1 người được giao ·
Tất cả issue của ChromeDevTools/devtools-protocol
Issue tương tự
-
automation models
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs:triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement status: needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
mastra-ai/mastra#25508 · 1 bình luận ·
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 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[aw] Upgrade availableĐang mởagentic-workflows
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
githubnext/gh-aw-cao#15017 ·
Maintainer thường phản hồi trong vòng 1 ngày