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

Wrong serialisation for Enum type in WebSocketConnectionManager #407

Open
ukevgen opened this issue Feb 28, 2023 · 0 comments
Open

Wrong serialisation for Enum type in WebSocketConnectionManager #407

ukevgen opened this issue Feb 28, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@ukevgen
Copy link

ukevgen commented Feb 28, 2023

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):

  • AppSync SDK Version: com.amazonaws:aws-android-sdk-appsync:3.3.2
@div5yesh div5yesh added the bug Something isn't working label Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants