Skip to content

DynamoDB Enhanced: Make Query/ScanEnhancedRequest serializable #1846

@boostchicken

Description

@boostchicken

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?

  • I may be able to implement this feature request

Metadata

Metadata

Assignees

No one assigned

    Labels

    dynamodb-enhancedfeature-requestA feature should be added or improved.needs-discussionThis issue/PR requires more discussion with community.p3This is a minor priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions