-
Notifications
You must be signed in to change notification settings - Fork 108
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
Improve Json Handler by removing the specific serialization of Key.class
#487
Comments
Hello! Is this issue still available? |
Hi @ginaesps, |
Hello I'd like to work in this issue. What it needs to be done here is implementing a separate serialization method for the Key class, is it correct? |
Hi @AtaydeEnrique, |
Hi! Seeing as it has been a couple of weeks without any updates I would like to try to find a solution for this issue, if it's ok. |
Hi @joseearias, |
Perfect. Thanks! I'll leave an update as soon as something comes up. |
Hi @alallema, I've just had a little dig into this issue, as I noticed that there has been no progress on this it the last update. There seems to be two JSON handlers in the project, one which uses GSON (the one in question for this issue) and another using Jackson. Switching the default to use Jackson avoids this piece of code altogether. Jackson is pretty flexible and the configuration already present in the project works pretty well ( Do you know why there are two JSON handlers? Would it be feasible to switch the default implementation to use Jackson instead of GSON and potentially remove the GSON version? (that could be a breaking change and may require a major version change) If the plan is to keep the existing GSON handler, then I think the code that's present right now does the job, although it is not ideal. It may be possible to modify it a little bit to use a custom serializer instead, but I suppose that mostly just moves the conditional code from the GSON handler class, into another place (the customer serializer), so it might not be a particularly large improvement. I'd be happy to help contribute either approach, or if you have another idea for improvements. Whatever you think is best for the project. |
Yes, I know why there are two, there were originally several JSON handlers to avoid the user having to import another JSON library than the one he used in his project. When I refactored the SDK, I left two so there would be a minimum of choice, but it doesn't seem to have been a good decision.
I think one will be enough and Jackson is a good choice for me. However, the modification will bring a breaking change and a lot of changes, I think it's up to @brunoocasali or @curquiza to give their opinion on it. |
Thanks for getting back to me with that information @alallema I'll wait for a response from @brunoocasali or @curquiza on how you'd like to proceed before starting any work on this. |
Both libraries are solid and could be easily chosen between one or the other. I don't want to introduce a new breaking change again in this library, which has a turbulent past 😅 Gson is the default implementation, but it is not included in the final bundle, and the implementation is just a layer to adapt the SDK to those JSON libraries as far as I'm concerned. So, I don't believe we made a mistake here, just that specialization of the CC: @curquiza |
No problem @brunoocasali. I'd be happy to work on this while trying to avoid making breaking changes. I noticed that the code in place right now has a lot to do with null checking and it seems that it's important that the Are you or perhaps @alallema able to explain what the full requirements are in this case? How should it work exactly? I just want to make sure that I understand the desired effect before I invest any significant effort. Thanks. |
@alallema could help by providing details of the implementation! But to me, keeping the current behavior without explicitly specifying the Why? Since the method |
Hi @jrhenderson1988, Thank you so much for taking care of this.
Yes, actually the issue is that some values are needed to create a Key as This is where it gets tricky, as it means that the class must ensure not to set all variables to In addition, we also use this variable when updating a key, which must pass through the same I hope this answers your questions and above all that it was clear enough. Don't hesitate if it's not the case |
I've submitted a PR that hopefully does what you're looking for. I've removed the key specific logic from the class and endeavoured to keep the existing functionality as it is now. I've added more tests (which I ran against the current code also) to verify that the functionality is the same, though it is possible that I may have missed something. Thanks for your help |
Description:
Currently when serializing data via the
encode
method of the JSON handler the classKey
class is treated separately because of the date format.We should find a solution so that all the dates are well managed in the JSON handler
Condition to remove:
The text was updated successfully, but these errors were encountered: