Commit Graph

817 Commits

Author SHA1 Message Date
rstoyanchev
089c754c73 Improve explanation of custom scalars vs Jackson
See gh-569
2022-12-09 16:20:49 +00:00
Brian Clozel
d1300f56bf Add reachability metadata for GraphQL client resources
This commit adds reachability metadata for resources loaded by the
`GraphQlClient` and `GraphQlTester` when using the `document("name")`
API variant. This method loads the query file from the classpath at
particular locations, namely `"classpath:graphql-documents/"` and
`"classpath:graphql-test/"` with the `".graphql"` and `".gql"` file
extensions.

This commit adds the relevant resource metadata so that such resources
are loaded in the GraalVM native image at build time when the client or
the tester are reachable through the static analysis.

Fixes gh-575
2022-12-09 15:15:37 +01:00
Brian Clozel
5f1ca8cda3 Add reachability metadata for RSocket client
Prior to this commit, using the RSocket client in a native image would
fail when setting up the codecs, if the chosen transport was WebSocket.
This is due to the fact that the `GraphQlWebSocketMessage` type was not
registered for reflection and the proper codec could not be detected as
a result.

This commit adds reflection metadata for this type.

Fixes gh-574
2022-12-09 15:13:12 +01:00
Brian Clozel
0362bdf100 Log schema resources during application startup
This commit logs the number of schema resources that were loaded to
create the GraphQL schema, at the INFO level. If DEBUG is enabled for
this package, the description of all schema resources will be logged as
well.

Closes gh-566
2022-12-08 17:06:43 +01:00
rstoyanchev
0bd30582e5 Add factory method for DataFetcherExceptionHandler
Closes gh-552
2022-12-08 14:43:41 +00:00
rstoyanchev
75d5d4b33a Allow binding raw map to Map<String,?>
Closes gh-554
2022-12-08 14:43:41 +00:00
Brian Clozel
c16521c907 Move interception code snippets to Java classes
This commit starts movint code snippets from the reference documentation
to actual Java classes so that they're compiled and checked at build
time.
2022-12-06 17:07:43 +01:00
Brian Clozel
3d1f3b2fe9 Upgrade to Spring asciidoctor backends 0.0.3
This commit also applies dependency management and dependencies
to the spring-graphql-docs module for compiling code snippets.
2022-12-06 17:07:43 +01:00
Brian Clozel
6029e45825 Reflect media type changes in reference documentation
This commit mentions the `"application/graphql-response+json`" media
type in the reference documentation as the main media type used by the
server.

See gh-563
2022-12-06 17:07:43 +01:00
Brian Clozel
70afadc04a Rewrite anchors in reference documentation
This commit ensures that all anchors in the reference documentation
follow a `"section.sub.title"`-like pattern to better align with the
spring-asciidoctor-backends best practices. This will allow an easier
integration with code snippets.

All rewritten anchors are listed in the anchor-rewrite.properties file
for automatic redirection.
2022-12-06 17:07:40 +01:00
Brian Clozel
0458f15ddd Move deployment repository config to a Gradle convention
This commit moves the configuration of a local Maven deployment
repository in a dedicated Gradle convention and applies it to all
sub-projects. This separates the publishing configuration for actual
project modules (that are meant to be published on Maven Central) from
the infrastructure sub-projects such as the documentation one.
2022-12-06 17:05:50 +01:00
rstoyanchev
c43c0bec2e Polishing
Closes gh-559
2022-12-06 15:39:35 +00:00
Mark Paluch
ca0d0b46f9 Add builder customizers for Querydsl and QBE DataFetcher
We now provide Builder customizers to customize DataFetchers
created out of Querydsl and Query by Example repositories
by letting repositories implement customizer interfaces.

See gh-559
2022-12-06 15:39:35 +00:00
Brian Clozel
573e89987f Adapt to GraphQL over HTTP spec changes
As of graphql/graphql-over-http#215, the official media type for GraphQL
HTTP responses is now `"application/graphql-response+json"` instead of
`"application/graphql+json"`. The latter is now deprecated and support
will be removed in the future.

This commit now favors the new media type.
HTTP Clients are still supposed to send requests with the
`"application/json"` content type.

Closes gh-563
2022-12-05 14:47:51 +01:00
Brian Clozel
eb9b1f308d Add reflection hint for GraphQlWebSocketMessage
Prior to this commit, GraphQL applications using the WebSocket transport
would fail with an `java.lang.IllegalArgumentException: No JSON Encoder`
as the JSON codec was reflecting on the `GraphQlWebSocketMessage` to
check that it can handle this type, during startup time.

`GraphQlWebSocketMessage` is the message type being used for sending and
receiving GraphQL requests. This commit registers binding reflection on
this type as soon as a `GraphQlWebSocketHandler` (mvc or webflux) is
registered as a bean in the application.

This type is also used on the client side in the client
`WebSocketGraphQlTransport`. Because clients cannot be reliably detected
here in the application context or via classpath checks, this commit
also adds a JSON metadata file that adds reflection on the type, if and
only if the `WebSocketGraphQlTransport` is reachable by the static
analysis performed by GraalVM.

Fixes gh-560
2022-12-02 15:32:21 +01:00
Brian Clozel
a43c92854f Fix NullPointerException in Tracing support
Prior to this commit, using the tracing support could result in an
NullPointerException since the instrumentation expected the tracing
propagation information to be always available from the request
extensions.

This commit improves the strategy for extracing the inbound propagation
information.

First, the instrumentation now looks up the propagation information in
the GraphQL context first, then in the request extensions as a fallback.
We ensure that no NPE can be raised if the information is missing.
Some clients might change the propagation information in the request
extensions, but in the HTTP world, most clients will send those as HTTP
headers. We are adding a new `PropagationWebGraphQlInterceptor` that can
be configured on the application to copy the relevant HTTP headers from
the HTTP request to the GraphQL context. For other transports, we
currently advise the request extensions - both WebSocket and RSocket
multiplex over the same transport message, making this approach
impossible.

Fixes gh-547
2022-12-02 09:05:23 +01:00
Brian Clozel
5b4eb8cb73 Align observation convention with Micrometer best practices
This commit ensures that the contextual names of the observations all
start with `"graphql"` (lowercase) and that all key values are prefixed
with `"graphql.*"` for a cleaner namespace.

Fixes gh-558
2022-12-02 09:04:10 +01:00
Brian Clozel
5fe8123126 Upgrade to Micrometer 1.10.2
Closes gh-556
2022-12-01 17:43:24 +01:00
Brian Clozel
9165c25c25 Start building against Spring Framework 6.0.3 SNAPSHOTs
See gh-555
2022-12-01 17:41:31 +01:00
rstoyanchev
6958e39f5c Fix isOmitted to return true for omitted arguments
Closes gh-553
2022-12-01 12:54:15 +00:00
rstoyanchev
6119be935a Improve optional argument support for ProjectedPayload
This commit adds support for the ArgumentValue wrapper for passing null
when the argument is not present.

Closes gh-550
2022-12-01 12:53:04 +00:00
rstoyanchev
d8b3dad505 Polishing ProjectedPayloadMethodArgumentResolver
See gh-550
2022-12-01 11:38:47 +00:00
rstoyanchev
0baceda48c Remove samples from main
We no longer build the samples in the main branch due to dependency
issues between Boot starter dependencies and the project sources.
The samples really need to move out to an independent repository.
For now, this commit removes them from the main branch.

