Quarkus REST Client call with generic type

92 views Asked by At

I am using Quarkus REST client (with annotation @RegisterRestClient) to call one of the services. I have implemented a post method in the Rest Client class like below:

@POST
Response postData(EmployeeDTO emp)

This call works fine when the parameter type is specific. However, this operation can take one of many types of data so the callers have a generic implementation before calling this like below:

callingMethod(U request){
   restClient.postData(Entity.json(request))
}

For this i tried changing the client to restClient.postData(Entity<U>)

but then the actual call doesn't seem to recognize the actual json and throws the validation failures.

Caused by: javax.json.JsonException: JSON invalid for schema

Any idea how this can be accomplished and if it is possible?

Thank you in advance SG

0

There are 0 answers