Commit Graph

57 Commits

Author SHA1 Message Date
Brian Clozel
e290e426ee The CI image build should be completely non-interactive.
See gh-18
2020-11-13 13:09:07 +01:00
Brian Clozel
c78f05626a Add graphQL sample application
This commit adds a sample application to the repository.
This application should not be published as part of the build.

In this application, we're trying to showcase the various features and
use cases with our Spring graphQL integration. We're mixing here data
fetchers backed by datastores or remote hypermedia APIs.

Closes gh-15
2020-11-13 11:52:30 +01:00
Brian Clozel
f711dad1b6 Introduce GraphiQL integration
This commit adds a very simple graphiQL integration: we're shipping the
project with a sample graphiQL `index.html` page that's relying on CDNs
to display the explorer.
We're also plugging in that resource at the graphQL endpoint location,
responding to GET requests. This is not a problem since for now we're
only considering POST requests to the endpoint for actual queries.

Closes gh-12
2020-11-13 11:52:13 +01:00
Brian Clozel
ce8ac6fc54 Fix null variables in WebInput
The graphQL spec requires that the `variables` object should not be
null. Prior to this commit, the `Map#getOrDefault` call would not
prevent that since it returns the value associated with the key, if
defined, or the default value. In our case the key is defined but the
value is null.
2020-11-13 11:52:09 +01:00
Brian Clozel
96d26b4dec Polish 2020-11-13 11:52:04 +01:00
Brian Clozel
43ba3e8fcd Remove GraphQL web starters
The GraphQL Spring Boot starters aren't actually necessary.
The typical GraphQL usage is really tied to the type of web application
you're building: Spring MVC or WebFlux.

Adding the `spring-graphql-web` dependency to the classpath is a signal
strong enough that we can configure additional endpoints into the web
application.

Closes gh-17
2020-11-13 11:51:49 +01:00
Brian Clozel
59d75a948e Add initial Metrics support
This commit provides an initial instrumentation for metrics support
with micrometer. The graphQL `SimpleInstrumentation` is used to
intercept query execution and collect execution time as well as specific
tags.

The set and names of metrics and tags are temporary and we should refine
this infrastructure.

Closes gh-16
2020-11-13 11:51:33 +01:00
Brian Clozel
15de06d33a Add Concourse CI pipeline
This commit adds the Concourse CI pipeline configuration.
The CI build is hosted on https://ci.spring.io.

As an experimental project, artifacts are published for now using the
org.springframework.experimental groupId.

Closes gh-18
2020-11-13 11:51:14 +01:00
Brian Clozel
8a1bf9c388 Fix published POMs
This commit removes the dependencyManagement section from the published
POMs and aligns the starter dependencies with the official ones.
2020-11-13 11:51:09 +01:00
Brian Clozel
1ff1d354e0 Upgrade to Gradle 6.7 2020-11-13 11:50:59 +01:00
Brian Clozel
d7f3aa6fa9 Add Spring Milestone repository to build 2020-10-14 09:38:35 +02:00
Brian Clozel
18f44efe6d Rename and document GraphQL properties 2020-10-13 18:15:20 +02:00
Brian Clozel
22cdc3a28f Add missing package-info 2020-10-13 18:05:08 +02:00
Brian Clozel
95bfe2e318 Support programmatic GraphQLSchema creation
Prior to this commit, the `GraphQLAutoConfiguration` would only consider
the case where the GraphQL schema is read as an SDL from a configured
location.

GraphQL also supports the programmatic creation of the schema and this
case needs to be supported by the auto-configuration.

This commit updates the auto-configuration to disable the schema
creation from the SDL if a `GraphQL.Builder` bean is already contributed
by the application.

Fixes gh-4
2020-10-13 16:16:35 +02:00
Andreas Marek
d22d9c41a9 Restrict content to application json
Closes gh-8
2020-10-13 10:18:18 +02:00
Andreas Marek
d0324b8344 Make url configurable and set default to /graphql
Closes gh-9
2020-10-13 09:59:14 +02:00
Rossen Stoyanchev
7eafec25e3 Support for response headers through WebOutput
See gh-6
2020-10-07 21:36:34 +01:00
Rossen Stoyanchev
d4b9c4750d Polishing WebOutput
See gh-6
2020-10-07 21:13:20 +01:00
Rossen Stoyanchev
cf1e3ce0da Upgrade to Spring Boot 2.4 snapshots
in order to make use of a recent change for WebMvc.fn in
Spring Framework 5.3.

