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

feat: Add option to allow unused types #445

Merged
merged 3 commits into from
Nov 17, 2020
Merged

feat: Add option to allow unused types #445

merged 3 commits into from
Nov 17, 2020

Conversation

danilo-barboza
Copy link
Contributor

@danilo-barboza danilo-barboza commented Oct 4, 2020

Resolves #442
Resolves #420

Checklist

  • Pull requests follows the contribution guide
  • New or modified functionality is covered by tests

Description

Adding a new includeUnusedTypes option to include unused types to the final executable schema. The caveat is that the unused types need to be included in the schema parser dictionary. I think it is an ok tradeoff as this feature has specific use cases as described in #420 and #442.

Added a couple of test cases to it as well as serve as both test and example of how to use it.

@danilo-barboza
Copy link
Contributor Author

Hi @vojtapol.

Can you take a look at this approach? Is it valid? What do you think?

Looking forward to getting your feedback.

@barnardb
Copy link

This looks like a straightforward way to expose the schema as written and unblock the ability to extend a type in the federation use case. Looking forward to seeing this get a maintainer review. :)

Copy link
Member

@vojtapol vojtapol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for the contribution. It has no impact on existing users whatsoever which is great.

@vojtapol vojtapol merged commit 62b823b into graphql-java-kickstart:master Nov 17, 2020
@danilo-barboza
Copy link
Contributor Author

Thank you @vojtapol for merging the PR!

What is the release process? When should we expect a new version with the changes to be released?

@sijonelis
Copy link

sijonelis commented Dec 8, 2020

THis might save others some time
While this is not yet released or propagated to the graphql-spring-boot-starter package, quickest way to verify it in spring would be:

  1. clone master. build it and install locally.
  2. setup GraphQLSchema bean as usual
  3. override the default schema parser bean as such
@Bean
SchemaParser schemaParser(YourQueryService query, YourMutationService mutation) {
    return SchemaParser.newParser()
        .file(YOUR_SCHEMA_FILE)
        .resolvers(query, mutation)
        .options(SchemaParserOptions.newOptions().includeUnusedTypes(true).build())
        .dictionary(YourExternalClass.class)
        .build();
}

Apologies if its reads obvious to others, however it took me a while to set up a working example (danilo's test case was extremely helpful!) so i wanted to share it here.

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