0xPlaygrounds / 0xPlaygrounds/rig

feat: uniformize Serde enum tagging

Aperta
#609 2 commenti 0 reazioni 1 assegnatario Rivendicata da @joshua-mo-143 Vedi su GitHub
feat
Lingua principale
Rust
Stelle
8.6k
Fork
959
Merge medio
4h 32m
PR unite (30g)
117

Descrizione

- [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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
backend-api-design
Tipo di issue
Refactoring
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.