-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix: Cannot add multiple attribute decorators for primary key #31
Conversation
In case you have any questions fell free to leave them here @afronski 👍 I'll add some e2e tests next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One remark: as in the proposed example, the original case from #30 looks good.
However, one of the allowed scenarios does not work:
export class TableUser extends Entity {
@attribute.partitionKey.string()
id: string;
// --> This throws a "role mismatch" - and it's perfectly allowed as a reprojection for GSI. <--
// "Attribute "type" is decorated with a wrong role in "TableUser" Entity."
@attribute.sortKey.string()
@attribute.gsi.partitionKey.string({ indexName: 'index-1' })
type: string;
@attribute.gsi.sortKey.string({ indexName: 'index-1' })
email: string;
// ...
}
Should be fixed with 3edd954, great find! (I haven't used DynamoDB for a while so I forgot about this use case which is 100% valid) |
@blazejkustra Thanks for the update - I rechecked the case presented above, and it works as expected now. LGTM. 🙇 |
I'll add some e2e tests and merge this week. Thank you! |
Update: I found one issue connected to entity metadata caused by this change 😢 I have to rethink how |
Turned out it is an edge case that I can fix in a different PR. Added remaining tests and merging now. Thanks @afronski for the review! |
Summary:
Code sample:
Model
General
GitHub linked issue:
#30
Type of change:
Is this a breaking change?
Other: