FasterXML / FasterXML/jackson-databind

@JsonUnwrapped completeness: allow more flexible renaming

Đang mở
#385 2 bình luận 8 reaction 0 người được giao Xem trên GitHub
most-wanted
Ngôn ngữ chính
Java
Star
3.7k
Fork
1.5k
Merge trung bình
3 ngày 6 giờ
Pull request đã merge (30 ngày)
28

Mô tả

Prefix and Suffix not sufficient for every use case.
While a very narrow use case consider following example:

``` java
class Rectangle {
@JsonUnwrapped(prefix="topLeft")
Point topLeft;

@JsonUnwrapped(prefix="bottomRight")
Point bottomRight;
}
```

For now this would be serialized as:
{
topLeft.x: 0,
topLeft.y: 0,
bottomRight.x: 2048.
bottomRight.y: 1080
}

From documentation it would seem its not possible to coerce Jackson into serializing it as:
{
left: 0,
top: 0,
right: 2048
bottom: 1080,
}

I am not entirely sure that this is even possible but I suppose something along the lines of:

``` java
class Rectangle {
@JsonUnwrapped(
names = {"x","y"},
renames= {"left", "top"}
)
Point topLeft;

@JsonUnwrapped(
names = {"x","y"},
renames= {"right", "bottom"}
)
Point bottomRight;
}
```

Would cover all thinkable use cases.

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.