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

Stitching schema without Query #659

Closed
flippidippi opened this issue Feb 27, 2018 · 3 comments
Closed

Stitching schema without Query #659

flippidippi opened this issue Feb 27, 2018 · 3 comments

Comments

@flippidippi
Copy link

I am trying to stitch a schema that only contains a Mutation type (email service) but mergeSchema fails.

Intended outcome

Trying to stitch a schema that only contains type Mutation (without a type Query) should successfully merge into other schemas.

Actual outcome

The stitching fails with TypeError: Cannot read property 'getFields' of null in mergeSchema.js

How to reproduce the issue

Try stitching a schema like:

  type Mutation {
    createEmail(body: String!): Boolean
  }
@jonbudd
Copy link

jonbudd commented Aug 2, 2018

My guess is that this is on purpose, to align with the official GraphQL spec: http://facebook.github.io/graphql/June2018/#sec-Root-Operation-Types

A schema defines the initial root operation type for each kind of operation it supports: query, mutation, and subscription; this determines the place in the type system where those operations begin.

The query root operation type must be provided and must be an Object type.

That is, a GraphQL API must have a Query type. I find this a pretty nonsensical part of the spec, especially now that subscriptions exist too; hopefully this changes in the future.

@acao
Copy link

acao commented Jan 23, 2019

@jonbudd agreed... same issue with a Subscription only service, makes it difficult to create single purpose microservices without creating fake query fields

@yaacovCR
Copy link
Collaborator

yaacovCR commented Apr 1, 2020

Can be tracked at spec at graphql/graphql-spec#218 and graphql/graphql-spec#490

@yaacovCR yaacovCR closed this as completed Apr 1, 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

5 participants