Closed jcaesar closed 1 year ago
I think this is a consequence of libyaml's tag implementation. Libyaml parses !aaa 42
and !<!aaa> 42
identically as both having a tag value of "!aaa", even though these mean different things. The first one would typically need to be processed as type "aaa" while the second one explicitly means "!aaa".
I don't plan to look into this further since round-tripping arbitrary data through tags is not an intended use of YAML tags.
For the side note: that is not a valid YAML 1.1 document because it contains a flow map implicit key longer than 1024 characters. The 1024 character restriction is lifted in YAML 1.2 but that change is not implemented yet by libyaml. They say it's hard to implement.
The following
serializes to
which I found most surprising.
Tags that start with at least two
!
correctly create a tagged value when serialized, but round-tripping them throughto_string
→from_str
loses two!
.Quick reproducer
```rust fn main() { use serde_yaml::{value::*, *}; for pfx in 0..10 { let tag = std::iter::repeat('!').take(pfx).collect::Strangely, this is easy to fix
but the code makes me think that this behavior may be intentional?
Side note: I found this issue while trying to fuzz my own YAML serializer. But ran into a few other blocks, e.g.
failing to parse despite being seemingly valid. Thus, I've kind of given up on this approach, and I'm not really invested in either of these problems getting fixed. Still, I figured I may as well report them.