dapr / dapr/java-sdk

Add support for invokeBindings that return a list of typed objects

Aperta
#1,067 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
kind/bug
Lingua principale
Java
Stelle
300
Fork
230
Merge medio
5g 1h
PR unite (30g)
5

Descrizione

## Expected Behavior

I want to invoke a binding that returns a collection of items of a given type using Java Generic parameters.
Currently the invoke binding supports specifying a TypeRef to automatically deserialize the binding invocation result:

```
String result = client.invokeBinding("BindingName", "MyOperation", event, TypeRef.get(String.class)).block();
```

The output of the binding in this case will be casted to a String. If you are executing a query binding, for example using the `binding.postgresql` query operation, the result will be a collection of objects returned by the query. For such situations, the TypeRef specified should be the type that will be used to deserialize each item on the collection. If a List is specified as the return type, the deserialization code doesn't know which type each item of the collection it is.

List result = client.invokeBinding("BindingName", "MyOperation", event, TypeRef.get(List.class)).block();

## Actual Behavior

It is impossible to deserialize a list of items of a given type when invoking a binding.

## Steps to Reproduce the Problem

PR showing a test -> https://github.com/dapr/java-sdk/pull/1068

## Release Note

RELEASE NOTE:

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dall’overload di client.invokeBinding che accetta TypeRef e segui il percorso di deserializzazione dei risultati delle collection. Esamina il test mostrato in PR #1068; il lavoro è completato quando l’invocazione di un binding può deserializzare il suo risultato in una lista di oggetti tipizzati usando parametri generici Java.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
api
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.