I defined a graphql schema in apollo server with @neo4j/graphql likes this:
type User {
name: String
status: String
Later on I added a new field:
type User {
name: String
status: String
isAdmin: Boolean
Now I query the API like this
query Test {
users(
where: {
isAdmin: true
}
) {
name
status
isAdmin
}
}
This does not work with the Error Field "isAdmin" is not defined by type "UserWhere".
This was the first thing that generated some confusion, because I never defined a UserWhere. I then checked the SDL in the Apollo Studio (https://studio.apollographql.com/sandbox/schema/sdl), which gave me the first clue: There are many auto-generated types.
Input UserWhere {
OR: [UserWhere!]
AND: [UserWhere!]
NOT: UserWhere
name: String
status: String
}
So this UserWhere type is lacking the isAdmin field. Querying with where on name and status works perfectly fine.
So now my questions are:
- Where can I find documentation on how Apollo adds those fields? I was having a hard time.
- If I restart the server, I would have expected that the UserWhere would change with the new fields. IsAdmin can be selected and returned just fine, but I still cant filter it using where. Where is the problem? How can I automatically generate the UserWhere with the new fields?