Skip to content

Bug: FilterSchema does't remove type when all fields filtered (Unit tests is incorrect) #1474

Closed
@ntziolis

Description

@ntziolis

This test description implies that a type should be filtered out when all fields of the type are filtered out.
https://github.com/Urigo/graphql-mesh/blob/21643d748cac4ed95663f4f41f536aec4dcce02c/packages/transforms/filter-schema/test/transform.spec.ts#L68

However in the string the unit tests checks against the type still does exist:
https://github.com/Urigo/graphql-mesh/blob/21643d748cac4ed95663f4f41f536aec4dcce02c/packages/transforms/filter-schema/test/transform.spec.ts#L97

In our case we want to filter out ALL mutations. However because the Mutation type is "left-over" we get the following error: Error: Type Mutation must define one or more fields.

When leaving at least one field within the Mutation type everything works as expected.

What we expected would happen is that the entire Mutation type would be removed. If this is not the expected behavior, how could we achieve this?

Our setup:

  • nestjs
  • nestjs graphql module that gets fed from graphql mesh
    image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions