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

There should be a way to preserve unused types on buildSchema() #293

Closed
craicoverflow opened this issue Oct 5, 2020 · 2 comments · Fixed by #294
Closed

There should be a way to preserve unused types on buildSchema() #293

craicoverflow opened this issue Oct 5, 2020 · 2 comments · Fixed by #294
Labels

Comments

@craicoverflow
Copy link
Contributor

I have a use case where I need my GraphQL schema (composed using this library) to keep all unused types in the schema when I run buildSchema().

The only way I can see to achieve this is by adding the types I want to a "keep" list with addSchemaMustHaveType. The problem with this is that only those types that are explicitly added with this method are kept, whereas I want all types to be kept (some of which already exist in the initial schema).

I was looking to create a PR to help with this, but was unsure where would be the best to do it in the current architecture - ExtraSchemaConfig does not feel like an appropriate interface to extend since it is essentially a proxy to GraphQLSchemaConfig.

I'd love to help, but don't want to jump in just yet! Maybe this does not require a code solution at all?

@nodkz
Copy link
Member

nodkz commented Oct 5, 2020

Feel free to extend ExtraSchemaConfig with a new additional option (eg. keepAllTypes: true or addAllTypes: true or any another better name on your choice). Just extract this option in SchemaComposer.buildSchema before passing rest options to graphql.buildSchema.

@github-actions
Copy link

🎉 This issue has been resolved in version 7.22.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants