This is a temporary workaround to fix off-by-1 misalignment with
Spring Data, which uses 1-based offset values. Once the changes
in Spring Data become clear, we'll also adjust accordingly.
Closes gh-925
The presence of either "after" or "first" leads to forward pagination.
Else if either "before" or "last" leads to backward pagination.
Fall back on forward if none are provided at all.
In addition, a small adjustment to backward pagination. If a count
is not provided, use 1 rather than 0, to advance to previous item.
Closes gh-929
Prior to this commit, the `GraphQlObservationInstrumentation` would
always assume that local context instances are of type `GraphQLContext`.
This means that a custom context type would be overwritten with a
`GraphQLContext` that contains the current observation.
Instead, this commit ensures that a local context is contributed only if
none was present, or that we wrap the existing one only if it is a
`GraphQLContext` in the first place. If the parent data fetcher
contributes a custom context, the current observation will not be added.
Fixes gh-918
The QueryDsl and QBE data fetcher builders now accept a default count
and a function for a default position with awareness of the scroll
direction.
Closes gh-917
Both forward and backward scrolling needed adjustment.
For forward, we were not advancing by 1.
For backward, we were advancing by the count and 1 more than necessary.
Closes gh-916
Prior to this commit, the `ControllerAdvice` support would detect all
beans and exception handler methods, to put them in an ordered `TreeMap`
using the `OrderComparator.INSTANCE`. Doing so would naturally consider
beans with the same order as duplicates and would write a single entry
in the map. This effectively ignored many `ControllerAdvice` beans with
the same order (but one).
This commit removes the use of a `TreeMap` and instead uses a
`LinkedHashMap` and the insertion order for proper ordering.
Fixes gh-901
The defaults are now applied before the call to ScrollSubrange#create.
After is too late given that for offset positions, the direction may
switch from backward to forward.
Closes gh-900
Builder implementations are intended to be package private and exposed
through interface methods, but the abstract class needs to be public
for alternative implementations.
Prior to this commit, return types declared by controller handlers that
were wrapped with `Optional` were not considered during the schema
analysis and would result in false positives in the schema inspection
report, stating that relevant fields were unmapped.
This is especially relevant for controller handlers returning optional
values from Spring Data repositories.
This commit ensures that `java.util.Optional` types are unwrapped and
that wrapped types are considered during the analysis.
Fixes gh-875
Prior to this commit, the `ConnectionFieldTypeVisitor` would return
`TraversalControl.ABORT` when a field with a parent Subscription type is
encountered. This is done because this visitor should not consider
fields under Subscription types as they are not candidates for
pagination. This would also completely abort the visiting of all fields
under Subscription types, for all other visitors. As a result, this
prevents the decoration of data fetchers by the `ContextTypeVisitor` and
leads to missing context information (security or observability).
This only applies to 21.x GraphQL Java versions, as a bug was hiding
this behavior in previous versions.
This commit ensures that the `ConnectionFieldTypeVisitor` ignores fields
located under Subscription operations but always return
`TraversalControl.CONTINUE` to not completely ignore this part of the
schema.
Fixes gh-861