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

Refine GraphQL server auto-configuration #30035

Closed
bclozel opened this issue Mar 2, 2022 · 0 comments
Closed

Refine GraphQL server auto-configuration #30035

bclozel opened this issue Mar 2, 2022 · 0 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Mar 2, 2022

As of spring-projects/spring-graphql#10, Spring GraphQL ships a GraphQlClient; this brings a new use case for the Spring GraphQL starter: building an application that consumes a remote GraphQL API but does not expose one.

Right now the GraphQlAutoConfiguration is only conditional on the presence of spring-graphql. With that, an application that just want to use the client will fail at startup, since we're trying to find graphql schema files on the configured classpath locations and fail if none was found. This is by design as a schema-less GraphQL API is invalid.

We should refine the GraphQlAutoConfiguration and add a custom condition that triggers the auto-configuration only if:

  1. we detect schema files in the configured locations
  2. OR we detect GraphQlSourceBuilderCustomizer as those can contribute to the schema

So far it doesn't seem we need extra auto-configuration for the client use case, as Spring Boot already contributes a WebClient.Builder and other opinions cannot be inferred from the application environment.

@bclozel bclozel added the type: enhancement A general enhancement label Mar 2, 2022
@bclozel bclozel added this to the 2.7.0-M3 milestone Mar 2, 2022
@bclozel bclozel self-assigned this Mar 2, 2022
@bclozel bclozel closed this as completed in 087e853 Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant