Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a GraphQLClient #10

Closed
hantsy opened this issue Oct 14, 2020 · 1 comment
Closed

Add a GraphQLClient #10

hantsy opened this issue Oct 14, 2020 · 1 comment
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@hantsy
Copy link
Contributor

hantsy commented Oct 14, 2020

Like RestTemplate, WebClient, WebSocketClient, RSocketRequestor, add a Client to simplify the Client/Server communications using GraphQL-based APIs.

@rstoyanchev rstoyanchev self-assigned this May 20, 2021
@rstoyanchev rstoyanchev added the type: enhancement A general enhancement label May 20, 2021
@rstoyanchev rstoyanchev modified the milestones: 0.1.0, 1.0 M1, 1.0 M2 May 20, 2021
@rstoyanchev rstoyanchev modified the milestones: 1.0.0-M2, 1.0.0-M3 Aug 11, 2021
@rstoyanchev rstoyanchev modified the milestones: 1.0.0-M3, 1.0.0-M4 Oct 7, 2021
@bclozel bclozel modified the milestones: 1.0.0-M4, 1.0.0-M5 Dec 2, 2021
@rstoyanchev rstoyanchev modified the milestones: 1.0.0-M5, 1.0 Backlog Jan 6, 2022
@rstoyanchev rstoyanchev modified the milestones: 1.0 Backlog, 1.0.0-M6 Jan 20, 2022
rstoyanchev added a commit that referenced this issue Feb 24, 2022
Allows some reuse between WebFlux and WebMVC and between client and server.

See gh-10
rstoyanchev added a commit that referenced this issue Feb 24, 2022
Provides support for WebSocket tests without a running server.

See gh-10
rstoyanchev added a commit that referenced this issue Feb 24, 2022
rstoyanchev added a commit that referenced this issue Mar 7, 2022
Add HttpGraphQlClient and WebSocketGraphQlClient extensions along with
a builder hierarchy that combines GraphQlClient and transport specific
configuration.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 7, 2022
Now that transport specific GraphQlClient extensions provide a unified
builder for GraphQlClient and transport configuration, the transports
become a private implementation detail.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 7, 2022
Add WebGraphQlClient as a common representation for a Web GraphQlClient
extension and its builders that has to be started through the HTTP or
WebSocket implementations.

Remove the common base builder for HTTP and WebSocket, with HTTP simply
delegating to the underlying WebClient builder For WebSocket, builder
state is exposed from the transport to simplify the mutation logic.

DefaultGraphQlClientBuilder is now abstract, leaving subclasses to
implement the build method.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 7, 2022
rstoyanchev added a commit that referenced this issue Mar 7, 2022
As these are expected to be used as local variables, "Spec" reduces
readability and the IDE creates variables called "spec", which
increases that effect. Given those are nested within `GraphQlClient`
and `GraphQlTester`, it makes sense to drop the spec part and local
variable names such as request and response make sense.

See gh-10, see gh-317
rstoyanchev added a commit that referenced this issue Mar 7, 2022
rstoyanchev added a commit that referenced this issue Mar 7, 2022
The JSON Encoder and Decoder implementations configured via
CodecConfigurer for HTTP and WebSocket are adapted to a JSONPath
MappingProvider and now automatically registered in JSONPath
configuration.

See gh-10, see gh-317
rstoyanchev added a commit that referenced this issue Mar 15, 2022
Replace the use of ExecutionResult on the client side where we are
dealing with a response map rather, and also incorporate it into the
server-side hierarchy where it wraps an ExecutionResult instead.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 15, 2022
Extends GraphQlResponse with a subtype that exposes further options to
handle data and errors in the response from a client perspective.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 15, 2022
Refine exception handling and ensure a hierarchy of exceptions that
allows differentiating between transport errors vs field errors while
accessing an invalid data or field.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 15, 2022
DefaultClientGraphQlResponse now parses the path to a field and creates
the same parsed representation as GraphQL Java does and uses for
GraphQLError paths. This makes it easier to correlate fields to field
errors and eliminates the need for a dependency on JSONPath in the
client.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 15, 2022
Provides a shortcut alternative to the execute methods, for decoding
a single field from the response.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 15, 2022
@rstoyanchev
Copy link
Contributor

There are some follow-up tasks like #332 that remain but the GraphQlClient work is now largely complete, the Boot starter has been updated, and documentation is available too.

rstoyanchev added a commit that referenced this issue Mar 17, 2022
getError now returns either the error at the field or on a parent
field, which provides a reliable answer for why a field failed even
for a field whose path is below where the error occurred.

getErrors likewise now also includes errors above. There is still no
need for special logic to get only errors below since where there is
a field value, errors are below anyway.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 17, 2022
hasValue is more meaningful because it means valid and with some value
that could be decoded, which in turn allows removing Nullable from
toEntity/List.

Or if there is no value, getError() can be used to differentiate
between a failed field vs a null field declared optional.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 18, 2022
If a field is null but without errors, i.e. declared optional in the
schema, it is more natural for toEntity to complete empty instead of
raising a FieldAccessException.

This aligns better with the execute method where handling the field
directly allows treating a null but valid field as optional.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 18, 2022
MapGraphQlResponse is a simple wrapper around the response map exposing
it as GraphQlResponse. It is now package private and made accessible
through a static factory method on GraphQlTransport.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 18, 2022
This allows exposing additional conveniences for inspecting errors.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 18, 2022
Add a String path representation making it easy to filter errors by
path using String comparison, and refine nullability.

Take advantage of the String error paths to simplify internal filtering
of error fields.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 18, 2022
Instead of a simple check, looking for an associated field error at or
above the field, this method now more focused on finding the reason for
a failure when the field has no value.

This allows performing a more thorough search including cases when the
field error is at, above, or even below (e.g. non-null nested field
that bubbled up), in the end falling back on request errors (e.g.
failed response without any field errors).

Also, rename ResponseField to GraphQlResponseField and move to a
top-level class.

See gh-10
rstoyanchev added a commit that referenced this issue Mar 18, 2022
GraphQlResponseField is now extracted as a super type at the top-level
package and is exposed from GraphQlResponse. ClientGraphQlResponseField
extends this to provide decoding options.

The change ensures consistency with both GraphQlResponseField and
GraphQlResponseError accessible through GraphQlResponse, also making
both available for client and server side handling.

See gh-10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants