Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
salaboy opened this issue Jul 8, 2024 · 0 comments
Open

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

salaboy opened this issue Jul 8, 2024 · 0 comments
Labels
kind/bug Something isn't working

Comments

@salaboy
Copy link
Contributor

salaboy commented Jul 8, 2024

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:

@salaboy salaboy added the kind/bug Something isn't working label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant