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

[Validation] "root types exist" should be a formal validation #218

Open
rmosolgo opened this issue Oct 5, 2016 · 2 comments
Open

[Validation] "root types exist" should be a formal validation #218

rmosolgo opened this issue Oct 5, 2016 · 2 comments
Labels
👻 Needs Champion RFC Needs a champion to progress (See CONTRIBUTING.md) 💭 Strawman (RFC 0) RFC Stage 0 (See CONTRIBUTING.md)

Comments

@rmosolgo
Copy link

rmosolgo commented Oct 5, 2016

A GraphQL schema must have a query root, but mutation and subscription roots are optional. If a schema doesn't have a mutation root, mutation operations are invalid. Same for subscription: if there's no subscription root type, we should reject a document with an operation on subscription.

We have this validation in graphql-ruby now (thanks @cjoudrey) but we didn't at first, because I was literally reading the spec and implementing the rules one-by-one.

Should that rule be in the spec? If so, I'm happy to try writing up (I think I have a bow tie around here somewhere 😆 ).

@stubailo
Copy link
Contributor

stubailo commented Oct 5, 2016

As a side note I think it's reasonable to have a server with only mutation or subscription types, I'm not sure why Query is singled out as being required.

@rwe
Copy link

rwe commented Jan 27, 2017

Agreed. We've been bitten by this when exposing mutation-only schemas for backend services. The workaround is to create an empty query type, but I'm not sure what the rationale is for that to be explicitly required unlike mutationType or subscriptionType. Does queryType have any other special characteristics?

To be clear, the issue at hand is the non-nullability of the queryType field in the Introspection schema:

@leebyron leebyron changed the title Should "root types exist" be a formal validation? [Validation] "root types exist" should be a formal validation May 1, 2018
@leebyron leebyron added 👻 Needs Champion RFC Needs a champion to progress (See CONTRIBUTING.md) 💭 Strawman (RFC 0) RFC Stage 0 (See CONTRIBUTING.md) 🚀 Next Stage? This RFC believes it is ready for the next stage and removed enhancement 🚀 Next Stage? This RFC believes it is ready for the next stage labels Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👻 Needs Champion RFC Needs a champion to progress (See CONTRIBUTING.md) 💭 Strawman (RFC 0) RFC Stage 0 (See CONTRIBUTING.md)
Projects
None yet
Development

No branches or pull requests

4 participants