{"action":"opened","issue":{"url":"https://api.github.com/repos/serde-rs/serde/issues/1406","repository_url":"https://api.github.com/repos/serde-rs/serde","labels_url":"https://api.github.com/repos/serde-rs/serde/issues/1406/labels{/name}","comments_url":"https://api.github.com/repos/serde-rs/serde/issues/1406/comments","events_url":"https://api.github.com/repos/serde-rs/serde/issues/1406/events","html_url":"https://github.com/serde-rs/serde/issues/1406","id":368051835,"node_id":"MDU6SXNzdWUzNjgwNTE4MzU=","number":1406,"title":"Is it possible to also add information about which `enum` a variety comes from to the serialization and deserialization process ?","user":{"login":"xieyuheng","id":4354888,"node_id":"MDQ6VXNlcjQzNTQ4ODg=","avatar_url":"https://avatars0.githubusercontent.com/u/4354888?v=4","gravatar_id":"","url":"https://api.github.com/users/xieyuheng","html_url":"https://github.com/xieyuheng","followers_url":"https://api.github.com/users/xieyuheng/followers","following_url":"https://api.github.com/users/xieyuheng/following{/other_user}","gists_url":"https://api.github.com/users/xieyuheng/gists{/gist_id}","starred_url":"https://api.github.com/users/xieyuheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xieyuheng/subscriptions","organizations_url":"https://api.github.com/users/xieyuheng/orgs","repos_url":"https://api.github.com/users/xieyuheng/repos","events_url":"https://api.github.com/users/xieyuheng/events{/privacy}","received_events_url":"https://api.github.com/users/xieyuheng/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-09T05:58:44Z","updated_at":"2018-10-09T05:58:44Z","closed_at":null,"author_association":"NONE","body":"For example, in the `Adjacently tagged` section of https://serde.rs/enum-representations.html\r\n\r\nwe can do :\r\n\r\n``` rust\r\n#[derive(Serialize, Deserialize)]\r\n#[serde(tag = \"tag\", content = \"content\")]\r\nenum Block {\r\n    Para(Vec<Inline>),\r\n    Str(String),\r\n}\r\n```\r\nand get json :\r\n\r\n``` json\r\n{\"tag\": \"Para\", \"content\": [{...}, {...}]}\r\n{\"tag\": \"Str\", \"content\": \"the string\"}\r\n```\r\n\r\n------\r\n\r\nThe question is :\r\n\r\nIs it possible to also add information about which `enum` these `Para` and `Str` come from to the serialization and deserialization process ?\r\n\r\nFor example :\r\n\r\n``` rust\r\n#[derive(Serialize, Deserialize)]\r\n#[serde(enum = \"enum\", tag = \"tag\", content = \"content\")]\r\nenum Block1 {\r\n    Para(Vec<Inline>),\r\n    Str(String),\r\n}\r\n\r\n#[derive(Serialize, Deserialize)]\r\n#[serde(enum = \"enum\", tag = \"tag\", content = \"content\")]\r\nenum Block2 {\r\n    Para(Vec<Inline>),\r\n    Str(String),\r\n}\r\n```\r\nand get json :\r\n\r\n``` json\r\n{\"enum\": \"Block1\", \"tag\": \"Para\", \"content\": [{...}, {...}]}\r\n{\"enum\": \"Block2\", \"tag\": \"Str\", \"content\": \"the string\"}\r\n```\r\n"}}
{"actor":{"display_login":"xieyuheng"}}