0xPlaygrounds / 0xPlaygrounds/rig
feat: uniformize Serde enum tagging
- 主要語言
- Rust
- 星號
- 8.6k
- 分支
- 959
- 平均合併
- 4 小時 32 分鐘
- 30 天內合併 PR
- 117
描述
- [x] I have looked for existing issues (including closed) about this
## Feature Request
Enum serialization is a bit all over the place, `UserContent` is inner tag (`#[serde(tag = "type", rename_all = "lowercase")]`) but `AssistantContent` is untagged (`#[serde(untagged)]`). I would suggest picking a pattern, I usually prefer to be more explicit than not (with an inner tag). Untagged will only get you so far.
### Motivation
This is follow-up on #608, since I started looking at storing that data longer term. I have decided to create my own set of structs to have more control, but I would still suggest improving the tagging of enum so it is at least consistent.
### Proposal
Apply an inner tag on all enums.
貢獻指南
研究方向
Look at the Serde enum tagging in the codebase, specifically the `UserContent` and `AssistantContent` enums. Understand the difference between inner tag and untagged serialization. Apply consistent inner tagging across all relevant enums, ensuring serialization/deserialization works correctly. Run existing tests to verify changes.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- rust
- 領域
- backend-api-design
- Issue 類型
- 重構
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100