-
Notifications
You must be signed in to change notification settings - Fork 237
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
Specifying a View when using jackson2 #649
Comments
Hey, this is currently not possible. If you need just one view it should be relatively easy to add this feature. I will try it. |
@vojtechhabarta I see, thanks for your investigation! I do indeed serve both views, REST and BaseConfig, to my Angular application (TypeScript). The former (REST) is used for the administration of those entities (as an admin) and the later (BaseConfig) is for app configuration in the frontend for normal users. |
I added Maven sample: <configuration>
<jsonLibrary>jackson2</jsonLibrary>
<jackson2Configuration>
<view>foo.bar.Views$REST</view>
</jackson2Configuration>
</configuration> |
Sounds great, I will probably check it out on the weekend. Thanks a lot already! |
Released in v2.32.889. |
Hey! Im trying to switch view to fix some serializer errors. This is my code:
Shouldnt this mean that i now have an elevated fieldvisibility? I cant see anything about it in the output and I can't solve my serializer problems. Worth to note is that im only using pom.xml also since that has been enough until now |
Please excuse my belated reply @vojtechhabarta, I just got to try it today. There is nothing I could complain about, it works like a charm so far 😊. So finally I don't have to updated my typescript REST models on my own anymore. Thanks again for implementing this, I guess I owe you a pizza and a beer :-) |
Hey,
I just came across this generator, and it seems to be mostly what I was needing.
But in my Java project I'm making use of com.fasterxml.jackson.annotation.View for Jackson2, that means I can generate different JSON data from the same object – depending on the context I am in.
I have looked into the docs but so far did not find if I could possibly specify a View that should be used. Any idea?
Example
My views:
Sample of a persistent class that is also used in JSON communication:
I then configure an ObjectMapper as follows for the JSON mapping on my REST API.
The text was updated successfully, but these errors were encountered: