Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering all mutations breaks the schema #5111

Open
4 tasks
aylesm opened this issue Feb 7, 2023 · 4 comments
Open
4 tasks

Filtering all mutations breaks the schema #5111

aylesm opened this issue Feb 7, 2023 · 4 comments

Comments

@aylesm
Copy link

aylesm commented Feb 7, 2023

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

Filtering out all mutations causes the schema to break.

eg.

transforms:
  - filterSchema:
      mode: wrap 
      filters:
        - Mutation.!{*}  

The playground shows the error message

{
  "errors": [
    {
      "message": "Type Mutation must define one or more fields."
    }
  ]
}

To Reproduce Steps to reproduce the behavior:

Expected behavior

Environment:

  • OS:
  • @graphql-mesh/...:
  • NodeJS:

Additional context

@ardatan
Copy link
Owner

ardatan commented Feb 14, 2023

Does it work when you add https://the-guild.dev/graphql/mesh/docs/transforms/prune ?

@aylesm
Copy link
Author

aylesm commented Feb 14, 2023

Does it work when you add https://the-guild.dev/graphql/mesh/docs/transforms/prune ?

It doesn't, was my first attempt to see if I could work round the issue.

@Marx2
Copy link

Marx2 commented Apr 3, 2023

also removing all Query fail in the same way

@ardatan
Copy link
Owner

ardatan commented Apr 3, 2023

@Marx2 You cannot remove all the queries in a GraphQL Schema. A GraphQL Schema needs to have a Query type with a valid field at least.

This was referenced Apr 30, 2024
This was referenced May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants