Commit Graph

913 Commits

Author SHA1 Message Date
rstoyanchev
2d071a42ee AutoRegistrationRuntimeWiringConfigurer refactoring 2023-03-31 12:09:37 +01:00
rstoyanchev
3ebdce0f7a Pagination test refactoring 2023-03-30 19:17:35 +01:00
rstoyanchev
911b78237c Querydsl and QBE nest into single argument input type
Closes gh-216
2023-03-23 18:29:57 +00:00
Brian Clozel
4ae21a8b5a Upgrade build to Gradle 8.0.2 2023-03-21 17:47:04 +01:00
rstoyanchev
1a24e31f0f Polishing documentation
See gh-620
2023-03-21 16:09:42 +00:00
rstoyanchev
ee493ef911 Polishing documentation
See gh-620
2023-03-21 13:58:09 +00:00
rstoyanchev
4f873a31eb Add documentation for pagination
Closes gh-620
2023-03-21 12:13:49 +00:00
rstoyanchev
627d4f43fa CursorStrategy is now also detected as a bean
See gh-620
2023-03-21 12:13:49 +00:00
Brian Clozel
fd46e0d75a Upgrade to Spring Security 6.1.0-M2
Closes gh-651
2023-03-20 20:03:07 +01:00
Brian Clozel
f012a460ae Upgrade dependencies
This commit upgrades mandatory and optional dependencies:

* Spring Data 2023.0.0-M3
* Micrometer 1.11.0-M2
* Micrometer Tracing 1.11.0-M2
* Kotlin 1.8.10

Closes gh-648
Closes gh-649
Closes gh-650
Closes gh-652
2023-03-20 18:40:54 +01:00
Brian Clozel
c829053455 Merge branch '1.1.x' 2023-03-20 18:25:44 +01:00
Brian Clozel
d28d9091d7 Upgrade dependencies
This commit upgrades mandatory and optional dependencies:

* Spring Framework 6.0.7
* GraphQL Java 19.3
* Reactor 2022.0.5
* Micrometer 1.10.5
* Micrometer Tracing 1.0.3
* Spring Data 2022.0.3
* Spring Security 6.0.2

Closes gh-641
Closes gh-642
Closes gh-643
Closes gh-644
Closes gh-645
Closes gh-646
Closes gh-647
2023-03-20 18:20:43 +01:00
rstoyanchev
08ac776ba9 Add ConnectionTypeConfigurer
See gh-620
2023-03-20 17:17:53 +00:00
rstoyanchev
e0bb96b9bd Minor refactoring
See gh-620
2023-03-20 10:45:50 +00:00
rstoyanchev
da00c8beaa Support Optional<Sort> method argument
See gh-620
2023-03-20 07:02:10 +00:00
rstoyanchev
9c53c59d23 Refactor SortStrategy
For a completely generic SortStrategy we can't provide any concrete
support we know neither the input structure nor the Object structure.
At best, a nearly empty argument resolver, which is not any better
than providing your own custom argument resolver.

Hence, SortStrategy is now explicitly based on Spring Data's Sort,
which enables us to provide concrete support with a base class.

See gh-620
2023-03-19 16:15:16 +00:00
rstoyanchev
a0af83de24 Rename PaginationRequest and ScrollRequest
...to Subrange and ScrollSubrange

See gh-620
2023-03-19 14:43:56 +00:00
rstoyanchev
d017506d43 Pagination test with controller method
See gh-620
2023-03-17 21:46:35 +00:00
rstoyanchev
6630ca0701 Polishing
See gh-620
2023-03-17 17:21:00 +00:00
rstoyanchev
104eccb4d9 Support for pagination
ConnectionTypeVisitor to decorate DataFetchers for Connection fields
in order to adapt Window, Slice, and others to Connection.

A ScrollRequest controller method argument to inject the ScrollPosition
and the number of elements requested.

SortStrategy for an application to customize how to extract sort
details from GraphQL arguments.

See gh-620
2023-03-17 16:50:32 +00:00
rstoyanchev
65a0cee19a Merge branch '1.1.x' 2023-03-14 09:11:50 +00:00
rstoyanchev
7fc4df74a6 Add request attributes to WebGraphQlRequest
Closes gh-633
2023-03-14 08:17:02 +00:00
rstoyanchev
6dba688cec Annotated exception handlers yield correctly
Closes gh-160
2023-03-14 07:15:54 +00:00
rstoyanchev
698713ab34 Merge branch '1.1.x' 2023-03-10 16:05:46 +00:00
rstoyanchev
038250e23d Rename method for adding custom argument resolvers
See gh-603
2023-03-10 16:05:31 +00:00
rstoyanchev
66b3c82280 Add cookies to WebGraphQlRequest
Closes gh-626
2023-03-10 16:04:40 +00:00
Brian Clozel
052b1f09b7 Refactor schema mapping inspection support
Because performing the schema mapping inspection on the
`TypeDefinitionRegistry` could be too early in the process, this commit
uses instead the `GraphQLSchema` instance directly for the inspection.
Other extension points could indeed contribute more to the schema before
it's fully built.

