-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Fix add extension types #830
Conversation
...(schema.types || []), | ||
...typeExtensions.GraphQLSchema.types, | ||
...newTypes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great and very simple, but the problem is that it significantly changes the generated schema order - putting the types added by makeExtendSchemaPlugin above everything else.
I think that graphql
walks the types in order, so we may be able to solve this fairly simply by just ensuring that the Query, Mutation and Subscription types are processed first. That might look something like this:
...(schema.types || []), | |
...typeExtensions.GraphQLSchema.types, | |
...newTypes, | |
...([ | |
build.getTypeByName(inflection.builtin("Query")), | |
build.getTypeByName(inflection.builtin("Mutation")), | |
build.getTypeByName(inflection.builtin("Subscription")), | |
].filter(_ => _)), | |
...(schema.types || []), | |
...typeExtensions.GraphQLSchema.types, | |
...newTypes, |
… types (polymorphic)
…fore anything added by makeExtendSchemaPlugin
Description
Resolves graphile/graphile.github.io#368
This PR updates the
makeExtendSchemaPlugin
to add all new types to the schema during theGraphQLSchema
hook so that they are available in the final schema, regardless of explicit usage. Up to this point, types were only added to the schema if they were explicitly (direct or recursively) mapped from a Query/Mutation.Performance impact
Minimum - runs during the
GraphQLSchema
hook.Security impact
N/A
Checklist
yarn lint:fix
passes.yarn test
passes.RELEASE_NOTES.md
file (if one exists).