Prior to this commit, the schema locations configured with
`spring.graphql.schema.locations` could fail in several cases:
* one of the provided locations cannot be resolved as a Resource
* none of the provided locations holds an actual schema file
The latter can happen if several classpath locations match a given
location and the wrong one is considered first.
This commit introduces a new `MissingSchemaException` that holds the
locations information. We're adding the relevant FailureAnalyzer to help
developers troubleshoot such configurations issues.
Fixes gh-117
Following the addition of annotated DataFetcher's the `~.data.method`
with #90, it makes sense to have querydsl support at the same level
in a sibling package.
This commit simplifies the `GraphQL` configuration by focusing the
infrastructure around the `GraphQlSource` auto-configuration.
With this commit, the auto-configuration contributes a single
`GraphQlSource` bean and removes the previoulsy contributed beans:
`GraphQlSource.Builder` and `RuntimeWiring`.
If a developer wants to take full control over the GraphQL setup, then
contributing a `GraphQlSource` bean is the easiest solution.
This commit also improves the `GraphQlSource.Builder` and allows for
customizing the `RuntimeWiring.Builder` instead of providing a direct
instance. This aligns well with the `RuntimeWiringBuilderCustomizer`
interface provided by the starter.
Closes gh-101
Transforming the schema can be expensive and should be separated from
use cases where type visitors don't need to change the schema.
For now we'll provide read-only traversal only. Separately we can
provide an option for schema transformation when it becomes necessary.
It doesn't cause any issues but noticed from logging output that when
WebTestClient is used, we are serializing all of it, rather than just
the RequestInput properties.
As of gh-81, specific security components are contributed by the
GraphQL Security auto-configuration.
This commit removes those from the custom SecurityConfig classes.
This commit adds two new auto-configuration classes that provide the
relevant Spring Security infrastructure for GraphQL applications:
* a `ThreadLocalAccessor` that propagates the security context in
Spring MVC applications
* `DataFetcherExceptionResolver` implementations that resolve security
exception from data fetchers, for both MVC and WebFlux
Closes gh-81
Prior to this commit, auto-configurations were only checking for the
presence of GraphQL Java classes as guards, assuming that Spring
GraphQL classes were always on the classpath.
Auto-configurations are meant to be moved to the Spring Boot project in
the future, so this commit adds the relevant condition class checks to
reflect that spring-graphql might not be on the classpath.
The adapter aims to:
- simplify the common case of synchronous resolution to a single error
- support ThreadLocal context propagation on an opt-in basis
This replaces the SyncDataFetcherExceptionResolver and removes the need
to propagate ThreadLocal context to every resolver.