FasterXML / FasterXML/jackson-dataformats-text

Questionable parsing/serialising of YAML ordered maps

Đang mở
#340 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
yaml
Ngôn ngữ chính
Java
Star
455
Fork
164
Merge trung bình
6 ngày 10 giờ
Pull request đã merge (30 ngày)
2

Mô tả

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?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.