Support generation of the prelude.graphql based on graphql-js #344
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updating this parser to match revisions to the GraphQL Spec is currently very manual (and error prone), so I (and some awesome contributors!) don't do it often.
New versions of the GraphQL Spec are released infrequently, if ever. However, more commonly the graphql-js reference implementation is updated to include draft GraphQL spec changes and is the new defacto GraphQL standard. (Maybe that's what they meant by client-driven development? 😆 )
In order to update this parser to support new GraphQL Spec versions (and drafts), a contributor needs to export from graphql-js:
They would then need to manually update the
validator/prelude.graphql
file,validator/schema.go
file, and possibly other files relevant to those specific changes like ./validator/rules/, etc.One part of the manual
prelude.graphql
update process was copying the draft spec spec for introspection from here: https://spec.graphql.org/draft/#sec-Schema-Introspection.Schema-Introspection-Schema@CodingContraption went through this and helpfully described the prelude.graphql update process:
@CodingContraption has since updated the
prelude.graphql
update process to be less manual, and I've made this PR based on their work that they describe like this:This change is a huge win for the entire community! Updating a GraphQL parser to incorporate any new revisions is a very intimidating prospect for most folks, and this now makes it fully automatic for some spec changes. For more invasive spec changes, it makes the process a lot less error prone and much quicker to get to exactly where the real work needs to happen.
It also sets us up for possible future improvements, like getting the
prelude.graphql
portions for@defer
and the basic scalars to be generated from graphql-js (... somehow?).I also want to acknowledge that this change further builds on the prior work of @Code-Hex @vvakame and others in #181 and before.
Also worth mentioning, the most recent update #342 still required a manual update process to gqlgen 99designs/gqlgen#3507