Commit Graph

49 Commits

Author SHA1 Message Date
Rossen Stoyanchev
bbf152a32f Deserialize errorType from extensions
The errorType field on GraphQLError is specific to GraphQL Java and when
serialized via GraphqlErrorHelper#toSpecification it becomes an
extension with the key "classification".

This commit ensures that we correctly deserialize back to errorType from
the "classification" extension but unfortunately that's limited to the
ErrorClassification enums that we know of.
2021-06-29 14:53:50 +01:00
Rob Winch
dfebb6f53d webmvc-http-security uses WebGraphQlTester
Issue gh-58
2021-06-28 15:40:45 -05:00
Rob Winch
7d854dbf47 Add webmvc-http-security
Closes gh-58
2021-06-28 14:17:16 -05:00
Rossen Stoyanchev
4a6c718394 WebGraphQlTester supports HTTP header input
Closes gh-64
2021-06-26 17:48:30 +01:00
Rossen Stoyanchev
ed767d1a70 Polishing webflux-security 2021-06-26 05:16:45 +01:00
Rossen Stoyanchev
de234c94c4 Decouple GraphQlTester from Web details
Closes gh-65
2021-06-26 05:16:35 +01: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
Rob Winch
52572c91b0 SecurityDataFetcherExceptionResolver.setAuthenticationTrustResolver 2021-06-22 15:33:04 -05:00
Rob Winch
4aed51438a SecurityDataFetcherExceptionResolver handles AuthenticationException
This is unlikely to happen as authentication happens prior to reaching
the GraphQL APIs. However, a user may decide to implement security within
GraphQL as it is possible to do through a Spring Controller.
2021-06-22 15:32:38 -05:00
Rossen Stoyanchev
43f9e34c81 Turn off auto-formatting where it reduces readability 2021-06-15 14:01:52 +01:00
Rob Winch
b276a39902 Add SecurityDataFetcherExceptionResolver 2021-06-09 08:54:52 -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
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
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
00b01ee524 Rename package for GraphQLTester 2021-04-26 21:59:52 +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
0d52bfc207 Update samples to use GraphQLTester
See gh-43
2021-04-15 13:01:19 +01:00
Rossen Stoyanchev
645cf21f17 Update dependencies 2021-04-14 21:24:04 +01:00
Rossen Stoyanchev
3843e83d43 Add tests to webmvc-http sample 2021-03-11 17:13:25 +00:00
Josh Long
d4fc091a43 Update SampleWiring.java
I think you meant to say 'ciao'
2021-02-17 00:43:00 -08:00
Rossen Stoyanchev
4e735f1ca8 Allow HTTP GET and WebSocket to use the same path
Closes gh-30
2021-02-05 21:07:27 +00:00
Brian Clozel
36121f338f Enable WebSocket endpoint with config property
Prior to this commit, the WebSocket endpoint (MVC or WebFlux) would be
enabled by default. In the case of MVC, the presence of
`spring-websocket` and the required dependencies was an additional hint
that could enable/disable this support depending on the application.

This commit changes the websocket path configuration so that it doesn't
hold a default value anymore. Configuring this property will trigger the
WebSocket support.

Right now developers cannot configure it to be the same as the
`spring.graphql.path`, but this will be solved in #30.

This commit also revisits the configuration properties namespace for
clarity, moving the websocket bits under their own section.

Closes gh-31
2021-02-02 15:27:00 +01:00
Andreas Marek
19f2693bdf schema is not needed if the top level types are named Query/Mutation/Subscription 2021-01-19 07:36:59 +00:00
Andreas Marek
5ccacd1bb4 use the more idiomatic Query type instead QueryType 2021-01-18 21:35:36 +00:00
Andreas Marek
edcd801c8c id is not required on every message (notably init) 2021-01-17 09:38:40 +11: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
Rossen Stoyanchev
2e32a06a55 Update to latest GraphQL over WebSocket protocol 2021-01-03 21:40:19 +00:00
Rossen Stoyanchev
eda2bd3f33 Rename graphql-sample to webmvc-http-endpoint 2021-01-03 21:37:43 +00:00
Rossen Stoyanchev
099733c1f0 Create top-level samples directory 2021-01-03 21:37:26 +00:00