awslabs / awslabs/swift-aws-lambda-events

AWSLambdaEvents.AppSync.Event incorrect

Open
#54 5 comments 0 reactions 0 assignees View on GitHub
kind/bug
Dominant language
Swift
Stars
58
Forks
33
PR merge metrics
No merged PRs in 30d

Description

### Expected behavior
I am using swift as a appsync lambda resolver with the following GraphQL schema.

```GraphQL
input TestInput {
ids: [String]
}

testMutation(input: TestInput!): String
```
According to the [GraphQL Documentation](https://graphql.org/learn/schema/) arrays are allowed. So a correct JSON Decode should happen.

### Actual behavior
By setting the `message` to type of `AWSLambdaEvents.AppSync.Event` leads to a `Unexpected AppSync argument. Expected a String or a Dictionary.` error.

### Steps to reproduce

```Json
{
"field": "testMutation",
"arguments": {
"input": {
"ids": [
"id1",
"id2"
]
}
}
}
```
This is a the json payload I get from appsync.

### Swift & OS version (output of `swift --version && uname -a`)
Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)
Target: x86_64-apple-darwin20.4.0
Darwin xx-MacBook-Pro.local 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:47 PDT 2021; root:xnu-7195.101.2~1/RELEASE_X86_64 x86_64

Contributor guide

Open the contributing guide

Research direction

Start by locating AWSLambdaEvents.AppSync.Event and its JSON decoding path, then reproduce the issue with the payload shown in the report. Trace why nested arrays such as arguments.input.ids are rejected; done means the payload decodes successfully without the Unexpected AppSync argument error, with coverage for this case if the project has relevant decoder tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, graphql, swift
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.