-
Notifications
You must be signed in to change notification settings - Fork 962
Empty beans are now preserved through serialization and deserialization #2334
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
Conversation
|
Kudos, SonarCloud Quality Gate passed! |
|
Thank you for your PR and apologies for the delayed response. We will take a look shortly |
zoewangg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the use case, but this change might be backwards-incompatible. I'll discuss with the team.
|
Thank you for your patience! We can't merge this change for backwards-compatibility reasons. We think customizing it at the attribute level might be a better way to support this. It would be something like Would you be able to make the change? If not, we will add this task to our backlog, but we don't have a timeline for this change at the moment. |
That sounds good! I will start working on that now, and let you know when I finish. |
Codecov Report
@@ Coverage Diff @@
## master #2334 +/- ##
============================================
+ Coverage 77.66% 77.67% +0.01%
Complexity 366 366
============================================
Files 1244 1244
Lines 39272 39270 -2
Branches 3106 3104 -2
============================================
+ Hits 30499 30503 +4
+ Misses 7285 7283 -2
+ Partials 1488 1484 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
Hi @zoewangg, I've been working on updating the pull request but I've been running into issues as to how to pass information into the inner bean. At first, I tried to implement an annotation on a method, however since I need the attribute key to access tags, it would be impossible to get the tag from the inner bean, since I don't have access to the attribute key the outer bean uses. I then thought to instead implement an annotation on the class and set a flag on the table schema for the inner bean upon its creation in order to tell whether the bean should be preserved when empty or not. The issue with this is that the only way to pass down this information would be to either modify the parameters of public methods, or to modify how the schemas are recursively created to make it avoid the public methods. Is there a better approach to this that you can think of? |
|
Yeah, this is bit tricky. I looked into it yesterday, and I can't think of other approaches. @bmaizels, can you think of anything?
Could you elaborate on this? More specifically, what public methods need to be modified? We can update the public APIs in the internal classes (classes with |
The public method create for BeanTableSchema is referenced by recursiveCreate, and BeanTableSchema is unfortunately labeled as public api. The reason I wanted to use this method specifically is because that is what is used when the inner bean schemas are created, which would be the ideal spot to include the preserve empty behavior. Since the create method receives the class, it may be possible to check for the annotation within that method if the annotation is on the class. If that seems reasonable, please let me know. |
|
I talked with @bmaizels offline. It seems there are some other approaches we can look into:
@reed53 WDUT? Would either of those work for your use-case? I'll also look into it a bit more to see which approach is better and get back to you later. |
The behavior for every bean is ideal, so the client sounds good, however it will still likely be pretty messy to implement, since we need to pass around a flag everywhere. I recently sent an email about the issue and got a response asking to schedule a call with a member of the SDK team. I will wait until after this call to continue working on this issue, as the call may help to clear some things up. |
|
Hi @reed53 I investigated a bit more and the I'm not a big fan of client-level configuration as well because it's not very flexible, so I went ahead and implemented the class level annotation. Here is the PR #2364. Feedback is welcome! 🙂 |
I have no comments beyond what is already mentioned there, but thank you very much for doing this! |
|
Closing in favor of #2364 |
Description
Previously when a bean that had all null attributes, but itself was not null, was serialized and deserialized, the bean would become null. With this change, the bean is not lost through serialization and deserialization.
Motivation and Context
This pull request aims to fix the following issue: #2280
My team and I were trying to move to SDK 2, however this issue caused a loss in preservation through Dynamo, so this aims to fix that.
Testing
Previously existing tests were modified so that if given an empty bean, it expects an empty bean in return.
Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsLicense