googleapis / googleapis/google-cloud-java

[java-firestore] Register custom bean deserializers on a Firestore used by toObject(Class)

Đang mở
#13,136 1 bình luận 4 reaction 0 người được giao Xem trên GitHub
api: firestore type: feature request
Ngôn ngữ chính
Java
Star
2.1k
Fork
1.2k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
154

Mô tả

Using `com.google.cloud:google-cloud-firestore:2.1.0`.

I briefly looked at the source code in`DocumentSnapshot` among others and I could not see a way for us to register or use a custom deserializer.

We could easily have done this ourself if `DocumentSnapshot.getData` didn't return incomplete data(key value pair for id field is not included. The key name for the id field is not even present in the response although we could use reflection to find it).

I am hoping to be able to register a Jackson converter for reasons like I don't want to create a default constructor for data classes in Kotlin, json sub types and more.

My wish:

```
interface FirestoreDocDeserializer {
T deserialize(Map data);
}
```

Parameter `data` would basically be the data returned by `DocumentSnapshot.getData` but with key value pair of the id field included.

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

Mở hướng dẫn đóng góp

Đá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.