Commit Graph

140 Commits

Author SHA1 Message Date
Brian Clozel
fc3a6403cb Configure Spring JavaFormat in Gradle build
This commit creates a new build convention that applies the Spring
JavaFormat Gradle plugin.
This is also adding a default checkstyle configuration for this project.

See gh-54
2021-06-02 14:29:59 +02:00
Rossen Stoyanchev
266a2ddcda Refactor GraphQlWebSocketHandler tests 2021-06-01 10:37:48 +01:00
Rossen Stoyanchev
ad8242e5e1 Add WebGraphQlHandler tests
See gh-53
2021-06-01 10:37:17 +01:00
Rossen Stoyanchev
1a1007ba59 Refactor WebInterceptor tests 2021-05-31 21:50:44 +01:00
Brian Clozel
de369ceeb3 Switch to 1.0.0-SNAPSHOT version
This commit changes the current version from 0.1.0 to 1.0.0 SNAPSHOT in
order to reflect the milestone changes that were done on the project.
2021-05-31 21:42:50 +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
ca18d03244 Add builder for WebGraphQlHandler
To allow adding more options when creating a WebGraphQlHandler.

See gh-53
2021-05-28 19:32:28 +01:00
Rossen Stoyanchev
eb88697b83 Polishing 2021-05-21 15:34:58 +01:00
Rossen Stoyanchev
cd8f4b672f Fix NPE on errors without a path
Errors that originate from GraphQL itself don't seem to have a path.
2021-05-21 15:34:58 +01:00
Rossen Stoyanchev
24bf029b02 Replace custom WebSocket handler mapping logic
Closes gh-35
2021-05-21 15:03:37 +01:00
Rossen Stoyanchev
a438d81404 Reactive return type for DataFetcherExceptionResolver
Closes gh-52
2021-05-19 15:35:30 +01:00
Rossen Stoyanchev
827c188f63 Extract ContextManager from ReactorDataFetcherAdapter
This change separates the Reactor ContextView propagation into an
independent utility class to enable internal re-use.

See gh-52
2021-05-19 15:35:30 +01:00
Brian Clozel
5d4c08a30b Upgrade to Gradle 7.0.2 2021-05-18 17:53:08 +02:00
Rossen Stoyanchev
484fb932ef Replace QL with Ql for consistency with Spring naming 2021-05-14 21:32:54 +01:00
Rossen Stoyanchev
731417eb3f Unwrap CompletionException
See gh-51
2021-05-14 20:50:10 +01:00
Rossen Stoyanchev
20b8a664bd Move DataFetcherExceptionResolver to execution
DataFetcherExceptionResolver and ErrorType are better in the
execution package next to where they're used.
2021-05-14 18:29:43 +01:00
Rossen Stoyanchev
1a4ef20f8a Add actual Javadoc to package-info 2021-05-14 16:26:01 +01:00
Rossen Stoyanchev
b1a4016132 Rename support package to execution
The package contains classes to help configure and invoke graphql.GraphQL
both of which are request execution.
2021-05-14 10:45:36 +01:00
Rossen Stoyanchev
3792de375a Add DataFetcherExceptionResolver mechanism
- Support for one or more DataFetcherExceptionResolver beans
- ErrorType enum with common error categories
- Default handling of unresolved exceptions as ErrorType.INTERNAL_ERROR

Closes gh-51
2021-05-14 10:15:19 +01:00
Rossen Stoyanchev
de8e2540b7 Polishing tests 2021-05-14 06:56:53 +01:00
Rossen Stoyanchev
44a034ef3d Refine use of "query" in type and method names
Following revisions in the spec
https://github.com/graphql/graphql-spec/pull/777, this commit applies
similar changes to type and method names where feasible.

The chief exception for now is the use of "query" for request input
since that is what it is called in the JSON for GraphQL over HTTP.
2021-05-12 09:50:03 +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
Brian Clozel
ee51f26755 Revisit GraphQL metrics
Prior to this commit, we introduced a basic implementation for GraphQL
metrics with Spring GraphQL. The main problem was that we were tracking
the GraphQL queries themselves and those are good candidates for
tags cardinality explosion.

This commit revisits the metrics arrangement and introduces:

* `graphql.request` as the main metric; this tracks the execution of a
  single request (i.e. multiple queries)
* `graphql.datafetcher` for tracking data fetching operations.
* `graphql.error` for counting errors.

Closes gh-19
2021-05-10 10:41:57 +02:00
Rossen Stoyanchev
f93c46eee3 WebInterceptor contract revision
WebInterceptor now uses delegation, forming a chain of interceptors
followed by a GraphQLService at the end to invoke graphql.GraphQL.

Closes gh-49
2021-04-30 21:26:26 +01:00
Rossen Stoyanchev
e5a92a310d Introduce GraphQLSource
A pluggable abstraction to encapsulate the way GraphQL is initialized and
the way it is sourced at runtime.

Closes gh-48
2021-04-28 18:53:04 +01:00
Brian Clozel
f3d941c0f4 Do not ignore ci paths in main git repo
Looking at paths under ci/* is now required to build the main CI image.
2021-04-28 10:54:22 +02:00
Brian Clozel
e7ff369ded Rename master branch to main 2021-04-28 10:39:30 +02:00
Brian Clozel
e25a8ba485 Update CI pipeline to use registry-image
This prevents docker rate-limiting issues.
2021-04-28 10:25:35 +02:00
Rossen Stoyanchev
00b01ee524 Rename package for GraphQLTester 2021-04-26 21:59:52 +01:00
Rossen Stoyanchev
b6cc9e4dd5 Remove spring-graphql-core module
Move its contents into the spring-graphql module.
2021-04-26 21:55:30 +01:00
Rossen Stoyanchev
403019521c Rename spring-graphql-web to spring-graphql
Re-purpose spring-graphql-web to be more general than just web and add
org.springframework.web as a top-level package for web support.
2021-04-26 21:42:36 +01:00
Rossen Stoyanchev
1e619263d2 Reactor DataFetcher support
Closes gh-47
2021-04-26 10:03:53 +01:00
Rossen Stoyanchev
a57b78e521 Improve GraphQLTester error checking API
This commit introduces a dedicated ErrorSpec with the option to filter
out expected errors through Predicates.
2021-04-20 11:08:01 +01:00
Rossen Stoyanchev
da597bdcbd Merge GraphQL test support
Closes gh-43
2021-04-15 13:04:29 +01:00
Rossen Stoyanchev
0d52bfc207 Update samples to use GraphQLTester
See gh-43
2021-04-15 13:01:19 +01:00
Rossen Stoyanchev
efb72c7d13 Add tests for GraphQLTester
See gh-43
2021-04-15 13:00:52 +01:00
Rossen Stoyanchev
e22d3e8ea4 Add GraphQLTester
See gh-43
2021-04-15 13:00:20 +01:00
Rossen Stoyanchev
645cf21f17 Update dependencies 2021-04-14 21:24:04 +01:00
Rossen Stoyanchev
b35e5f8c2f WebOutput minor updates
Rename "headers" to "responseHeaders" and clarify those work for HTTP
request queries but not for queries over a WebSocket session.

Update getter for response headers to return a read-only wrapper.

Provide only one public constructor without headers.

See gh-42
2021-04-09 13:05:40 +01:00
Rossen Stoyanchev
ddf107f8b1 WebInput minor refactoring
Use getters so the base RequestInput is usable for JSON serialization,
e.g. for the testing support.

Remove WebSocketMessageInput which only had an extra requestId and
add that to WebInput instead.

See gh-42
2021-04-09 13:05:40 +01:00
Rossen Stoyanchev
4a18932941 Revise GraphQLRequestHandler
Rename to GraphQLService to make it more clear it is a layer below
the specific transport such as HTTP endpoints.

Add WebGraphQLService sub-interface for query execution in web
environment with a WebInterceptor chain.

See gh-42
2021-04-09 08:43:57 +01:00
Rossen Stoyanchev
0338607a9b Parameterize GraphQLRequestHandler
This makes the contract more general and applicable to any GraphQL
request, not necessary coupled to HTTP.

Closes gh-42
2021-04-08 20:37:01 +01:00
Rossen Stoyanchev
b378231d39 Add GraphQLRequestHandler
See gh-42
2021-04-08 20:37:01 +01:00
Rossen Stoyanchev
9ceaaf5684 Polishing contribution
Closes gh-37
2021-04-07 14:23:35 +01:00
Andreas Marek
b6f79f212d Only build GraphQL once
See gh-37
2021-04-07 14:23:35 +01:00
Rossen Stoyanchev
3843e83d43 Add tests to webmvc-http sample 2021-03-11 17:13:25 +00:00
Brian Clozel
b48cacb10a Build projects with JDK8 target
Closes gh-36
2021-03-05 15:31:21 +01:00
Brian Clozel
b18df6208f Merge pull request #34 from joshlong/patch-1
Update SampleWiring.java
2021-02-17 10:38:54 +01:00