Skip to content

AddFilterArg - not working #289

@kstott

Description

@kstott
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions