Commit Graph

59 Commits

Author SHA1 Message Date
Brian Clozel
b9932735db Revert "Auto-configure DataLoaderRegistrar components"
This reverts commit 36a84f58bd.
2021-11-25 10:55:20 +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
Rossen Stoyanchev
9a7bab42c9 Support Principal as a method argument
Closes gh-119
2021-11-12 19:47:18 +00: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
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
4dcb9ea7c6 Support Locale as a controller method argument
Closes gh-3
2021-11-01 18:17:44 +00:00
Rossen Stoyanchev
6dabd7c212 Update docs and samples on "slice" tests
See gh-75
2021-10-28 12:29:24 +01:00
Brian Clozel
02d6cb1c59 Refine GraphQL testing infrastructure
After the introduction of the `@GraphQlTest` annotation, this commit
adds further refinements to the testing infrastructure.

Now, `@GraphQlTest` is completely independent of any web framework and
contributes a `GraphQlTester` component.

`@SpringBootTest` integration tests with mock servers only require an
`@AutoConfigureWebGraphQlTest` to get a `WebGraphQlTester` component.

Closes gh-75
2021-10-27 21:16:03 +02:00
Hantsy Bai
eecddb314c Update index.adoc
It should be `List` here?
2021-10-27 11:41:54 +01:00
Rossen Stoyanchev
23d2450e64 Polishing 2021-10-26 12:55:10 +01:00
Brian Clozel
207f0ae1a3 Fix typo in Spring Boot testing support
See gh-75
2021-10-22 22:04:27 +02:00
Brian Clozel
e053e14158 Add GraphQlTest annotation
Prior to this commit, we could only test Spring GraphQL applications
with a complete application - all application and infrastructure
components were involved. While using `@SpringBootTest` is often useful
for complete integration tests (with or without a live running server),
we often want to write lean integration tests and test slices of our
application.

Just like `@WebMvcTest` or `@WebFluxTest`, this commit introduces the
support for `@GraphQlTest`. This annotation helps us to test a
particular slice of our application: a hand-picked selection of
`@Controller`, plus `RuntimeWiringConfigurer` and `WebInterceptor`
beans.

Other `@Component` must be imported or mocked for those tests.

This commit also refactors the existing auto-configuration to enable
this use case. The `WebGraphQlHandlerAutoConfiguration` now holds the
required components for `@GraphQlTest`, while other web-related
auto-configurations bring the web framework and transport
infrastructures.

Closes gh-75
2021-10-22 22:00:02 +02:00
Rossen Stoyanchev
20bae75ed8 Add WebSocketInterceptor
See gh-162
2021-10-20 21:21:31 +01:00
Rossen Stoyanchev
811d32b647 Update section on GraphQlSource.Builder
See gh-154, gh-167
2021-10-18 18:47:53 +01:00
Rossen Stoyanchev
cedc6ede3d Support DataFetchingFieldSelectionSet as an argument 2021-10-15 17:19:22 +01:00
Rossen Stoyanchev
28b3d13b0b Add example of custom scalar type
Closes gh-161
2021-10-15 16:59:08 +01:00
Rossen Stoyanchev
d5d57c9a2c Update Javadoc for BatchMapping
Closes gh-166
2021-10-15 16:19:11 +01:00
Rossen Stoyanchev
94ff0a2aaf Refactoring in reference docs
Consolidate the content on `@SchemaMapping` into its own sub-section
and make it consistent with the same for `@BatchMapping`.

See gh-130
2021-10-05 10:16:09 +01:00
Rossen Stoyanchev
429f6f44bf Polishing
Show map-based batch loading first which is easier to implement without
having to order results.

Use JUnit named arguments in BatchMappingInvocationTests.

See gh-130
2021-10-05 10:15:20 +01:00
Rossen Stoyanchev
21d9791484 Update reference docs for access to HTTP headers
Also rename existing methods for request headers to be consistent with
those for response headers and use "Http" in the name.

Closes gh-74
2021-10-01 17:36:49 +01:00
Rossen Stoyanchev
762b9f06c2 Support query files for input in GraphQlTester
Closes gh-67
2021-10-01 17:36:49 +01:00
Rossen Stoyanchev
a66b49540b Polishing docs and removing unused code 2021-09-29 18:25:24 +01:00
Rossen Stoyanchev
440b123cc4 Minor refactoring
Rename AnnotatedDataFetcherConfigurer -> AnnotatedControllerConfigurer,
since handler methods are now not only data fetchers but also
batch loaders.

Move DataFetcherHandlerMethod and BatchLoaderHandlerMethod into the
support package next to AnnotatedControllerConfigurer where they're used.