See gh-6
2020-10-07 20:13:34 +01:00
Rossen Stoyanchev
b5d4fe18ab Javadoc updates and rename WebInterceptorExecution 2020-09-28 11:18:42 +01:00
Rossen Stoyanchev
1f1ce72272 Add WebInterceptorExecution
Arguably a better way to encapsulate support for WebInterceptor vs a
base class, more testable, and reduced public API surface.
2020-09-18 22:25:00 +01:00
Rossen Stoyanchev
40a79ab71a Polishing 2020-09-18 17:44:21 +01:00
Rossen Stoyanchev
b0b10dd8d3 Add tests for bad input 2020-09-18 14:36:26 +01:00
Rossen Stoyanchev
6044017d31 Support for invocation of interceptors 2020-09-18 12:55:19 +01:00
Rossen Stoyanchev
e8a8334009 Updates to Interceptor contract 2020-09-18 11:37:40 +01:00
Rossen Stoyanchev
0e9afb392a Add license headers 2020-09-17 19:25:03 +01:00
Rossen Stoyanchev
aabe780e9a Consistent naming, simplified package structure 2020-09-17 18:52:35 +01:00
Rossen Stoyanchev
8dc56ceaa5 Refine input exception handling and validation 2020-09-17 18:52:35 +01:00
Rossen Stoyanchev
42464b6748 Minor refactoring and polishing
- Remove (unused) GraphQLResponseBody

- Collapse servlet and reactive packages and rename handlers to
  WebFluxGraphQLHandler and WebMvcGraphQLHandler.

- Minor refactoring and polishing in each handler also removing some
  protected methods that overlap in purpose.

- Rename GraphQLRequestBody to RequestInput and make it package private.
2020-09-16 21:10:30 +01:00
Brian Clozel
2693742b63 Add GraphQL web support
This commit removes the controller components and instead moves the web
support to specific auto-configurations.
This commit also adds tests for both web stacks.
2020-09-16 16:34:00 +02:00
Brian Clozel
9aff167527 Add basic support for core GraphQL auto-configuration 2020-09-16 16:22:42 +02:00
Brian Clozel
0d46a98f62 Create web stack-specific GraphQL handlers
Instead of trying to create a single handler for both reactive and
non-reactive implementations, this commit splits the implementations.
2020-09-16 16:16:13 +02:00
Brian Clozel
6040dce0c1 Update request/response GraphQL classes
This commit decouples the HTTP layer from the expected request and
response messages expected with GraphQL.
2020-09-16 16:14:15 +02:00
Brian Clozel
54ec20c510 Switch back interceptor to simple interface 2020-09-16 16:10:39 +02:00
Brian Clozel
1e61beb0a4 Remove auto-configurations from starter modules 2020-09-16 16:09:37 +02:00
Brian Clozel
39e22eb81a Move auto-configurations to web module
This commit adds the relevant dependencies to the web module so as to
move all auto-configurations to a single place. Starter modules will
only ship dependencies as a result.
2020-09-16 16:07:38 +02:00
Brian Clozel
3e2a601af0 Move auto-configuration classes to Spring Boot namespace 2020-09-15 14:10:35 +02:00
Brian Clozel
a44c836fc0 Merge modules
This commit merges the common, webmvc and webflux modules into a single
web module for supporting GraphQL with all Spring web frameworks.
We're working here with optional dependencies to build the support
for Spring MVC on one side and Spring WebFlux on the other.

Also, this commit updates the starter modules to adopt the official
naming convention. For now, starter modules will host both the
configuration infrastructure and the transitive dependencies to activate
support.
2020-09-15 14:10:35 +02:00
Brian Clozel
b39f12ed4e Refactor Gradle build
This commit refactors the Gradle build with the following:

* use of the dependency management plugin
* import the Spring Boot BOM for dependency management
* add support for publishing artifacts
2020-09-15 14:10:35 +02:00
Andreas Marek
5741e3f4bc refactoring 2020-09-15 03:32:48 +10:00
Andreas Marek
7bc8cea8ed add http headers for the response 2020-09-15 03:29:15 +10:00
Andreas Marek
a7cf5b6d55 pass params to interceptor 2020-09-15 03:14:26 +10:00
Andreas Marek
8238353f9a refactor to GraphQLHttpRequest and GraphQLHttpResponse and added params map 2020-09-15 03:09:27 +10:00
Andreas Marek
740a3f1f92 add non nullable package annotations
rename GraphQLResponseBody -> GraphQLResponse
2020-09-15 02:24:58 +10:00
Andreas Marek
59214d4c5b add default implementations for Interceptor 2020-09-15 02:15:37 +10:00
Andreas Marek
f2cf46989b Refactor webmvc to use the new Handler 2020-09-14 07:28:49 +10:00
Andreas Marek
a37aa740a9 introduce common GraphQLHandler which doesn't depend on either webflux or webmvc specifics.
Refactor webflux to use the new Handler
2020-09-14 07:13:21 +10:00
Andreas Marek
7edc2d9ce6 use configuration annotation 2020-08-25 06:34:33 +01:00
Andreas Marek
11d2ad74cf add webflux variant 2020-08-25 06:34:33 +01:00
Andreas Marek
ce3a83bc0e use assertJ 2020-08-25 06:34:33 +01:00