Bug description The function definition for function calls does not support generics.
Environment Spring ai 1.0.0-SNAPSHOT
Steps to reproduce
step1:
public class TrainSearchScheduleService
implements Function<RequestBean<TrainSearchScheduleReq>, ResponseBean<TrainSearchScheduleResp>> {
....
}
step2:
Runtime-based generic type erasure leads to the loss of generic information.
Expected behavior Support for defining generic classes
Comment From: mxsl-gr
generic type is not supported yet, because the FunctionCallback.inputTypeSchema
is generated based on Class
, not Type
. In theory, it could be supported if the Class
is replaced with Type
.
Comment From: lvchzh
generic type is not supported yet, because the
FunctionCallback.inputTypeSchema
is generated based onClass
, notType
. In theory, it could be supported if theClass
is replaced withType
. Yes, I have noticed this through the code and submitted changes to address the issue. commit 71e8cee64ea7f2df7b703d8820eb40391b8cfdd2
Comment From: csterwa
@lvchzh is resolved with commit https://github.com/spring-projects/spring-ai/commit/71e8cee64ea7f2df7b703d8820eb40391b8cfdd2?
Comment From: markpollack
Hard to tell from the commit as it doesn't contain tests as specified in the example. That said, we have spent efforts to remove dependencies on type utils in spring cloud function and create our own type utils that also help with kotlin support. Will investigate the support of
public class TrainSearchScheduleService implements Function<RequestBean<TrainSearchScheduleReq>, ResponseBean<TrainSearchScheduleResp>>
Comment From: tzolov
Resolved by 432954dad7f7c3a33117848a4259bc7076865c5f