FasterXML / FasterXML/jackson-dataformats-text
Questionable parsing/serialising of YAML ordered maps
- 主要言語
- Java
- スター
- 455
- フォーク
- 164
- 平均マージ
- 6日 10時間
- マージ済み PR(30日)
- 2
説明
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?
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。