-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Avoid creating a Jsonb each time in Mongo Panache #4196
Avoid creating a Jsonb each time in Mongo Panache #4196
Conversation
Not an expert in either, but I do think this is the right thing to do. It is essentially what I have done here: https://github.com/quarkusio/quarkus/pull/3553/files#diff-9a1fe9d42ef5018e9ebc5cda3e45b9f9R22 |
But how does it work when we have multiple extensions doing that? Or the user willing to add their own serializers? I don't think this approach will fly. Note: this comment isn't about the fix but on the general approach. |
I agree with @gsmet that if we don't do something more centrally this will get out of hand since every extension will want to do it's own thing. We could do the following: Provide a CDI producer for If you like, I can create a PR showing what I have in mind |
Another thing we should do is align the handling between Jackson and JSON-B in RESTEasy |
I agree with that.
I'm thinking of 3 things:
|
Great idea!
Makes perfect sense
That's a good question. IMHO, users shouldn't be prevented from doing such things if they really know what they are doing. |
yeah, for me, that's the missing piece. Have you something in mind? |
Yes. I was thinking of having something like the following:
Users (or extensions for that matter) would then simply add their own
Does that sounds reasonable? I was thinking that this would be in the vanilla json-b module. Ditto for Jackson |
You would pass Other than that, it looks good. And yes, we would need something similar for Jackson. |
Ah yes, you're right! |
@loicmathieu WDYT? Does the proposed plan sound good to you? If we all agree I can cook something up (probably tomorrow) |
BTW, I think we should merge this PR anyway. It fixes a bad behavior and, this way, we can let the other solution mature. |
Makes sense. If we go ahead with the other solution, I'll make sure to update this as well |
@gsmet @geoand there is a task on my TODO list #4193 to implements a better solution for providing Serializer/Deserializer for both JsonB and Jackson. My first idea was to provide a CDI bean (like it is done on Jackson) that can be overriden by a user ... but this is not very convenient as what we want is to provides a default bean that the user can use to add more configuration and not replace, because if a user replace it, he will need to register the serializer that we register on the default one ... Anyway, @geoand if you have some ideas around this please go ahead and keep me posted. |
@loicmathieu the solution I proposed above should take care of the customization vs replacement problem. I'll go ahead and start something soon, then we can discuss on something concrete. |
This is part of #4193
I'm not sure it's the best way to do this. Maybe someone from Jsonb / resteasy can give me feedback ?