Describe the bug
The JSONObject cant serialise subscription with Enum type JSONObject(subscription.variables().valueMap()). As a result will be smth like this {“personId”:“2",“personType”:null}}.
To Reproduce
Create any subscription with Enum type as argument and look into this void
private synchronized void startSubscription(
@NonNull Subscription<?, ?, ?> subscription,
@NonNull AppSyncSubscriptionCall.Callback<?> callback,
String subscriptionId) {
try {
// Check result to avoid silent failure
boolean enqueued = websocket.send(new JSONObject()
.put("id", subscriptionId)
.put("type", "start")
.put("payload", new JSONObject()
.put("data", (new JSONObject()
.put("query", subscription.queryDocument())
.put("variables", new JSONObject(subscription.variables().valueMap()))).toString())
.put("extensions", new JSONObject()
.put("authorization", subscriptionAuthorizer.getAuthorizationDetails(false, subscription))))
.toString()
);
if (!enqueued) {
callback.onFailure(new ApolloException("WebSocket communication failed."));
}
} catch (JSONException jsonException) {
throw new RuntimeException("Failed to construct subscription registration message.", jsonException);
}
}
The lini with
put("variables", new JSONObject(subscription.variables().valueMap()))).toString()) isn’t working in a correct way with Enum type.
Expected behavior
Serialisation for Enum type is correct.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment(please complete the following information):
Describe the bug The JSONObject cant serialise subscription with Enum type JSONObject(subscription.variables().valueMap()). As a result will be smth like this {“personId”:“2",“personType”:null}}.
To Reproduce Create any subscription with Enum type as argument and look into this void
The lini with
put("variables", new JSONObject(subscription.variables().valueMap()))).toString())
isn’t working in a correct way with Enum type. Expected behavior Serialisation for Enum type is correct.Screenshots If applicable, add screenshots to help explain your problem.
Environment(please complete the following information):