Commit Graph

404 Commits

Author SHA1 Message Date
Rossen Stoyanchev
e6453ef9b0 Ensure DataLoaderOptions are per request
See gh-212
2021-12-07 20:56:56 +00:00
Brian Clozel
b78808d54d Scan nested locations for GraphQL schema files
This commit changes the default value for the `spring.graphql.locations`
configuration property to `classpath:/graphql/**/`. By default, this
will scan nested locations for GraphQL schema files.

Fixes gh-210
2021-12-06 10:47:22 +01:00
Rossen Stoyanchev
6b1d5ebf64 Move graphiql index.html to spring-graphql
Closes gh-209
2021-12-02 15:53:36 +00:00
Rossen Stoyanchev
5597f543bd Polishing contribution
Closes gh-202
2021-12-01 18:39:17 +00:00
Rossen Stoyanchev
85cdadc2c8 Resolve merge conflict
The convert method in ArgumentMethodArgumentResolver is gone and in any
case ProjectedPayloadMethodArgumentResolver mainly needs to know the
name of the argument if an Argument annotation is present.

See gh-202
2021-12-01 17:28:23 +00:00
Mark Paluch
5aa72f216f Support for projected payloads
Controller methods now accept interface projections for individual or all
request arguments when Spring Data is on the class path.

See gh-202
2021-12-01 11:59:58 +00:00
Rossen Stoyanchev
4d99d2ab31 Refactoring in query package
Increase sharing between QBE and Querydsl:
- shared GraphQLTypeVisitor for auto-registration
- utility methods for repository info
2021-11-26 19:19:08 +00:00
Rossen Stoyanchev
38f9f987e4 Combine querydsl and querybyexample into one package
Following the addition of Query By Example, it makes sense to
consolidate the two that mirror each other, are closely related, and
can share package private support.

See gh-191
2021-11-26 19:19:08 +00:00
Rossen Stoyanchev
0f1073b7b5 Remove deprecated annotation 2021-11-26 19:19:08 +00:00
Rossen Stoyanchev
f81334f985 Move GraphQlArgumentInitializer to data package
Following the changes in #191, GraphQlArgumentInitializer is no longer
package private and also needs to be used in the DataFetcher for
Query By Example. As a first step, this change moves the class to
the top-level data package that is a parent of both.

See gh-191
2021-11-26 16:13:15 +00:00
Rossen Stoyanchev
3321121c41 Polishing and minor refactoring in GraphQlArgumentInitializer 2021-11-26 15:56:40 +00:00
Rossen Stoyanchev
425dc9c461 Polishing
See gh-191
2021-11-26 14:42:10 +00:00
Rossen Stoyanchev
cc5a8427a8 Update documentation
See gh-201
2021-11-26 14:26:50 +00:00
Rossen Stoyanchev
46d4d3d648 Polishing contribution
Closes gh-201
2021-11-25 18:12:23 +00:00
Mark Paluch
8704177741 Detect if repository is a QuerydslBinderCustomizer
We now detect Querydsl customizers during auto-registration for
repositories that implement QuerydslBinderCustomizer as default
interface method.

See gh-201
2021-11-25 18:00:27 +00:00
Rossen Stoyanchev
5c5cfdd277 Polishing contribution
Closes gh-201
2021-11-25 17:55:34 +00:00
Greg L. Turnquist
c9b5652833 Support for Query By Example based DataFetcher
This adds support for Spring Data's recent fluent query API via
Query by Example. It tests against Spring Data JPA and Spring Data MongoDB
for imperative, and Spring Data MongoDB for reactive support. To support
MongoDB testing, it uses Testcontainers.

See gh-191
2021-11-25 17:55:34 +00:00
Brian Clozel
b6897168cf Polish
See gh-183
2021-11-25 16:43:11 +01:00
Brian Clozel
cfd0403008 Make id mandatory for RequestInput
This commit is a follow up of 2e4158c and makes the following changes:

* the id is now a mandatory attribute for `WebInput` and `RequestInput`
* a consistent IdGenerator strategy is configured for all requests

Closes gh-183
2021-11-25 12:30:56 +01:00
Rossen Stoyanchev
9ce4b6801e Allow mapping annotations at the class level
Closes gh-195
2021-11-25 11:09:30 +00:00
Brian Clozel
7543120006 Document Querydsl build setup
Closes gh-193
2021-11-25 11:48:31 +01:00
Rossen Stoyanchev
5f260d12f6 Polishing 2021-11-25 10:44:33 +00:00
Rossen Stoyanchev
d9e988670e .gitignore generated sources such as Querydsl 2021-11-25 10:37:43 +00:00
Brian Clozel
201c828b38 Polish 2021-11-25 10:55:37 +01:00
Brian Clozel
b9932735db Revert "Auto-configure DataLoaderRegistrar components"
This reverts commit 36a84f58bd.
2021-11-25 10:55:20 +01:00
Janne Valkealahti
f498407087 Add gitignore for eclipse
- For eclipse and vscode language server
  ignore generic files/dirs created.

Closes: gh-194
2021-11-24 20:16:08 +01:00
Brian Clozel
36a84f58bd Auto-configure DataLoaderRegistrar components
This commit configures all `DataLoaderRegistrar` application components
with the `GraphQlService`. This allows applications to contribute
`DataLoader` instances without using the annotated-controller
programming model.

Closes gh-189
2021-11-24 16:18:40 +01:00
Brian Clozel
d0adceee4b Configure GraphQlProperties even if GraphQlSource is defined
Prior to this commit, the main GraphQL auto-configuration would be
guarded with a condition on a `GraphQlSource` bean being missing. While
we want to prevent the auto-configuration from registering such a bean
if the user configuration already did so, we should still contribute the
`GraphQlProperties` bean to the context, as it is required for other
purposes.

This commit moves the condition directly on the bean method to avoid
this.

Fixes gh-186
2021-11-24 10:16:38 +01:00
Brian Clozel
2e4158cae8 Set ExecutionId on web requests
Prior to this commit, the `WebInput` would hold an `id` attribute that
correlate the request and response messages on a multiplexed connection.

This commit moves this concept directly to the `RequestInput` so that it
can be used as an `ExecutionId` for all types of transports, if
availble.

This id was already set on the `WebInput` in the WebFlux case with the
id coming from the exchange, but it also creates an id and set it for
the MVC case. This id is then propagated to GraphQL's `ExecutionInput`.

See gh-183
2021-11-23 20:10:53 +01:00
Mingyuan Wu
d9404ea3d6 Upgrade to Spring Boot 2.6
Closes gh-187
2021-11-22 14:32:50 +01:00
Rossen Stoyanchev
b69b92d2c8 Update DataFetcherExceptionResolverAdapter
Make it protected since it needs to be extended and add factory method
with a BiFunction as an alternative.
2021-11-17 11:27:20 +00:00
Rossen Stoyanchev
e2a53759cb Switch DataFetcherExceptionHandler to async contract 2021-11-17 03:50:33 +00:00
Rossen Stoyanchev
0df1884500 Add option for expected errors to GraphQlTester
Closes: gh-175
2021-11-16 21:43:52 +00:00
Rossen Stoyanchev
5c0b32912a Simplify setup for annotated controller tests 2021-11-12 21:44:10 +00:00
Rossen Stoyanchev
9a7bab42c9 Support Principal as a method argument
Closes gh-119
2021-11-12 19:47:18 +00:00
Rossen Stoyanchev
3669d29c5f Extract base class for BatchMapping tests
See gh-119
2021-11-12 19:47:18 +00:00
Brian Clozel
2d5f9ce2a0 Upgrade to Gradle 7.3 2021-11-10 22:21:51 +01:00
Brian Clozel
02089a8542 Upgrade to Spring Boot 2.6.0-RC1
This commit upgrades the experimental starter to Spring Boot 2.6.0-RC1
and aligns all dependency versions to the Spring Boot dependency
management in 2.6.

This commit also removes temporary workarounds in the testing support or
in declared dependencies now that we've moved to 2.6.

While we're now using Spring Boot 2.6 as a reference version for this
project, the baseline didn't change and this commit documents the
requirements for this project; the Spring Data version, for our QueryDSL
support, is a specific example of that.

Fixes gh-181
2021-11-09 09:39:14 +01:00
Rossen Stoyanchev
98f3d4f6ed Refactoring in spring-graphql tests
Add GraphQlSetup that provides a unified workflow for test setup
including the creation of a GraphQsSource, a GraphQlService, a
WebGraphQlHandler, and/or HTTP handlers. The workflow also helps to
collect input (schema, data fetchers) in ways that are convenient
for testing purposes.
2021-11-08 09:42:07 +00:00
Rossen Stoyanchev
2da6bd3824 Refactoring in spring-graphql tests
Add GraphQlResponse wrapper around ExecutionResult to provide access to
data with JSONPath and type conversion, along with convenience methods
to verify errors.
2021-11-08 09:42:07 +00:00
Rossen Stoyanchev
3318e81885 Refactoring in spring-graphql tests
Change GraphQlTestUtils to match how tests have evolved with regards to
how GraphQlSource is initialized and ensure all tests use it.
2021-11-08 09:42:07 +00:00
Koen Punt
2e820dce7a Fix typo 2021-11-03 21:15:39 +00:00
Rossen Stoyanchev
5aac81c003 Polishing contribution
Closes gh-176
2021-11-03 17:25:26 +00:00
Koen Punt
a06ebdcd9c Allow variables with null values in GraphQlTester
See gh-176
2021-11-03 17:25:26 +00:00
Rossen Stoyanchev
5aaf5b1df4 Context for batch loading functions
Batch loading functions registered via BatchLoaderRegistry now have
Reactor Context propagated to them and also have access to the
GraphQLContext from the ExecutionInput.

Closes gh-173
2021-11-03 17:08:19 +00:00
Rossen Stoyanchev
6f16e5e6ea Add mention of directives in documentation
Closes gh-177
2021-11-02 14:57:47 +00:00
Rossen Stoyanchev
f5c17b52d3 Filter Kotlin Continuation in BatchLoaderHandlerMethod
Closes gh-174
2021-11-02 14:50:25 +00:00
Rossen Stoyanchev
b321e350aa Polishing
See gh-3
2021-11-01 18:17:44 +00:00
Rossen Stoyanchev
4dcb9ea7c6 Support Locale as a controller method argument
Closes gh-3
2021-11-01 18:17:44 +00:00
Rossen Stoyanchev
2c8638dd6a HTTP handlers set Locale in ExecutionInput
See gh-3
2021-11-01 18:17:44 +00:00