agrestio / agrest

Server-side Java REST Framework for easy access to data graphs from various backends
https://agrest.io
Apache License 2.0
81 stars 34 forks source link

Allow to exclude null properties in responses #604

Closed andrus closed 1 year ago

andrus commented 1 year ago

For compact output let's allow users to exclude null properties of objects in responses:

AgRuntime runtime = AgRuntime
    .builder()
    .skipNullProperties()
    .build();

When enabled this response:

{ "data" : [{"id":1, "p1":1}, {"id":1, "p1":null}] }

will become this

{ "data" : [{"id":1, "p1":1}, {"id":1}] }

More granular control can be achieved by the users on their own via Jackson annotations.