See gh-208
2022-11-24 11:06:45 +00:00
Spring Builds
2f27cc7c8e Next development version (v1.1.1-SNAPSHOT) 2022-11-22 11:10:35 +00:00
Brian Clozel
2de2c9fcea Upgrade to Reactor 2022.0.0
Closes gh-538
2022-11-22 11:09:05 +01:00
Brian Clozel
0dfe9e5706 Upgrade to Micrometer 1.10.1
Closes gh-539
2022-11-22 11:08:27 +01:00
Brian Clozel
2c2307abba Upgrade to Spring Data 2022.0.0
Closes gh-540
2022-11-22 11:07:50 +01:00
Brian Clozel
b3b1bca7b4 Upgrade to Spring Security 6.0.0
Closes gh-541
2022-11-22 11:07:28 +01:00
Brian Clozel
edc10144c5 Upgrade to Context Propagation 1.0.0
Closes gh-542
2022-11-22 11:06:55 +01:00
Brian Clozel
7894dd5dbe Upgrade to Spring Framework 6.0.0
This change aligns with the Jakarta API requirements in Spring
Framework.
This commit also upgrades optional dependencies with the latest compatible
versions.

Closes gh-543
2022-11-22 11:04:57 +01:00
Brian Clozel
ab6dde278c Merge branch '1.0.x' 2022-11-22 10:51:20 +01:00
Brian Clozel
99e9e6af85 Upgrade dependencies 2022-11-22 10:50:49 +01:00
rstoyanchev
78bdf306f9 Support schema transforming GraphQLTypeVisitor
Closes gh-536
2022-11-17 17:05:55 +00:00
rstoyanchev
1a3f0983e6 Merge branch '1.0.x' 2022-11-17 12:43:19 +00:00
Eric Fry
1427c7412f Fix typo in reference docs
Closes gh-530
2022-11-17 12:43:06 +00:00
rstoyanchev
f4485de73f Merge branch '1.0.x' 2022-11-17 11:57:22 +00:00
rstoyanchev
89a7145c03 Polishing contribution
Closes gh-367
2022-11-17 11:56:15 +00:00
kuraun
a927159410 Add mutationUpdateSalaryTest
Fixed the attribute value salary of UpdateSalaryInput of schema.graphqls
to the name of SalaryInput object. Also enabled @Secured.

See gh-367
2022-11-17 11:53:50 +00:00
rstoyanchev
34843f7399 Update reference to link to wiki for requirements 2022-11-16 11:39:22 +00:00
Brian Clozel
757d48255a Add AOT support for annotated Controllers
Prior to this commit, Spring for GraphQL would not support AOT and
GraalVM Native. Applications can perform reflection, load resources or
require JDK proxies at runtime and we need to contribute `RuntimeHints`
during the AOT phase.

This commit adds a new `BeanFactoryInitializationAotProcessor` component
that introspects GraphQL controllers and registers the relevant
reflection hints for binding on argument types and schema types.
This also registers JDK proxies for `@ProjectedPayload` support if
Spring Data Commons is present in the classpath.

Closes gh-495
2022-11-15 21:24:17 +01:00
rstoyanchev
fb636ad554 Support maxBatchSize via BatchMapping annotation
Closes gh-520
2022-11-14 17:13:03 +00:00
rstoyanchev
1eca67700f Support for default DataLoaderOptions
Closes gh-522
2022-11-09 15:52:41 +00:00
Brian Clozel
074817904a Add missing registry mirror vars in concourse tasks 2022-11-08 10:33:52 +01:00
rstoyanchev
ca90cedf3b Refine null handling in ClientResponseField#toEntity
closes gh-525
2022-11-04 13:53:52 +00:00
rstoyanchev
05939d5e7e Merge branch '1.0.x' 2022-11-04 13:50:57 +00:00
rstoyanchev
5905f02bd6 Deprecate ResponseField getError and hasValue
See gh-499
2022-11-04 11:01:58 +00:00
rstoyanchev
2dafd5dfc7 Merge branch '1.0.x' 2022-11-04 08:40:30 +00:00
Johan Wigert
6004937ad2 Fix typo in Javadoc of GraphQlTester
Closes gh-523
2022-11-04 07:24:34 +00:00
rstoyanchev
02f96b6bf4 Raise exception for any field error in retrieve
This commit aligns the behavior of retrieve with its Javadoc such that
any field error, including errors on nested fields, raises a
FieldAccessException

Closes gh-499
2022-11-04 06:36:15 +00:00
rstoyanchev
be9a21562c Polishing GraphQlArgumentBinder
See gh-349
2022-10-24 18:15:17 +01:00