The intention is to query a list of users using an array of User IDs passed into a contains filter. The schema below is my attempt at solving this, but the query does not return a list of users. Even passing only a single User ID results in an empty query result. This schema is being published to AWS AppSync.
Is it possible to query a list of users using an array of User IDs in AppSync?
schema.graphql
type User @model {
id: ID!
username: String!
friends: [String]
}
type Query {
getAllFriends(filter: ModelAllFriendsFilterInput): ModelGetAllFriends
}
type ModelGetAllFriends {
items: [User]
}
input ModelAllFriendsFilterInput {
id: ModelAllFriendsIDInput
}
input ModelAllFriendsIDInput {
contains: [ID]
}
GraphQL Query:
query MyQuery {
getAllFriends(filter: {id: {contains: "VALID-USER-ID-HERE"}}) {
items {
id
username
}
}
}
Query result:
{
"data": {
"getAllFriends": null
}
}
amplify add api, so the data source is DynamoDB. Editing schema.graphql locally, and then publishing usingamplify push. The simple auto-generated queries and mutations work, but not this custom query. Even though it is available in the interactive AppSync GraphQL user interface after the schema is compiled and published.