Skip to content

Filter method only got called once if the field is null when using @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = SomeFieldFilter.class) #3481

Open
@AmiDavidW

Description

@AmiDavidW

Describe the bug
The filter method only get called once if the field value is NULL,
when using @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = SomeFieldFilter.class)

Version information
2.12.6.1

To Reproduce

  1. create an HTTP get endpoint to return an instance of ObjectDto which has a NULL value for fieldDto:
public class ObjectDto {

    @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = SomeFieldFilter.class)
    private FieldDto fieldDto;

}
  1. Send requests to the endpoint.
    The first time, the equals() method of SomeFieldFilter is called during the serialization.
    The same method never get called for the HTTP requests after.

  2. For instances that have a non-NULL value for fieldDto, the equals() method of SomeFieldFilter` gets called all the time during the serialization

Expected behavior
For instances that have a NULL value for fieldDto, the equals() method of SomeFieldFilter also gets called all the time during the serialization

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions