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

AddFilterArg - not working

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

Description

```js
schemaComposer.rootQuery().addFields({
entityMany: EntityTC.mongooseResolvers.findMany().addFilterArg({
name: 'test',
type: 'String',
description: 'Test',
query: (query, value, resolveParams) => {
query.name = new RegExp(value, 'i');
},
});
});
```
When I try to use this approach to adding a filter to a resolver, it doesn't throw an error. I can confirm that the filter arg is added to the resolver. But the new filter arg is not added to the schema. Is there a better way to do this?

What is the correct approach to add a filter arg to an existing resolver?

Other clues/facts:
* I'm using the most recent versions of all graphql-compose packages.
* I discovered that addFilterArg adds the field 'test' to the filter arg when I inspect it. If I subsequently take that resolver and `.clone({name: 'sample' })` the field is not in the cloned resolver. And, similarly, the field is not added to the schema.

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.