support enums whose unit variants serialize as something other than strings
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by reading how typespace represents enums and generates serialization code; the issue does not name specific files or tests. Trace how enum variants are represented and how generated code handles serde serialization and deserialization, then check the related Display and FromStr behavior. Done means typespace can represent variants serialized as arbitrary JSON values and generate the corresponding implementations.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
A schema like
{ "enum": [true, 1, "on"] }
has no representation in typespace today: an enum's unit variants serialize under their (renamed) Rust names, which are strings.
This isn't something serde annotations can express. External tagging is the only serde scheme that requires a unit variant's serialized value to be a string, and it's serde's default because it's the cheapest to deserialize; the other tagging forms don't help with a bare true or 1. So this takes two steps: typespace has to be able to represent a variant whose serialized form is an arbitrary JSON value, and then it has to generate Serialize and Deserialize impls for it.
Rather than treating these enums as special, my inclination is to generate the serde impls for all enums (or maybe all types). The argument for deriving is weaker than it looks: serde annotations don't appear in the docs, so the "familiar notation" benefit only reaches someone reading the generated source, and we already spend about as much effort organizing our structures to emit the right annotations as we would generating the impls directly.
Related: Display and FromStr for such an enum are the same gap seen from the other side, and should close with this.
- Ngôn ngữ chính
- Rust
- Star
- 4
- Fork
- 4
- Merge trung bình
- 15 giờ 16 phút
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- 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 oxidecomputer/typespace
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 57/100
oxidecomputer/typespace#68 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
oxidecomputer/typespace#47 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
add a setting to annotate generated types with its idCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 1/100
oxidecomputer/typespace#45 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 36/100
oxidecomputer/typespace#44 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
oxidecomputer/typespace#41 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của oxidecomputer/typespace
Issue tương tự
-
[Bug]: Add Data's question says "Link to the file" for a GeoPackage where small tables are copiedĐang mởunconfirmed possible issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
jerney-nexus/epikrise#364 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Yeachan-Heo/gajae-code#8058 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug daemon
Độ 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
-
good first issue
Độ 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