Skip to content

Add support for invokeBindings that return a list of typed objects #1067

Open
@salaboy

Description

@salaboy

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 -> #1068

Release Note

RELEASE NOTE:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions