graphql-spec icon indicating copy to clipboard operation
graphql-spec copied to clipboard

Add Appendix C - Built-in Definitions

Open martinbonnin opened this issue 2 years ago • 2 comments

As we dive into full schemas, introspection and more (see https://github.com/graphql/graphql-spec/pull/1036), I'd find it useful to have an authoritative source for built-in definitions that come with a GraphQL implementation (scalar, directives & introspection types).

It shows the built-in definition at a glance and makes it easy to diff, capture a change by looking at the git history. It's also nice for library authors because it uniformizes the descriptions.

The definitions are taken from graphql-js printIntrospectionSchema() with two small changes:

  • I added the scalars definitions manually
  • I carried over the __Type.fields, __Type.interface, etc... descriptions from the current spec comments

I was doing this for my own needs so figured out I might as well contribute it to the spec but I'm happy to move it somewhere else if you think this doesn't belong in the spec.

martinbonnin avatar Aug 05 '23 13:08 martinbonnin

Deploy Preview for graphql-spec-draft ready!

Name Link
Latest commit 3cf473a7828509bba1435a9db308dc0475132997
Latest deploy log https://app.netlify.com/projects/graphql-spec-draft/deploys/685d8f6255c4820008a95131
Deploy Preview https://deploy-preview-1037--graphql-spec-draft.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Aug 05 '23 13:08 netlify[bot]

Would that qualify as an editorial change?

The validation/execution behaviour is essentially unchanged. The main thing that could be considered a behaviour change is that the definitions proposed here contain descriptions. We could either:

  • Remove descriptions
  • Add language that mandates the implementations use the same description as in the spec
  • Add language that the implementations are free to change the description if they want
  • Leave as is

martinbonnin avatar Sep 07 '23 15:09 martinbonnin

I guess there's a distinction to be made between:

  1. implementations MUST always support it and expose the definition in introspection: @include, @defer, etc...
  2. implementations MAY support it but it may not always be present in introspection: @defer, @disableErrorPropagation, etc...

~So I'm questioning wether built-in definitions is the proper term there. Maybe just specified definitions? Or just definitions? Thoughts?~

Edit: I settled on "Type System Definitions"

martinbonnin avatar Mar 06 '25 10:03 martinbonnin

Feedback from May wg:

  • Put everything in one giant block
  • Add a script to get the block from graphql-js (update graphql-js if some things are out of order)

martinbonnin avatar May 01 '25 18:05 martinbonnin