See gh-130
2021-09-29 17:56:08 +01:00
Rossen Stoyanchev
0f37af1b25 Update default extensions in reference docs
See gh-134
2021-09-29 15:59:52 +01:00
Rossen Stoyanchev
5109a1195f Update documentation for @BatchMapping
Closes gh-130
2021-09-28 15:09:39 +01:00
Brian Clozel
b03097ad47 Remove attributes from Argument annotation
Prior to this commit, the `@Argument` annotation would support two
attributes: `required` and `defaultValue`, specifying whether arguments
should be considered as required and default values to use if they're
not present.

This can be problematic as this can already be specified at the schema
level.

To avoid duplication and invalid setups betweens schema and Controllers,
this commit removes those attributes in favor of the schema definition.

Closes gh-150
2021-09-24 13:47:56 +02:00
Brian Clozel
552c4f72d0 Add distribution summary metric for datafetcher calls
This commit adds a new `"graphql.request.datafetch.count"` distribution
summary metric for counting the number of data fetching calls per
request.

Closes gh-146
2021-09-22 16:53:08 +02:00
Rossen Stoyanchev
74ba9061d5 Polishing CORS support 2021-09-22 13:41:39 +01:00
Brian Clozel
17ce7b4838 Simplify asciidoctor setup for reference docs 2021-09-21 22:08:15 +02:00
Brian Clozel
93c696f9bc Allow CORS configuration using config properties
Prior to this commit, a Spring GraphQL application would need to
implement `WebMvcConfigurer` or `WebFluxConfigurer` to register a
specific CORS configuration and map it to the GraphQL endpoint.

This commit adds new configuration properties under the
`spring.graphql.cors.*` namespace that helps configuring CORS for the
GraphQL endpoint.

Closes gh-26
2021-09-21 20:28:48 +02:00
Brian Clozel
543be8429f Introduce version attributes in asciidoctor docs
This commit introduces versions as dynamic attributes in the reference
docs. This also fixes a few incomplete references that were logging
warnings during the documentation build.
2021-09-21 20:28:48 +02:00
Rossen Stoyanchev
b021663f5b Update docs for batch loading
Closes gh-63
2021-09-15 15:54:00 +01:00
Rossen Stoyanchev
a056d5ba06 Add Exceptions section to Boot starter ref docs
See gh-121
2021-09-03 14:01:10 +01:00
Rossen Stoyanchev
a98ca42981 Add resolver for @Argument Map<String, Object>
Closes gh-113
2021-08-31 14:44:47 +01:00
Rossen Stoyanchev
cae12820e4 Replace @GraphQlController in documentation snippets 2021-08-30 16:44:56 +01:00
Rossen Stoyanchev
4bd229d4b9 Deprecate @GraphQlController in favor of @Controller 2021-08-30 14:56:01 +01:00
Rossen Stoyanchev
7495f43670 Support GraphQLContext as a method argument 2021-08-26 19:50:01 +01:00
Rossen Stoyanchev
50eef472c5 Add reference docs for annotated DataFetcher's
Closes gh-90
2021-08-11 05:23:27 +01:00
Rossen Stoyanchev
a78abb7dc8 Polishing and minor refactoring in reference docs 2021-08-10 08:08:04 +01:00
Rossen Stoyanchev
3567a062ab Add RuntimeWiringConfigurer
Closes gh-107
2021-08-09 16:36:18 +01:00
em
a17a2c0af6 Rename RuntimeWiringCustomizer in reference docs
See 9d4ebfe743
Closes gh-102
2021-07-23 09:58:36 +02:00
Rossen Stoyanchev
39702b9745 Extract boot starter docs into a dedicated asciidoc file 2021-07-21 14:30:58 +01:00
Rossen Stoyanchev
69b2476231 Show config for test support in reference docs
Closes gh-96
2021-07-21 14:18:10 +01:00
Rossen Stoyanchev
a316c0411a Add GraphQlRepository annotation and update documentation
See gh-93
2021-07-20 15:59:34 +01:00
Koen Punt
701bfceb41 fix link and typo 2021-07-19 09:51:24 +01:00
Mark Paluch
08d49a848e Refine Querydsl integration documentation
Update repository example to implement Repository. Mention customizing and projection capabilities.

See gh-78
2021-07-06 08:55:31 +01:00
Rossen Stoyanchev
bac7461678 Add DataFetcherExceptionResolverAdapter
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.
2021-07-05 19:35:04 +01:00
Rossen Stoyanchev
a6211bda93 Minor ref doc updates 2021-07-05 16:04:50 +01:00
Rossen Stoyanchev
553dd3e571 Complete reference documentation
Closes gh-78
2021-07-05 12:26:54 +01:00