FasterXML / FasterXML/jackson-dataformats-text
Questionable parsing/serialising of YAML ordered maps
- Dominant language
- Java
- Stars
- 455
- Forks
- 164
- Avg merge
- 6d 10h
- Merged PRs (30d)
- 2
Description
Ordered maps were introduced in YAML 1.1 and the spec discourages considering key order to be significant otherwise:
```
object: !!omap
- property: "value"
```
With jackson 2.13.3, this is parsed as a `Map>` while I had expected it to be parsed as a `Map` instead. Besides being a bit odd and unexpected, serialising the parsed object produces
```
object:
- property: "value"
```
Notice the missing `!!omap` in the output.
I don't know how I would want to explicitly request `!!omap` serialisation - I'm certainly **not** suggesting clobbering the key parse order with `HashMap` when `!!omap` was not explicitly specified just so that `LinkedHashMap` suddenly means `!!omap`, even though that approach would technically be compliant with the spec. Perhaps a configuration flag to select YAML 1.0 or YAML 1.1+ serialisation of `LinkedHashMap` would make sense? And maybe wrapper/delegate map objects to explicitly override the `!!omap` type for a specific `LinkedHashMap` instance regardless of the flag?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.