Commit Graph

75 Commits

Author SHA1 Message Date
Koen Punt
fcb86e00d3 Add missing quote in reference documentation
Closes gh-225
2022-01-07 14:45:37 +01:00
Koen Punt
ec7096495c Update testing reference documentation
This commit updates the testing documentation after changes done
with the 1.0.0-M4 release.

Closes gh-224
2022-01-07 14:45:32 +01:00
Brian Clozel
a15fd29fc0 Remove Spring Boot Experimental Starter
The Experimental Spring Boot Starter for Spring GraphQL has been moved
to Spring Boot and will be released with Spring Boot 2.7.0.

Closes gh-207
2021-12-21 14:09:17 +01:00
Brian Clozel
fe76809f3c Document spring-graphql-test dependency
This commit documents the fact that the `spring-graphql-test` dependency
is required for the testing support.

Fixes gh-205
2021-12-10 22:28:36 +01:00
Brian Clozel
3e29e71a6e Add support for Bean Validation
This commit adds support for validating handler method inputs after
binding from the data fetching environment and before invoking the
handler method.

This support is based on Bean Validation and is enabled only if the
application context contains a `Validator` bean.

Closes gh-110
2021-12-10 15:50:16 +01:00
Rossen Stoyanchev
58f2afebb5 Polishing contribution
Closes gh-215
2021-12-09 21:23:59 +00:00
Greg L. Turnquist
ddec60a68e Add documentation for query by example.
See gh-215
2021-12-09 21:23:59 +00:00
Rossen Stoyanchev
b22cef00ab Support context parameters in @BatchMapping methods
Closes gh-172
2021-12-08 13:44:19 +00:00
Rossen Stoyanchev
50aeaba63e Add support for @ContextValue method parameters
See gh-172
2021-12-08 09:47:49 +00:00
Rossen Stoyanchev
5597f543bd Polishing contribution
Closes gh-202
2021-12-01 18:39:17 +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
cc5a8427a8 Update documentation
See gh-201
2021-11-26 14:26:50 +00:00
Brian Clozel
7543120006 Document Querydsl build setup
Closes gh-193
2021-11-25 11:48:31 +01:00
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