Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.Map;

import jakarta.json.JsonObject;
import com.fasterxml.jackson.databind.node.ObjectNode;

public interface Request {
String getDocument();
Expand All @@ -23,6 +23,6 @@ public interface Request {

String toJson();

JsonObject toJsonObject();
ObjectNode toJsonObject();

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
import java.util.List;
import java.util.Map;

import jakarta.json.JsonObject;
import jakarta.json.JsonValue;
import com.fasterxml.jackson.databind.node.ObjectNode;

public interface Response {

/**
* The 'data' object contained in the response.
* Can be JsonValue.NULL if the response contains an empty field, or `null` if the response
* does not contain this field at all.
* Can be null if the response does not contain this field at all or contains a null value.
*/
JsonObject getData();
ObjectNode getData();

/**
* List of errors contained in this response.
Expand All @@ -23,7 +21,7 @@ public interface Response {
/**
* List of user-made extensions contained in this response.
*/
JsonObject getExtensions();
ObjectNode getExtensions();

/**
* Transform the contents of the `rootField` from this response into a list of objects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import java.util.Map;
import java.util.Objects;

import jakarta.json.JsonObject;
import com.fasterxml.jackson.databind.node.ObjectNode;

import io.smallrye.graphql.client.GraphQLError;

public final class TypesafeResponse<T> extends ErrorOr<T> {
private Map<String, List<String>> transportMeta;
private JsonObject extensions;
private ObjectNode extensions;

public static <T> TypesafeResponse<T> of(T value) {
return new TypesafeResponse<>(value, null);
Expand All @@ -33,7 +33,7 @@ private TypesafeResponse(T value, List<GraphQLError> errors) {

private TypesafeResponse(TypesafeResponse<T> typesafeResponse,
Map<String, List<String>> transportMeta,
JsonObject extensions) {
ObjectNode extensions) {
super(
(typesafeResponse.isPresent()) ? typesafeResponse.get() : null,
(typesafeResponse.hasErrors()) ? typesafeResponse.getErrors() : null);
Expand All @@ -43,7 +43,7 @@ private TypesafeResponse(TypesafeResponse<T> typesafeResponse,

public static <T> TypesafeResponse<T> withTransportMetaAndExtensions(TypesafeResponse<T> typesafeResponse,
Map<String, List<String>> transportMeta,
JsonObject responseExtensions) {
ObjectNode responseExtensions) {
return new TypesafeResponse(typesafeResponse, transportMeta, responseExtensions);
}

Expand All @@ -56,9 +56,9 @@ public Map<String, List<String>> getTransportMeta() {
}

/**
* Returns a JsonObject containing extensions to the GraphQL response, if any.
* Returns an ObjectNode containing extensions to the GraphQL response, if any.
*/
public JsonObject getExtensions() {
public ObjectNode getExtensions() {
return extensions;
}

Expand Down
17 changes: 8 additions & 9 deletions client/implementation-vertx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@
<artifactId>microprofile-config-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-jackson-jsonb-compat</artifactId>
</dependency>
<!-- The Client API is copied into SmallRye for now -->
<!-- <dependency>-->
Expand All @@ -46,11 +50,6 @@
<groupId>io.vertx</groupId>
<artifactId>vertx-web-client</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>io.smallrye</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;

import jakarta.json.JsonObject;

import org.jboss.logging.Logger;

import com.fasterxml.jackson.databind.node.ObjectNode;

import io.smallrye.graphql.client.Request;
import io.smallrye.graphql.client.Response;
import io.smallrye.graphql.client.core.Document;
Expand Down Expand Up @@ -207,7 +207,7 @@ public Response executeSync(String query, Map<String, Object> variables, String
return executeSync(buildRequest(query, variables, operationName).toJsonObject(), headers);
}

private Response executeSync(JsonObject json, MultiMap additionalHeaders) {
private Response executeSync(ObjectNode json, MultiMap additionalHeaders) {
if (executeSingleOperationsOverWebsocket) {
return executeSingleResultOperationOverWebsocket(json).await().indefinitely();
} else {
Expand Down Expand Up @@ -314,7 +314,7 @@ public Uni<Response> executeAsync(String query, Map<String, Object> variables, S
return executeAsync(buildRequest(query, variables, operationName).toJsonObject(), headers);
}

private Uni<Response> executeAsync(JsonObject json, MultiMap additionalHeaders) {
private Uni<Response> executeAsync(ObjectNode json, MultiMap additionalHeaders) {
if (executeSingleOperationsOverWebsocket) {
return executeSingleResultOperationOverWebsocket(json);
} else {
Expand Down Expand Up @@ -384,7 +384,7 @@ public Multi<Response> subscription(String query, Map<String, Object> variables,
return subscription0(buildRequest(query, variables, operationName).toJsonObject());
}

private Multi<Response> subscription0(JsonObject json) {
private Multi<Response> subscription0(ObjectNode json) {
return executeSubscriptionOverWebsocket(json);
}

Expand Down Expand Up @@ -447,7 +447,7 @@ private Uni<WebSocketSubprotocolHandler> webSocketHandler() {
});
}

private Uni<HttpResponse<Buffer>> executeSingleResultOperationOverHttp(JsonObject json, MultiMap allHeaders) {
private Uni<HttpResponse<Buffer>> executeSingleResultOperationOverHttp(ObjectNode json, MultiMap allHeaders) {
return url.get()
.chain(instanceUrl -> Uni.createFrom().completionStage(
webClient.postAbs(instanceUrl)
Expand All @@ -461,7 +461,7 @@ private Response toResponse(HttpResponse<Buffer> httpResponse) {
allowUnexpectedResponseFields);
}

private Uni<Response> executeSingleResultOperationOverWebsocket(JsonObject json) {
private Uni<Response> executeSingleResultOperationOverWebsocket(ObjectNode json) {
AtomicReference<String> operationId = new AtomicReference<>();
AtomicReference<WebSocketSubprotocolHandler> handlerRef = new AtomicReference<>();
Uni<String> rawUni = Uni.createFrom().emitter(rawEmitter -> {
Expand All @@ -483,7 +483,7 @@ private Uni<Response> executeSingleResultOperationOverWebsocket(JsonObject json)
.onItem().transform(data -> ResponseReader.readFrom(data, Collections.emptyMap()));
}

private Multi<Response> executeSubscriptionOverWebsocket(JsonObject json) {
private Multi<Response> executeSubscriptionOverWebsocket(ObjectNode json) {
AtomicReference<String> operationId = new AtomicReference<>();
AtomicReference<WebSocketSubprotocolHandler> handlerRef = new AtomicReference<>();
Multi<String> rawMulti = Multi.createFrom().emitter(rawEmitter -> {
Expand Down
Loading
Loading