awslabs / awslabs/aws-sdk-rust

dynamodb example expects `attributes`

Open
#1,228 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
Rust
Stars
3.3k
Forks
290
Avg merge
1d 12h
Merged PRs (30d)
3

Description

Describe the issue

Dear Contributors,

I have come upon this example when using the dynamodb rust SDK. It seems to me that some return values are expected in the default case here, i.e. when .set_return_values(None). However, the actual behavior is that nothing is returned in the response object for key attribute, compare PutItemOutput { attributes: None, .... This behavior is in agreement with the API documentation.

NONE - If ReturnValues is not specified, or if its value is NONE, then nothing is returned. (This setting is the default for ReturnValues.)

The idea to have your new item returned as a response is nice, but if it does not work it makes it harder to engage with the example, which is why I would propose to change the example accordingly and prevent confusions.

I would also like to mention, that using other enum values, e.g. .set_return_values(Some(ReturnValue::AllNew)), will not result in a compile time, but a runtime error. I would suspect this behavior to be unfavored and unnecessary. I do not consider this to be an error, but I would say it is "error-adjacent" considering the type safety attitude of the language.

Am I missing something here?

Thanks!

Links

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/examples/dynamodb/src/scenario/add.rs at the linked line and compare its set_return_values(None) handling with the PutItem API documentation linked in the issue. Confirm what the response contains for the default setting, then update the example so its expected output matches that behavior and verify the scenario still runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, rust
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.