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

attributevalue.UnmarshalListOfMaps doesn't support json key diff from struct field name #2574

Closed
2 tasks done
tsesck opened this issue Mar 24, 2024 · 4 comments
Closed
2 tasks done

Comments

@tsesck
Copy link

tsesck commented Mar 24, 2024

Acknowledgements

Describe the bug

type MyStruct struct {
MovieTitle string. json:"movie_title"
}

var mystructs []MyStruct

When I run attributevalue.UnmarshalListOfMaps(scanOutput.Items, &mystructs), all MovieTitles are empty. If I change the field to Movie_Title, then it works

Expected Behavior

It used to work in v1 when I use

dynamodbattribute.UnmarshalListOfMaps

Current Behavior

type MyStruct struct {
MovieTitle string. json:"movie_title"
}

var mystruct MyStruct

When I run attributevalue.UnmarshalListOfMaps(scanOutput.Items, &mystruct), MovieTitle is empty. If I change the field to Movie_Title, then it works

Reproduction Steps

type MyStruct struct {
MovieTitle string. json:"movie_title"
}

var mystruct MyStruct

When I run attributevalue.UnmarshalListOfMaps(scanOutput.Items, &mystruct), MovieTitle is empty. If I change the field to Movie_Title, then it works

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

$ go mod graph | grep github.com/aws
main github.com/aws/[email protected]
main github.com/aws/aws-sdk-go-v2/[email protected]
main github.com/aws/aws-sdk-go-v2/[email protected]
main github.com/aws/aws-sdk-go-v2/feature/dynamodb/[email protected]
main github.com/aws/aws-sdk-go-v2/feature/ec2/[email protected]
main github.com/aws/aws-sdk-go-v2/internal/[email protected]
main github.com/aws/aws-sdk-go-v2/internal/endpoints/[email protected]
main github.com/aws/aws-sdk-go-v2/internal/[email protected]
main github.com/aws/aws-sdk-go-v2/service/[email protected]
main github.com/aws/aws-sdk-go-v2/service/[email protected]
main github.com/aws/aws-sdk-go-v2/service/internal/[email protected]
main github.com/aws/aws-sdk-go-v2/service/internal/[email protected]
main github.com/aws/aws-sdk-go-v2/service/internal/[email protected]
main github.com/aws/aws-sdk-go-v2/service/[email protected]
main github.com/aws/aws-sdk-go-v2/service/[email protected]
main github.com/aws/aws-sdk-go-v2/service/[email protected]
main github.com/aws/[email protected]
github.com/aws/[email protected] github.com/aws/[email protected]
github.com/aws/[email protected] github.com/jmespath/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/feature/ec2/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/internal/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/service/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/service/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/service/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/internal/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/internal/endpoints/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/service/internal/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/service/internal/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/feature/ec2/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/service/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/service/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/service/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/internal/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/internal/endpoints/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/service/internal/[email protected]
github.com/aws/aws-sdk-go-v2/[email protected] github.com/aws/aws-sdk-go-v2/service/internal/[email protected]
github.com/aws/aws-sdk-go-v2/feature/dynamodb/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/feature/dynamodb/[email protected] github.com/aws/aws-sdk-go-v2/service/[email protected]
github.com/aws/aws-sdk-go-v2/feature/dynamodb/[email protected] github.com/aws/aws-sdk-go-v2/service/[email protected]
github.com/aws/aws-sdk-go-v2/feature/dynamodb/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/feature/dynamodb/[email protected] github.com/jmespath/[email protected]
github.com/aws/aws-sdk-go-v2/feature/ec2/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/feature/ec2/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/internal/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/internal/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/internal/endpoints/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/internal/endpoints/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/internal/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/internal/endpoints/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/service/internal/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/service/internal/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/jmespath/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/internal/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/internal/endpoints/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/internal/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/internal/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/internal/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/internal/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/internal/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/internal/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/internal/endpoints/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/internal/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/internal/endpoints/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/internal/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/internal/endpoints/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/service/internal/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/aws-sdk-go-v2/service/internal/[email protected]
github.com/aws/aws-sdk-go-v2/service/[email protected] github.com/aws/[email protected]
src$

Compiler and Version used

$ go version go version go1.21.7 darwin/arm64

Operating System and version

macOS Sonoma 14.3.1

@tsesck tsesck added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 24, 2024
@tsesck tsesck changed the title attributevalue.UnmarshalListOfMaps doesn't support json key diff from struct member attributevalue.UnmarshalListOfMaps doesn't support json key diff from struct field name Mar 24, 2024
@lucix-aws
Copy link
Contributor

attributevalue struct tags are keyed under dynamodbav:

type MyStruct struct {
    MovieTitle string `dynamodbav:"movie_title"`
}

@lucix-aws lucix-aws added guidance Question that needs advice or information. closing-soon This issue will automatically close in 4 days unless further comments are made. and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 25, 2024
@tsesck
Copy link
Author

tsesck commented Mar 25, 2024

@lucix-aws It worked. Thanks.

@tsesck tsesck closed this as completed Mar 25, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

@tsesck
Copy link
Author

tsesck commented Mar 25, 2024

replacing json with dynamodbav worked. thanks.

@lucix-aws lucix-aws removed guidance Question that needs advice or information. closing-soon This issue will automatically close in 4 days unless further comments are made. labels Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants