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

Empty queryType and mutationType #191

Closed
terion-name opened this issue Jun 11, 2018 · 4 comments
Closed

Empty queryType and mutationType #191

terion-name opened this issue Jun 11, 2018 · 4 comments

Comments

@terion-name
Copy link

I split my schema into pieces. Then I import them piece by piece, make some processing/generatoin and then merge them all together.

Having such piece:

# import Node from "../../schema/generated/mysql.graphql"
# import DocumentTranslated from "../document/schema.graphql"

type AttachmentTranslated implements Node {
    id: ID!
    createdAt: DateTime!
    updatedAt: DateTime!
    file: File
    title: String!
    document: DocumentTranslated
}

It does not define Query and Mutation, because this type should not be queried from root

After importing the schema, it has empty queryType and mutationType, that leads to errors on further merging.

GraphQLSchema {
  __allowedLegacyNames: undefined,
  _queryType: null,
  _mutationType: null,
  _subscriptionType: null,
  _directives:

I think that due to intention of this package (splitting schema in reusable pieces), this types should be populated automatically, shouldn't they?

@the-vampiire
Copy link

the-vampiire commented Jul 6, 2018

we had this working on gql-import v0.4.0 and it is now broken upgrading to v0.6.0

any update on this or a potential fix? I am going through the codebase migrating to apollo server 2.0 and upgraded the ancillary packages leading to this error. It says my queries and mutations are not defined in the schema.

reverted graphql-import and graphql-tools, working build on AS 2.0:
"apollo-server-express": "^2.0.0-rc.6",
"graphql": "^0.11.7",
"graphql-import": "^0.4.0",
"graphql-tools": "^2.7.2",

@SpaceK33z SpaceK33z added the bug label Aug 15, 2018
@SpaceK33z
Copy link
Collaborator

Would it be possible for any of you to make a full example reproducing this scenario?

@ardatan
Copy link
Owner

ardatan commented Dec 31, 2019

Hi @ma-jahn !
In 1.0.0 beta release, we introduced a lot of changes including schema definition support (schema definition with query, mutation and subscription assignments;
Could you install graphql-import@beta to try new changes? Don't forget to modify your code regarding to the migration notes in README.
https://github.com/ardatan/graphql-import#updating-from-07x

You can also get the final schema in different formats such as string, GraphQLSchema and DocumentNode;

const finalSchema = await importSchema('./some-schema.graphql', {}, 'DocumentNode');

@ardatan
Copy link
Owner

ardatan commented Mar 17, 2020

Available in 1.0.0!

@ardatan ardatan closed this as completed Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants