aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

DynamoDB Enhanced: Make Query/ScanEnhancedRequest serializable

Open boostchicken opened this issue 5 years ago • 4 comments
trafficstars

Describe the Feature

I need to be able to store queries for pagination. In the regular API, you are able to copy and serialize the requests and then store them for later reference. I would like to be able to do the same in Enhanced

Is your Feature Request related to a problem?

This makes pagination difficult. I cannot serialize my queries using Jackson (for storage in Redis, or client-side). Jackson complains that there is no default constructor. Usually, I would solve this with a MixIn. The lack of default constructors and setters make this a large lift of making custom intermediate objects and custom mappers translate them. Also, they should work any serialization implementation (Kryo, FST, ION, Standard JDK)

Proposed Solution

  • Make QueryEnhancedRequest and ScanEnhancedRequest (and all other DynamoDbEnhancedRequests if possible) Serializable and Cloneable
  • Add setters for all properties
  • Add a default constructor

Describe alternatives you've considered

  • Make the builder serializable, then add a toBuilder method to the Request class. This will limit changes in the actual requests API and achieve the same end result. Still, the builder APIs do not have setters and this may cause more complexity
  • Develop Jackson MixIns: This is specific to Jackson and these objects should be able to work with your serialization method of choice.

Additional Context

  • All other SDK requests do this, is there a reason these don't?

  • I am happy to work on a PR for this, but I am assuming there is some reason this was omitted in the first place.

  • Most SDK Requests (outside of DDBE) are generated. I am assuming this is because they directly map to AWS APIs and these don't. Is there any way to reuse some of the generation code to make sure these conform to the rest of the SDK?

  • [x] I may be able to implement this feature request

boostchicken avatar May 18 '20 10:05 boostchicken

Thank you for reaching out @boostchicken. We are going to discuss the viability of implementing this as a team, and will get back to you with some guidelines so you can work on a PR.

debora-ito avatar May 18 '20 22:05 debora-ito

Hey @debora-ito any progress? Hate to a pest, but this functionality would allow us to ditch the v1 api, which I am very keen to do :)

boostchicken avatar May 24 '20 21:05 boostchicken

@boostchicken the long weekend was in the way, we'll probably pick up the task next week. I'll keep you updated.

debora-ito avatar May 26 '20 22:05 debora-ito

Thanks @debora-ito, hope you enjoyed your long weekend!

boostchicken avatar May 26 '20 22:05 boostchicken