Commit Graph

32 Commits

Author SHA1 Message Date
rstoyanchev
e2948e9a36 Upgrade samples to the latest snapshot 2022-04-11 17:40:17 +01:00
rstoyanchev
9bc4c40a24 Re-enable samples 2022-03-21 16:33:54 +00:00
rstoyanchev
4818ee6c81 Upgrade samples to match the GraphQlTest updates
See gh-310
2022-03-09 12:47:26 +00:00
rstoyanchev
7a7e2e87dc Update project name to Spring for GraphQL
Closes gh-255
2022-01-13 12:16:02 +00: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
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
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
762b9f06c2 Support query files for input in GraphQlTester
Closes gh-67
2021-10-01 17:36:49 +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
f69aa39211 Only scan for *.graphqls and *.gqls schema files
Prior to this commit, the auto-configuration was scanning for
`"*.graphql,*.gql,*.graphqls,*.gqls"` files in the configured locations.
This was not flexible enough, as developers could not customize the
considered file extensions when scanning for files.

This commit provides a new `spring.graphql.schema.file-extensions`
configuration property that enables such customizations.

Because `"*.graphql,*.gql"` extensions seem to be tied to queries
(and not schemas), this commit also changes the default value to only
consider the `"*.graphqls,*.gqls"` file extensions by default.

Closes gh-134
Closes gh-135
2021-09-20 10:29:41 +02:00
Rossen Stoyanchev
4bd229d4b9 Deprecate @GraphQlController in favor of @Controller 2021-08-30 14:56:01 +01:00
Rossen Stoyanchev
0d0b84dc8a Support for annotated DataFetcher's
Closes gh-61, gh-90
2021-08-09 12:37:47 +01:00
Rossen Stoyanchev
a316c0411a Add GraphQlRepository annotation and update documentation
See gh-93
2021-07-20 15:59:34 +01:00
Rossen Stoyanchev
c148eb40b4 Auto registration of Querydsl DataFetcher's
See gh-93
2021-07-19 16:26:44 +01:00
Rossen Stoyanchev
69c2d08c71 Remove formatter-on/off comments 2021-07-06 15:51:50 +01:00
Rossen Stoyanchev
16656d623f Polishing Javadoc and in security sample 2021-07-05 14:36:25 +01:00
Stephane Nicoll
9d4ebfe743 Polish 2021-06-30 15:44:24 +02:00
Rossen Stoyanchev
17bf9ee287 Polishing
Closes gh-59
2021-06-24 21:13:14 +01:00
Mark Paluch
2d53fdc73f Spring Data repositories that support Querydsl
Spring Data repositories that support Querydsl are now supported
as DataFetchers returning single objects and iterables including
projection support.

See gh-59
2021-06-24 21:13:14 +01:00
Rossen Stoyanchev
43f9e34c81 Turn off auto-formatting where it reduces readability 2021-06-15 14:01:52 +01:00
Brian Clozel
53e2a379de Reformat sample applications
Fixes gh-54
2021-06-02 14:30:00 +02:00
Brian Clozel
847c10be27 Add GraphQlTester test auto-configuration
This commit introduces the auto-configuration infrastructure for testing
Spring GraphQL applications with mock/embedded servers.

The new `@AutoConfigureGraphQlTester` annotation can contribute a
`GraphQlTester` bean to the test context for testing the application.

Closes gh-46
2021-05-31 21:35:54 +02:00
Rossen Stoyanchev
56917d8d83 ThreadLocal context propagation for DataFetcher's
The WebMvc starter now supports propagation of ThreadLocal values
extracted at the level of the HTTP handler.

Closes gh-53
2021-05-28 19:32:48 +01:00
Rossen Stoyanchev
484fb932ef Replace QL with Ql for consistency with Spring naming 2021-05-14 21:32:54 +01:00
Brian Clozel
f70e552c6a Change default schema location to /graphql/schema.graphqls
This commit changes the default location for the GraphQL schema from
`classpath:schema.graphqls` to `classpath:/graphql/schema.graphqls`.

We're also adding `.graphqlconfig` files that are leveraged by a GraphQL
JS plugin in IntelliJ IDEA.

Closes gh-44
2021-05-11 15:52:58 +02:00
Brian Clozel
2d97e326e2 Add schema printer endpoint
This commit auto-configures a web endpoint that prints the GraphQL
schema of the application.

Closes gh-13
2021-05-11 11:54:17 +02:00
Rossen Stoyanchev
00b01ee524 Rename package for GraphQLTester 2021-04-26 21:59:52 +01:00
Rossen Stoyanchev
0d52bfc207 Update samples to use GraphQLTester
See gh-43
2021-04-15 13:01:19 +01:00
Rossen Stoyanchev
3843e83d43 Add tests to webmvc-http sample 2021-03-11 17:13:25 +00:00
Andreas Marek
5ccacd1bb4 use the more idiomatic Query type instead QueryType 2021-01-18 21:35:36 +00:00
Brian Clozel
633ee1a1b5 Refactor project structure
This commit refactors the project structure to regroup GraphQL web
support under the spring-graphql-web module, and move all the Spring
Boot support classes under a single graphql-spring-boot-starter one.

Right now, the starter module contains everything: classes for MVC,
WebFlux and Actuator support as well as required dependencies. We will
change that in the future.
2021-01-05 16:35:34 +01:00
Rossen Stoyanchev
35c2068bdf Rename webmvc-http-endpoint to webmvc-http 2021-01-03 21:40:23 +00:00