BeanParam Annotation not working with helidon rest client to parse QueryParam values

40 Views Asked by At

We are using annotation @javax.ws.rs.BeanParam to aggregate our QueryParams for our controller layer, we are able to call the APIs fine from postman by providing the Queryparams and controller layer is receiving the data just good. The problem occurs when we try to do this via mircoprofile restclient , when we provide @BeanParam annotation in the rest client it dosn't parse the Queryparms that were provided, while making the rest client call. We are building the client using the RestClientBuilder and providing interface for restclient. // Bean

class MyBean {
    @QueryParam("offset")
    @DefaultValue("0")
    public int offset;
    @QueryParam("limit")
    @DefaultValue("50")
    public int limit;
    
    getter ..
    setter ..
}

// Controller

@Produces("application/json")
@Consumes("application/json")
@Path("/v1/internalapi/data")
public class RuleInternalController
{
    @GET
    public PaginatedResponse<Data> getData(@BeanParam MyBean criteria) {
        try {
            return service.getData(criteria);
        } catch (Exception e) {
            success = false;
            throw ErrorResponseHandler.handleException(e);
        }
    }
}

// RestClient Interface (To be used by other microservices to call our service)

public interface InternalRestClient {
    @GET
    @Path("/v1/internalapi/data")
    @Produces(MediaType.APPLICATION_JSON)
    PaginatedResponse<Data> getData(@BeanParam MyBean criteria);
}

Can anyone please help us here, if we are doing something wrong, do we need to register something specific while creating restClient. We are using Helidon 2.6.0.

We have tried registering the restclient with diffrent ways like providing the QueryParams direclty and that just works fine e.g.

    @GET
    @Path("/v1/internalapi/data")
    @Produces(MediaType.APPLICATION_JSON)
    PaginatedResponse<Data> getData(@QueryParam int offset, @QueryParam int limit);

But when we try to add @BeanParam annotation, it dosen't work.

0

There are 0 best solutions below