googleapis / googleapis/google-cloud-java

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

Aperta
#13,136 1 commento 4 reazioni 0 assegnatari Vedi su GitHub
api: firestore type: feature request
Lingua principale
Java
Stelle
2.1k
Fork
1.2k
Merge medio
1g 23h
PR unite (30g)
154

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.