Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why JsonView ignore @JsonInclude annotation? #89

Open
TheNullablePrototype opened this issue May 5, 2023 · 0 comments
Open

Why JsonView ignore @JsonInclude annotation? #89

TheNullablePrototype opened this issue May 5, 2023 · 0 comments

Comments

@TheNullablePrototype
Copy link

TheNullablePrototype commented May 5, 2023

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class OrderDTO {

    @JsonProperty("id")
    Integer id;
    
    @JsonProperty("code")
    String code;
    
    @JsonProperty("number")
    String number;

    @JsonProperty("name")
    String name;

    @JsonProperty("statusId")
    Integer statusId;

    @JsonProperty("date")
    Instant date;

    @JsonProperty("files")
    List<FileEntityDTO> files;

}

Response:

        {
            "id": 6,
            "code": "code",
            "number": null,
            "name": "Name",
            "statusId": 1,
            "date": null,
            "files": []
        }

use:

JsonView.with(orders).onClass(OrderDTO.class, Match.match().include("*"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant