googleapis / googleapis/google-cloud-java

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

Abierto
#13,136 1 comentario 4 reacciones 0 asignados Ver en GitHub
api: firestore type: feature request
Lenguaje dominante
Java
Estrellas
2.1k
Forks
1.2k
Merge medio
1 d 23 h
PR fusionados (30 d)
154

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.