Skip to content

MappingJacksonJsonView.setRenderedAttributes [SPR-6165] #10833

@spring-projects-issues

Description

@spring-projects-issues

Ken Egervari opened SPR-6165 and commented

Hi, the setRenderedAttributes() method is pretty much useless. In practice, we want to filter out elements that belong to the tree that are nested... not the top level elements. A common idiom is to a list of domain objects, and only wanting specific properties on each domain object to be marshalled. As appears that this is impossible right now, which makes this method useless.

I checked the test cases in your rc1 distribution... and they are really simple. the guy that tested it just made 1 map and a simple bean that wasn't nested at all. If that's all he tested, I'm going to assume nested properties won't work.

Can you please make this work as nested properties and fix the test cases?

If we have a list of Object X and X has a, b, c properties, we should just say a map of "a" and "c" and it should work. Currently, it does not, and it is a big problem.

And I hate to say it, but setting up a map of strings is kind of bloated. It would be nice to have a list of comma-separated strings as an input as well to cut down on the lines of code it takes to write this.

Thanks


Affects: 3.0 RC1

Issue Links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions