Skip to content

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

Open
@hagabaka

Description

@hagabaka

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:

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.

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