Fix handling of key attributes with CustomName attributes#78
Fix handling of key attributes with CustomName attributes#78purkhusid wants to merge 2 commits intofsprojects:masterfrom
Conversation
## What? Fixes an issue where you have an inverted key for a GSI and you are using the CustomName attribute at the same time
| | Some av -> values.Add(prop.Name, av) | ||
|
|
||
| | Some av -> | ||
| let exists, value = values.TryGetValue prop.Name |
There was a problem hiding this comment.
match to avoid the allocation?
|
|
||
| type ``Inverse GSI Table with Custom Names Operation Tests``(fixture: TableFixture) = | ||
|
|
||
| let rand = let r = Random.Shared in fun () -> int64 <| r.Next() |
There was a problem hiding this comment.
| let rand = let r = Random.Shared in fun () -> int64 <| r.Next() | |
| let rand = let r = Random.Shared in fun () -> r.Next() |> int64 |
|
Unsure if this is already common library usage but duplicating attributes in a record via |
|
@samritchie I agree, the CustomName attribute does invite some strange usage patterns and the error handling isn't as robust as it would have to be so that the end user falls into a pit of success. Ideally there would just be better validation e.g. if a user sets the CustomName attribute to the same name as another property we need to validate that the values of those properties are equal. I'm fine with putting this on ice, or maybe just adding a better error messages when this happens. We originally started using this pattern due to not being able to put the main key attributes and the GSI attributes on the same properties but that has been fixed. |
What?
Fixes an issue where you have an inverted key for a GSI and you are using the CustomName attribute at the same time