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

Schemas having different query types are not merged properly #8569

Open
Katona opened this issue Nov 2, 2022 · 0 comments
Open

Schemas having different query types are not merged properly #8569

Katona opened this issue Nov 2, 2022 · 0 comments
Labels
core Related to codegen core/cli

Comments

@Katona
Copy link

Katona commented Nov 2, 2022

Describe the bug

If two schemas merged which have different query type name (like Query and RootQuery) one of them is lost during the merging meaning certain queries (which are based on the 'lost' schema) will indicate schema errors.

Your Example Website or App

https://codesandbox.io/s/twilight-dream-1snwfw

Steps to Reproduce the Bug or Issue

  1. Go to https://codesandbox.io/s/twilight-dream-1snwfw.
  2. In terminal run yarn generate.
  3. Notice the generation fails with validation error. This is because during merging the Query query type has been lost and the validation of the user query is failed.

Expected behavior

I am by no means a GraphQL expert, but I assume there can only be one query type in the schema, it is Query if we don't specify explicitly, but we can also specify it like:

schema {
   query: Query
}

And even we can use a different name for the type:

schema {
  query: RootQuery
}

But still, there is only one such type per schema, so I think this still could be merged properly.

Screenshots or Videos

No response

Platform

  • OS: tested on MacOS, but this is not OS specific
  • NodeJS: 16.15.1.
  • graphql version: 16.2.0
  • @graphql-codegen/* version: 2.13.7

Codegen Config File

No response

Additional context

No response

@charlypoly charlypoly added the core Related to codegen core/cli label Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to codegen core/cli
Projects
None yet
Development

No branches or pull requests

2 participants