Skip to content
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

DynamoDbPreserveEmptyObject should apply to Maps #5674

Open
2 tasks
chrylis opened this issue Oct 22, 2024 · 2 comments
Open
2 tasks

DynamoDbPreserveEmptyObject should apply to Maps #5674

chrylis opened this issue Oct 22, 2024 · 2 comments
Assignees
Labels
feature-request A feature should be added or improved. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.

Comments

@chrylis
Copy link

chrylis commented Oct 22, 2024

Describe the feature

The @DynamoDbPreserveEmptyObject annotation should write an empty m attribute when applied to a Map property.

Use Case

I have a DynamoDB record object with a property of type Map<String, OtherRecord> nested that I will fill in as events happen. Unfortunately, DynamoDB won't let me do a single-shot update if the nested attribute does not already exist, so I want to write an empty map attribute on record creation. Currently, even with @DynamoDbPreserveEmptyObject the Map property is omitted

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

2.28.27

JDK version used

OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

Operating System and version

Gentoo Linux

@chrylis chrylis added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 22, 2024
@Pranjalbharat
Copy link

Pranjalbharat commented Oct 23, 2024

We can do this by implementing custom Marshaler interface on map. I would like to work on it, Can you please provide me more details?
You can see this for reference : https://github.com/aws/aws-sdk-go/blob/main/service/dynamodb/dynamodbattribute/encode.go#L167

@RanVaknin RanVaknin self-assigned this Nov 6, 2024
@RanVaknin
Copy link

Hi @chrylis ,

Can you please give a little more details about the case that doesn't work?

so I want to write an empty map attribute on record creation. Currently, even with @DynamoDbPreserveEmptyObject the Map property is omitted

can you please share your setup and your code as well as the expected and actual item that is being created?

Thanks,
Ran~

@RanVaknin RanVaknin added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.
Projects
None yet
Development

No branches or pull requests

3 participants