Skip to content

Commit 47bd545

Browse files
jmartiskphillip-kruger
authored andcommitted
Migrate from JSON-B to Jackson
1 parent c8969a7 commit 47bd545

90 files changed

Lines changed: 2275 additions & 1407 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

client/api/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
<!-- <scope>provided</scope>-->
4141
<!-- </dependency>-->
4242
<dependency>
43-
<groupId>jakarta.json</groupId>
44-
<artifactId>jakarta.json-api</artifactId>
43+
<groupId>com.fasterxml.jackson.core</groupId>
44+
<artifactId>jackson-databind</artifactId>
4545
<scope>provided</scope>
4646
</dependency>
4747

client/api/src/main/java/io/smallrye/graphql/client/Request.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.util.Map;
44

5-
import jakarta.json.JsonObject;
5+
import com.fasterxml.jackson.databind.node.ObjectNode;
66

77
public interface Request {
88
String getDocument();
@@ -23,6 +23,6 @@ public interface Request {
2323

2424
String toJson();
2525

26-
JsonObject toJsonObject();
26+
ObjectNode toJsonObject();
2727

2828
}

client/api/src/main/java/io/smallrye/graphql/client/Response.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
import java.util.List;
44
import java.util.Map;
55

6-
import jakarta.json.JsonObject;
7-
import jakarta.json.JsonValue;
6+
import com.fasterxml.jackson.databind.node.ObjectNode;
87

98
public interface Response {
109

1110
/**
1211
* The 'data' object contained in the response.
13-
* Can be JsonValue.NULL if the response contains an empty field, or `null` if the response
14-
* does not contain this field at all.
12+
* Can be null if the response does not contain this field at all or contains a null value.
1513
*/
16-
JsonObject getData();
14+
ObjectNode getData();
1715

1816
/**
1917
* List of errors contained in this response.
@@ -23,7 +21,7 @@ public interface Response {
2321
/**
2422
* List of user-made extensions contained in this response.
2523
*/
26-
JsonObject getExtensions();
24+
ObjectNode getExtensions();
2725

2826
/**
2927
* Transform the contents of the `rootField` from this response into a list of objects

client/api/src/main/java/io/smallrye/graphql/client/typesafe/api/TypesafeResponse.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
import java.util.Map;
88
import java.util.Objects;
99

10-
import jakarta.json.JsonObject;
10+
import com.fasterxml.jackson.databind.node.ObjectNode;
1111

1212
import io.smallrye.graphql.client.GraphQLError;
1313

1414
public final class TypesafeResponse<T> extends ErrorOr<T> {
1515
private Map<String, List<String>> transportMeta;
16-
private JsonObject extensions;
16+
private ObjectNode extensions;
1717

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

3434
private TypesafeResponse(TypesafeResponse<T> typesafeResponse,
3535
Map<String, List<String>> transportMeta,
36-
JsonObject extensions) {
36+
ObjectNode extensions) {
3737
super(
3838
(typesafeResponse.isPresent()) ? typesafeResponse.get() : null,
3939
(typesafeResponse.hasErrors()) ? typesafeResponse.getErrors() : null);
@@ -43,7 +43,7 @@ private TypesafeResponse(TypesafeResponse<T> typesafeResponse,
4343

4444
public static <T> TypesafeResponse<T> withTransportMetaAndExtensions(TypesafeResponse<T> typesafeResponse,
4545
Map<String, List<String>> transportMeta,
46-
JsonObject responseExtensions) {
46+
ObjectNode responseExtensions) {
4747
return new TypesafeResponse(typesafeResponse, transportMeta, responseExtensions);
4848
}
4949

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

5858
/**
59-
* Returns a JsonObject containing extensions to the GraphQL response, if any.
59+
* Returns an ObjectNode containing extensions to the GraphQL response, if any.
6060
*/
61-
public JsonObject getExtensions() {
61+
public ObjectNode getExtensions() {
6262
return extensions;
6363
}
6464

client/implementation-vertx/pom.xml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@
2929
<artifactId>microprofile-config-api</artifactId>
3030
</dependency>
3131
<dependency>
32-
<groupId>jakarta.json</groupId>
33-
<artifactId>jakarta.json-api</artifactId>
32+
<groupId>com.fasterxml.jackson.core</groupId>
33+
<artifactId>jackson-databind</artifactId>
3434
</dependency>
3535
<dependency>
36-
<groupId>jakarta.json.bind</groupId>
37-
<artifactId>jakarta.json.bind-api</artifactId>
36+
<groupId>com.fasterxml.jackson.datatype</groupId>
37+
<artifactId>jackson-datatype-jsr310</artifactId>
38+
</dependency>
39+
<dependency>
40+
<groupId>io.smallrye</groupId>
41+
<artifactId>smallrye-graphql-jackson-jsonb-compat</artifactId>
3842
</dependency>
3943
<!-- The Client API is copied into SmallRye for now -->
4044
<!-- <dependency>-->
@@ -46,11 +50,6 @@
4650
<groupId>io.vertx</groupId>
4751
<artifactId>vertx-web-client</artifactId>
4852
</dependency>
49-
<dependency>
50-
<groupId>org.eclipse</groupId>
51-
<artifactId>yasson</artifactId>
52-
<scope>runtime</scope>
53-
</dependency>
5453

5554
<dependency>
5655
<groupId>io.smallrye</groupId>

client/implementation-vertx/src/main/java/io/smallrye/graphql/client/vertx/dynamic/VertxDynamicGraphQLClient.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import java.util.concurrent.atomic.AtomicReference;
1212
import java.util.stream.Collectors;
1313

14-
import jakarta.json.JsonObject;
15-
1614
import org.jboss.logging.Logger;
1715

16+
import com.fasterxml.jackson.databind.node.ObjectNode;
17+
1818
import io.smallrye.graphql.client.Request;
1919
import io.smallrye.graphql.client.Response;
2020
import io.smallrye.graphql.client.core.Document;
@@ -207,7 +207,7 @@ public Response executeSync(String query, Map<String, Object> variables, String
207207
return executeSync(buildRequest(query, variables, operationName).toJsonObject(), headers);
208208
}
209209

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

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

387-
private Multi<Response> subscription0(JsonObject json) {
387+
private Multi<Response> subscription0(ObjectNode json) {
388388
return executeSubscriptionOverWebsocket(json);
389389
}
390390

@@ -447,7 +447,7 @@ private Uni<WebSocketSubprotocolHandler> webSocketHandler() {
447447
});
448448
}
449449

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

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

486-
private Multi<Response> executeSubscriptionOverWebsocket(JsonObject json) {
486+
private Multi<Response> executeSubscriptionOverWebsocket(ObjectNode json) {
487487
AtomicReference<String> operationId = new AtomicReference<>();
488488
AtomicReference<WebSocketSubprotocolHandler> handlerRef = new AtomicReference<>();
489489
Multi<String> rawMulti = Multi.createFrom().emitter(rawEmitter -> {

0 commit comments

Comments
 (0)