googleapis / googleapis/google-cloud-java

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

Offen
#13,136 1 Kommentar 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
api: firestore type: feature request
Vorherrschende Sprache
Java
Sterne
2.1k
Forks
1.2k
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
154

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.