Commit Graph

361 Commits

Author SHA1 Message Date
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
Brian Clozel
f4a7c80cac Publish CI image as 1.0.x tag 2021-10-29 21:44:18 +02:00
Brian Clozel
c2559c2893 Configure Docker CI image building 2021-10-28 16:35:03 +02:00
Rossen Stoyanchev
dbf0fd704e Update GraphQlTest Javadoc 2021-10-28 14:17:04 +01:00
Rossen Stoyanchev
6dabd7c212 Update docs and samples on "slice" tests
See gh-75
2021-10-28 12:29:24 +01:00
Rossen Stoyanchev
59d5458333 Update sample tests after test config improvements
See gh-75
2021-10-27 21:53:15 +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
Rossen Stoyanchev
ba6cf88a7d Polishing and minor refactoring
Closes gh-168
2021-10-27 16:52:08 +01:00
Mark Paluch
f1a67e560b Limit field projection according to field selection.
We now request only property paths from the repository query
that are requested through a GraphQL query if the result type
is not a projection. That reduces the amount of data being
retrieved from the underlying data store.

See gh-168
2021-10-27 16:51:32 +01:00
Mark Paluch
7fea8730db Migrate QuerydslDataFetcher to use fluent Querydsl API
Remove supporting classes for external projection as projections are
handled by Spring Data directly.

See gh-168
2021-10-27 16:51:21 +01: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
d58dd5c765 Upgrade JDK versions in CI pipeline
Closes gh-170
2021-10-25 09:52:23 +02:00
Brian Clozel
652bb70cf1 Upgrade Ubuntu version in CI pipeline
Closes gh-171
2021-10-25 09:51:48 +02: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
69e34baadf Polishing
See gh-162
2021-10-21 15:54:00 +01: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
f05fd3550a Polishing in ClassNameTypeResolver 2021-10-15 17:32:41 +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
acd060c50e Support for default TypeResolver
See gh-154
2021-10-15 14:33:58 +01:00
Rossen Stoyanchev
75184c55e6 Extract method to GraphQlTestUtils 2021-10-15 12:39:20 +01:00
Koen Punt
454c041546 Recursively instantiate beans in arguments
This commit ensures that Java beans using primary constructors are
properly instantiated when they're nested and that the instantiation
algorithm is called recursively.

Fixes gh-155
2021-10-06 11:37:52 +02: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
fc042497f0 Polishing contribution
Closes gh-153
2021-10-01 19:18:13 +01:00
Adam Pounder
c04bffc044 Allow customising the creation of GraphQLSchema
See gh-153
2021-10-01 19:18:13 +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
5a07883f6a Make TestExecutionResult package private 2021-10-01 17:36:49 +01:00
Rossen Stoyanchev
6777d7613b Make GraphQlTester builders and request strategies top level classes 2021-10-01 17:36:49 +01:00
Rossen Stoyanchev
e644e5e192 Support classes for Builder, RequestStrategy, and RequestSpec
Also separate RequestStrategy from WebRequestStrategy since those are
delegated to internally and never used as a hierarchy. The generics
required to make them extend from each other bring no benefit.
2021-10-01 17:36:49 +01:00
Rossen Stoyanchev
65b5ff9a7c WebGraphQlTester exposes HTTP response headers
Closes gh-74
2021-10-01 17:36:49 +01:00
Rossen Stoyanchev
fb8e82dcc0 Inline GraphQlTesterBuilderConfig in DefaultGraphQlTester
It's simpler to pass the config options explicitly.
2021-10-01 17:36:49 +01:00
Rossen Stoyanchev
f0f883cc39 Inline RequestSpecDelegate in DefaultGraphQlTester
The delegate has almost no logic, simply holding fields and calling the
RequestStrategy, so it adds cognitive overhead without benefit.
2021-10-01 17:36:49 +01:00
Brian Clozel
6975e6c37b Configure ConversionService for argument conversion
This commit configures a `FormattingConversionService` into the argument
resolution infrastructure, using the expected conversion service for
both MVC and WebFlux.

Closes gh-148
2021-09-30 15:26:22 +02: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
Rossen Stoyanchev
0bb8f58008 BatchLoaderRegistry extends DataLoaderRegistrar
Given that BatchLoaderRegistry is declared as a bean and injected into
ExecutionGraphQlService as a DataLoaderRegistrar, it makes sense to
have be a DataLoaderRegistrar vs declaring the bean as the
implementation type. A BatchLoaderRegistry is supposed to result in
DataLoader registrations so this makes sense in any case.
2021-09-27 09:23:01 +01:00