-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
RustRust OutputRust Output
Description
Currently quicktype always emits serde(untagged) for unions.
Serde supports multiple tagged union forms:
Externally
#[derive(Serialize, Deserialize)]
enum Message {
Request { id: String, method: String, params: Params },
Response { id: String, result: Value },
}{"Request": {"id": "...", "method": "...", "params": {...}}}Internally
#[derive(Serialize, Deserialize)]
#[serde(tag = "type")]
enum Message {
Request { id: String, method: String, params: Params },
Response { id: String, result: Value },
}{"type": "Request", "id": "...", "method": "...", "params": {...}}Adjacently
#[derive(Serialize, Deserialize)]
#[serde(tag = "t", content = "c")]
enum Block {
Para(Vec<Inline>),
Str(String),
}{"t": "Para", "c": [{...}, {...}]}
{"t": "Str", "c": "the string"}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
RustRust OutputRust Output