You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
city,region,country,population,v
Southborough,MA,United States,9686,1,2,3,4error running example: CSV error: found record with 8 fields, but the previous record has 5 fields
showing that only the Writer notices the problem of "containers-in-structs" when it notices there are too many fields.
Looking into the code of the serializer, and thinking about how csv works, it makes sense why this behavior is the way it is, however, I am wondering, do you think it would be worth it to restructure the serializer so it could give better error messages? I would be willing to look into this, unless you think its not possible/very difficult
The text was updated successfully, but these errors were encountered:
guswynn
changed the title
[lowpri] serialization of containers-in-structs errors differently if its the first
[lowpri] serialization of containers-in-structs errors differently depending on the circumstances
Jan 7, 2021
In addition to improving the errors, IMO it would be very helpful to detect if serde is being used, and recommend flattening the unsupported struct using https://crates.io/crates/serde_with
Thank you for taking the time to file a bug report. The following describes
some guidelines to creating a minimally useful ticket.
Above all else: do not describe your problem, SHOW your problem.
What version of the
csv
crate are you using?1.1.5
Briefly describe the question, bug or feature request.
I was looking into how the csv crate implemented serde serialization/deserialization, and noticed a discrepancy.
In this case: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=0093262a4a6e3a775a70df76c8e9a91f
outputs
It very clearly states that the problem is, serializing containers in a struct is impossible.
However
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=d9fe9283bd43cfce5fc9bebbde843ef3
outputs
showing that only the
Writer
notices the problem of "containers-in-structs" when it notices there are too many fields.Similarly https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=275fdb4cf35a29bb47786590c699bcfc
shows that things like tuple structs fail late as well, and https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=275fdb4cf35a29bb47786590c699bcfc shows that top-level sequences only work if they are the exact same size.
Looking into the code of the serializer, and thinking about how csv works, it makes sense why this behavior is the way it is, however, I am wondering, do you think it would be worth it to restructure the serializer so it could give better error messages? I would be willing to look into this, unless you think its not possible/very difficult
The text was updated successfully, but these errors were encountered: