graphql-compose / graphql-compose/graphql-compose-mongoose

If a TC's findMany resolver is added to schema multiple times, filter options for subsequent resolvers are ignored

Open
#421 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
706
Forks
98
PR merge metrics
No merged PRs in 30d

Description

When you use a TC's `findMany` resolver multiple times in schema, for example, first to add a relation, then to add a `findMany` query, and then to add a `pagination` query:
```javascript
X.addRelation('y', {
resolver: X.mongooseResolvers.findMany({filter: filterOptions1})
}),
schemaComposer.Query.addFields({
xFindMany: X.mongooseResolvers.findMany({filter: filterOptions2}),
xPaginate: X.mongooseResolvers.paginate({
findManyOpts: {filter: filteroptions3}
})
});
```
Then `xFindMany` and `xPaginate` queries will use `filterOptions1`, but not `filterOptions2` or `filterOptions3`.

It seems that by default the generated filter input type for all the `findMany` resolvers of the same model share the same name, so the type is created for the first `findMany`, and reused for all other ones. If this default behavior can't be changed, it would be nice to at least have a run time warning and/or FAQ entry in documentation about the limitation.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.