As for querying for DataFetcher instances, the inspector keeps using the
`RuntimeWiring` instance right after Spring for GraphQL contributed to
it. After that, data fetchers could wrapped by other extensions,
preventing it from getting the type information we need.

This also moves the `TypedDataFetcher` interface to a different package
to prevent a package tangle, and renamed as `SelfDescribingDataFetcher`
to enable further extension and to be more descriptive.

This changes the report format to keep it on a single line.

Closes gh-386
2023-03-10 16:15:23 +01:00
Brian Clozel
998d1881cc Add schema inspection support on startup
Prior to this commit, a Spring for GraphQL application could be started
with a schema and an incomplete set of data fetchers, as the schema
would describe:
* Queries/Mutations/Subscriptions that are not backed by any
  `@Controller` method, any Spring Data repository nor any custom
  `DataFetcher`
* type fields that are not backed by any Java Type property nor any
  registered `DataFetcher`

This problem can be noticed at runtime when a request is sent to the
API. The response can contain a `null` field where data was expected, or
even a GraphQL error because the field was non nullable.
This often happens during development time while developers are
implementing the schema.

This commit adds a new `SchemaInspector` type that visits the GraphQL
schema during the startup phase and looks into the `RuntimeWiring` for
registered `DataFetcher` instances. Because data fetchers can be simple
lambdas and do not require to expose a concrete return type, this also
introduces a new `TypedDataFetcher` interface that returns a
`ResolvableType`. This type is only declared by the data fetcher
implementation, but does not necessarily reflects the concrete type
of the returned instances.
This inspection is best effort and has known limitations, such as Union
types (those will not be inspected). Because of those, the inspection
will not fail the application startup.

The `SchemaInspector` collects all missing fields into a report and its
output is logged at startup at the INFO level. As a first step, the
inspector is package private and is only used by the
`DefaultSchemaResourceGraphQlSourceBuilder`. The inspection cannot be
disabled nor customized. We can expand this feature in future releases
as the team collects feedback from the community.

Closes gh-386
2023-03-09 17:57:56 +01:00
rstoyanchev
0f9581d99c Support custom controller method argument resolvers
Closes gh-603
2023-03-09 13:32:42 +00:00
rstoyanchev
f23784234a Polishing 2023-03-09 13:04:43 +00:00
rstoyanchev
287dab03e7 Merge branch '1.1.x' 2023-03-08 13:32:31 +00:00
rstoyanchev
2e229fec26 Polishing contribution
Closes gh-604
2023-03-08 13:31:12 +00:00
Koen Punt
345052381d Fix issue returning CompletableFuture
See gh-604
2023-03-08 13:28:05 +00:00
rstoyanchev
e268e5e288 Merge branch '1.1.x' 2023-03-06 20:31:36 +00:00
rstoyanchev
581b1108f2 Ensure resolved bean instance is used for validation
Closes gh-624
2023-03-06 20:30:56 +00:00
rstoyanchev
3b1c9c0957 Update reference docs for annotated exception handlers
Closes gh-160
2023-03-06 12:52:00 +00:00
rstoyanchev
da29846e90 Support annotated exception handler methods
See gh-160
2023-03-03 17:12:50 +00:00
rstoyanchev
610a658f49 Polishing 2023-03-03 12:09:25 +00:00
rstoyanchev
d292ffdc7f Merge branch '1.1.x' 2023-03-02 12:18:56 +00:00
rstoyanchev
3b100c6047 Update Java version in .sdkmanrc
Closes gh-622
2023-03-02 12:18:07 +00:00
Tim te Beek
27f0f64c81 Use SpringJunitConfig in tests
Co-authored-by: Moderne <team@moderne.io>

See gh-622
2023-03-02 12:18:07 +00:00
rstoyanchev
7732c218db Update Java version in .sdkmanrc
Closes gh-622
2023-03-02 12:15:08 +00:00
Tim te Beek
b725a8226d Use SpringJunitConfig in tests
Co-authored-by: Moderne <team@moderne.io>

See gh-622
2023-03-02 12:13:48 +00:00
rstoyanchev
20d52a60b6 Support auto-generation of Relay Connection type
Closes gh-619
2023-02-23 11:41:26 +00:00
Spring Builds
707bc36d6b Next development version (v1.1.3-SNAPSHOT) 2023-02-21 10:52:10 +00:00
Brian Clozel
f3c7303737 Merge branch '1.1.x' 2023-02-21 11:43:03 +01:00
Brian Clozel
312446ffa2 Upgrade to Spring Data 2022.0.2
Closes gh-617
2023-02-21 11:41:56 +01:00
Brian Clozel
0e358393cb Upgrade to Reactor 2022.0.3
Closes gh-616
2023-02-21 11:41:26 +01:00
Brian Clozel
a959e749fe Upgrade to Spring Framework 6.0.5
Closes gh-618
2023-02-21 11:40:52 +01:00
rstoyanchev
7ce33fb6ab Merge branch '1.1.x' 2023-02-20 18:22:54 +00:00