-
Notifications
You must be signed in to change notification settings - Fork 816
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
@connection should accept partial sort key #5488
Comments
@duwerq we don't support partial sort keys yet, closing in favor of aws-amplify/amplify-category-api#262 |
@ammarkarachi Sorry, I think there are two separate issues here. Issue mentioned in aws-amplify/amplify-category-api#262 is that when using type User
@model
{
id: ID!
userSchoolId: ID!
userTags: [UserTags]
@connection(
keyName: "UserTagsBySchoolByUserByCategoryByTag"
fields: ["userSchoolId", "id"]
)
} However, the issue with "fields does not accept partial sort key" is another bug and is totally different. I request to reopen this issue, as the two are totally different. |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Feature Request / Bug
Consider the following example:
UserTags creates a GSI with a combined sort key. This allows for multiple access patterns. Get all UserTags by School. Get all UserTags for User. Get all UserTags for User by Category.
But if you run amplify api gql-compile on the example above, it would produce the following error:
## InvalidDirectiveError: Invalid @connection directive usersTags. fields does not accept partial sort key
For the User to get all their tags though, all the sort keys aren't necessary. A User only needs a schoolId and their id to get their tags. The current workaround for this situation is:
Then modify User.userTags.req.vtl and remove user.id being passed as categoryId and tagId in the DB query
The text was updated successfully, but these errors were encountered: