Commit Graph

158 Commits

Author SHA1 Message Date
Rob Winch
0db7ee2be3 Merge pull request #55 from rwinch/webflux-security
Add WebFlux Security Sample
2021-06-08 14:31:34 -05:00
Rob Winch
17a56a1000 Use New Lamda Security Syntax 2021-06-02 17:05:52 -05:00
Rob Winch
d139e97cdb Rename to SampleApplication
Follow convention of other sample applications.
2021-06-02 16:41:35 -05:00
Rob Winch
9a61207f2d Remove DataFetchers
Follow the conventions of the other sample projects.
2021-06-02 16:40:55 -05:00
Rob Winch
16f2baa263 Format webflux-security 2021-06-02 16:36:10 -05:00
Rob Winch
96d25b2a91 employee-service -> webflux-security 2021-06-02 13:36:40 -05:00
Rob Winch
05098fd5d1 Update to Spring Boot 2.5.0 2021-06-02 13:29:22 -05:00
Rob Winch
d3a0fa1c4f schema.graphqls->/graphql/schema.graphqls 2021-06-02 11:31:44 -05:00
Rob Winch
9b4c053a30 invalidCredentials 2021-06-02 11:31:44 -05:00
Rob Winch
ca369ecc7c salaryDataFetcher returns Mono
We need the return type to be a Reactor type for the context to be
propagated.
2021-06-02 11:31:44 -05:00
Rob Winch
84b9b65777 Use headers instead of WithMockUser
This ensures that we don't get false positives when the Reactor return
types are not continuous.
2021-06-02 11:31:44 -05:00
Rob Winch
4b44f7a987 Use ADMIN role 2021-06-02 11:31:44 -05:00
Andreas Marek
2edc4c585a add employee service example 2021-06-02 11:31:44 -05:00
Brian Clozel
f8b2ad552f Refactor project build
This commit refactors the project build to better share dependency
management definitions between modules.

This also upgrades the project to Spring Boot 2.5.0.

Closes gh-45
2021-06-02 15:45:51 +02:00
Brian Clozel
53e2a379de Reformat sample applications
Fixes gh-54
2021-06-02 14:30:00 +02:00
Brian Clozel
39937679e3 Apply Spring JavaFormat to Spring GraphQL Test
See gh-54
2021-06-02 14:30:00 +02:00
Brian Clozel
d048c2e4fe Apply Spring JavaFormat to Spring GraphQL
See gh-54
2021-06-02 14:30:00 +02:00
Brian Clozel
f8b90b592d Apply Spring JavaFormat to Spring GraphQL Boot starter
This commit applies the build conventions to the Spring Boot GraphQL
starter module and fixes all formatting issues.

See gh-54
2021-06-02 14:30:00 +02:00
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