I’m unable to find a single GraphQL example of this, but it’s done over and over again in the FaunaQL examples. I have a User document which acts as an “owner” of a Character document. I’m trying to define a query in GraphQL to search for characters owned by a logged in user and can not find a way to display this in GraphQL while also being compatible with Fauna’s GraphQL linter when uploading.
My current code (and how I’d expect this to work):
type Character @collection(name: "Characters") {
name: String!
description: String
owner: User!
}
type User @collection(name: "Users") {
email: String!
}
type Query {
characterByName(name: String): [Character!]! @index(name: "character_by_name")
charactersByOwner(owner: User!): [Character!]! @index(name: "characters_by_owner")
}
When I try to upload this into the GraphQL page in my database I get this error:
Type ‘User’ is not an input type type. (line 65, column 28):
But if I try to put anything else in place of User, it tells me the owner field type IS User.