wrong line numbers when using "flatten" #128
Comments
any news on this? |
This looks like a bug. I don't necessarily know how to fix it but I would accept a PR! |
Thanks for the response. I don't really know where to start, but I'll do some digging if I get the time. |
Ok, I've spent some time investigating, but being new to rust I'm aware I'm in over my head. The problem is at Lines 898 to 909 in f9509c8
The I tried using Any suggestion on where to go would be great? I have a failing unit test but I'm not that close to a fix. |
That code doesn't seem like it would be the problem, or else lines would always be wrong when deserializing a map, not just when using flatten. |
Suspect the issue is a particular interaction of
chyh1990/yaml-rust#125 may address this; I haven't yet checked |
I was trying to find some issues on similar behavior I'm seeing with |
It looks like the base problem is with serde's To work around this in full generality, For more information, check out |
When using
#[serde(flatten)]
the line numbers of errors are wrong.In the scenario below I'm always getting line 2, I guess because this is the first line of the map where
another
lives.I've tried this with
serde_json
and it appears to work correctly, so I think this is a problem specific toserde_yaml
.If this is not possible to fix, is there any work around to capture and parse all extra elements of a map without using
flatten
that yields correct line numbers in errors?Example
Running
cargo run
gives:I'm using rustc version
rustc 1.34.0 (91856ed52 2019-04-10)
.The text was updated successfully, but these errors were encountered: