-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support for default @JsonView
for a class
#507
Comments
And presumably this would be similar to |
That would be nice, but not requirement for my needs... :) Do you think this is feasible? |
It wouldn't be more difficult, and more importantly, it would then be compatible with regular JsonView handling, as this would just add one more level of defaulting. And you can still use simple short-hand notation for single value. And yes, I think feature itself is feasible, just needs to go in 2.5 since it adds a new annotation type. |
Is this expected anytime soon? at the moment it is really tedious to go and label each of the properties with their respective JsonView. |
Instead of adding a whole new |
@tadas-subonis I don't think anyone is working on this at the moment, so it is not known if or when this would be implemented. I'll tag this for 2.9 to at least make it so it will be evaluated as simple implementation might not be too difficult. @rgoldberg First part -- making |
@JsonView
for a class
Implemented for 2.9.0 so that |
I've been waiting so long for this! :) Is 2.9 coming soon, or still months away? |
@markwoon was hoping to get rc1 out before end of the year, but that is not to be (leaving for vacation tomorrow). That said, should get rc1 out by end of january or so. So... somewhere in between the two. |
Interesting issue, FYI this kind of need is why we had to configure @cowtowncoder Since |
@sdeleuze Right, so default should only apply to non-annotated properties, but would then "override" setting of |
@cowtowncoder I am a bit confused about class-level @JSONVIEW annotation. Now when I serialize my entity class by passing the default view class I am not getting the non-annotated fields of the class in the output. Pls have a look at this stackoverflow question which is not exactly same but similar. |
@cowtowncoder couldn't |
The way I'm currently dealing with "hiding all the views by default" is by doing the following. objectMapper.setConfig(objectMapper.getSerializationConfig().withView(Object.class)); But it would be awesome to set this property per class |
@matiasah If you have specific new feature in mind, please file a new issue; I don't usually open old issues. I am also not quite sure why exactly a new annotation would be needed (or perhaps new setting), so you could outline expected semantics, above and beyond current use of |
I'd like to be able to specify a default view for all properties of a given class that doesn't already have a view defined on it. This would remove the need to annotate every single property.
Something along the lines of:
The text was updated successfully, but these errors were encountered: