graphql.github.io icon indicating copy to clipboard operation
graphql.github.io copied to clipboard

Update schema.mdx

Open jonathanberger opened this issue 1 year ago • 4 comments

I'm new to GraphQL so I may be mistaken but I believe the author intended to capitalize the type names in this passage since they are capitalized in the paragraphs below. The capitalization is important to get right in this context since the example right above the changed text has both "query" and "Query" in it.

jonathanberger avatar Oct 11 '24 01:10 jonathanberger

@jonathanberger is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 11 '24 01:10 vercel[bot]

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: jonathanberger / name: Jonathan Berger (7896b721469b6cd778a861ac3db48bd91bcfa465, 6e23c01e48caca1af27b37c223052ec3806b5807)
  • :white_check_mark: login: benjie / name: Benjie (d06f813b71c39976ad3cd557adc418559c276225)

Thanks for contributing, @jonathanberger ! Can you sign our CLA?

jorydotcom avatar Oct 11 '24 13:10 jorydotcom

Hi @jonathanberger; thanks for your contribution! These terms can be overloaded quite heavily, making it confusing; I did some work on the spec to stop us using the word query in so many ways: https://github.com/graphql/graphql-spec/issues/715

I believe that the text here is not (contrary to what it says) referring to a Query type, but instead saying that there must be a type (it can have any valid name) that's used for the "query operation". We now call this the "root operation type" for the query operation: https://spec.graphql.org/draft/#sec-Root-Operation-Types

e.g. this is a valid schema:

type Query {
  a: Int
}

This is also a valid schema (note it does not have a Query type, but it does have a type for the query operation, called Root):

schema {
  query: Root
  mutation: Changes
}
type Root {
  a: Int
}
type Changes {
  b: Int
}

This is also valid (but super confusing!):

schema {
  query: Mutation
  subscription: Query
}
"""The query root operation type in this schema"""
type Mutation {
  a: Int
}
"""The subscription root operation type in this schema"""
type Query {
  b: Int
}

I agree the text you've found is confusing; would you like to submit an improved fix that factors in this knowledge?

benjie avatar Oct 11 '24 14:10 benjie

@jonathanberger I still would like your feedback on that last point, but I've gone ahead and committed the changes since there is overlapping work in #1800

benjie avatar Oct 24 '24 11:10 benjie

I think your latest approach is an improvement. Thanks!

jonathanberger avatar Oct 31 '24 16:10 jonathanberger

Awesome; your work has been incorporated into https://github.com/graphql/graphql.github.io/pull/1800 so I'm going to close this PR - thanks again @jonathanberger :raised_hands:

benjie avatar Oct 31 '24 16:10 benjie