I am using GraphQL codegen in clients to generate types based off Payload schema. I'm noticing that when I define my own resolvers, e.g.
ShowsByCategory: {
type: buildPaginatedListType(
'shows',
payload.collections.shows.graphQL?.type
),
args: {
categoryName: {
type: new GraphQL.GraphQLNonNull(GraphQLString),
},
},
resolve: showsByCategoryResolver,
},
The GraphQL schema duplicates the definition of Shows. Is there anyway around this happening?
Okay actually I figured it out, the first argument in buildPaginatedListType 'shows' defines the name of the object in the schema. I simply gave it a unique name "ShowsByCategory" and it resolves the issue.
Also annoyingly, the reason it worked before is because 'shows' was lower case so I had two definitions in the schema Shows and shows
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.