I developed a restful API using Spring boot and I'm trying to find out the best approach to implement a partial response result. For now my /user/{Id} endpoint returns something like this:
{ "firstname": "Jhon", "lastname": "Doe", "address": "156 Proton street", "username": "jhonDoe", "email": "[email protected]", "company": "Fiction corp" } What I want to achieve is to expose an endpoint with a request parameter fields where I can specify the attributes that I want to retrieve, so the endpoint will be somehting like /users/{id}/fields=firstname,lastname,company and the result will be:
{ "firstname": "Jhon", "lastname": "Doe", "company": "Fiction corp" } I already made some research and found an article about Squiggle library, but they don't mention how this can be integrated with Spring boot, Also if there's any other library that doesn't have to treat only the serialization but generate a custom Query based on Spring data (repositories) to only retrieve the specified fields will be most welcomed.
Is there any solutions like this? Or someone already figured out how to configure Squiggle in their existing application?