-
-
Notifications
You must be signed in to change notification settings - Fork 777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to flatten sequences/tuples #1905
Comments
Flattening is possible in combination with use serde_with::EnumMap;
#[serde_with::serde_as]
#[derive(Serialize, Deserialize)]
struct VecEnumValues (
#[serde_as(as = "EnumMap")]
#[serde(flatten)]
Vec<EnumValue>,
); |
Closed
I expect flat a vec shoule be like this: struct A{
#[serde(flatten)]
data: Vec<int>
}
fn main(){
let a = A {
data: vec![1,2,3,4,5]
};
// ser a, then a should be
// A {
// data: 1,
// data: 2 ,
// data: 3,
// data: 4,
// data: 5
// }
//
} |
Frankkkkk
added a commit
to Frankkkkk/quick-xml
that referenced
this issue
Apr 19, 2024
Add a small example about flattened enum deserialization. This is a small workaround around serde's [serde's issue](serde-rs/serde#1905). Big thanks to @Mingun for (most) of the code + help! Signed-off-by: Frank Villaro-Dixon <[email protected]>
Frankkkkk
added a commit
to Frankkkkk/quick-xml
that referenced
this issue
Apr 20, 2024
Add a small example about flattened enum deserialization. This is a small workaround around serde's [serde's issue](serde-rs/serde#1905). Big thanks to @Mingun for (most) of the code + help! Signed-off-by: Frank Villaro-Dixon <[email protected]>
Frankkkkk
added a commit
to Frankkkkk/quick-xml
that referenced
this issue
Apr 21, 2024
Add a small example about flattened enum deserialization. This is a small workaround around serde's [serde's issue](serde-rs/serde#1905). Big thanks to @Mingun for (most) of the code + help! Signed-off-by: Frank Villaro-Dixon <[email protected]>
Frankkkkk
added a commit
to Frankkkkk/quick-xml
that referenced
this issue
Apr 21, 2024
Add a small example about flattened enum deserialization. This is a small workaround around serde's [serde's issue](serde-rs/serde#1905). Big thanks to @Mingun for (most) of the code + help! Signed-off-by: Frank Villaro-Dixon <[email protected]>
Frankkkkk
added a commit
to Frankkkkk/quick-xml
that referenced
this issue
Apr 25, 2024
Add a small example about flattened enum deserialization. This is a small workaround around serde's [serde's issue](serde-rs/serde#1905). Big thanks to @Mingun for (most) of the code + help! Signed-off-by: Frank Villaro-Dixon <[email protected]>
Mingun
pushed a commit
to Frankkkkk/quick-xml
that referenced
this issue
Apr 26, 2024
Add a small example about flattened enum deserialization. This is a small workaround around serde's [serde's issue](serde-rs/serde#1905). Big thanks to @Mingun for (most) of the code + help! Signed-off-by: Frank Villaro-Dixon <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It will be useful to allow flatten sequences, especially that will very helpful to model of XSD choice types.
Example for JSON (but it's not as expressive as for XML): Playground
The text was updated successfully, but these errors were encountered: