'Split json list payload in valid and invalid objects in Micronaut

I'm using a Micronaut controller which receives a list of objects as a payload

  @Post
  Mono<HttpResponse<?>> ingest(@Body final List<MyObject> payload) {
    [...]
  }

Some clients are sending a list of 'MyObject' containing objects which cannot be deserialized by Jackson

Is there an easy way to split the payload in deserializable and non-deserializable objects?
We would need to keep the non-deserializable for further analysis

Fixing the client sending the payload is unfortunately not an option at the moment

I tried to play around with the Micronaut error handling : https://docs.micronaut.io/2.0.0.M2/guide/index.html#errorHandling, but didn't manage to find an easy way to do what I need



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source