diff --git a/events/appsync.go b/events/appsync.go index 662fbc71..37682b9e 100644 --- a/events/appsync.go +++ b/events/appsync.go @@ -2,7 +2,7 @@ package events import "encoding/json" -// AppSyncResolverTemplate represents the requests from AppSync to Lambda +// Deprecated: AppSyncResolverTemplate does not represent resolver events sent by AppSync. Instead directly model your input schema, or use map[string]string, json.RawMessage, interface{}, etc.. type AppSyncResolverTemplate struct { Version string `json:"version"` Operation AppSyncOperation `json:"operation"` @@ -31,13 +31,13 @@ type AppSyncCognitoIdentity struct { DefaultAuthStrategy string `json:"defaultAuthStrategy"` } -// AppSyncOperation specifies the operation type supported by Lambda operations +// Deprecated: not used by any event schema type AppSyncOperation string const ( - // OperationInvoke lets AWS AppSync know to call your Lambda function for every GraphQL field resolver + // Deprecated: not used by any event schema OperationInvoke AppSyncOperation = "Invoke" - // OperationBatchInvoke instructs AWS AppSync to batch requests for the current GraphQL field + // Deprecated: not used by any event schema OperationBatchInvoke AppSyncOperation = "BatchInvoke" ) diff --git a/events/appsync_test.go b/events/appsync_test.go index 34be329a..7ba8f0e3 100644 --- a/events/appsync_test.go +++ b/events/appsync_test.go @@ -9,46 +9,6 @@ import ( "github.com/stretchr/testify/assert" ) -func TestAppSyncResolverTemplate_invoke(t *testing.T) { - inputJSON, err := ioutil.ReadFile("./testdata/appsync-invoke.json") - if err != nil { - t.Errorf("could not open test file. details: %v", err) - } - - var inputEvent AppSyncResolverTemplate - if err = json.Unmarshal(inputJSON, &inputEvent); err != nil { - t.Errorf("could not unmarshal event. details: %v", err) - } - assert.Equal(t, OperationInvoke, inputEvent.Operation) - - outputJSON, err := json.Marshal(inputEvent) - if err != nil { - t.Errorf("could not marshal event. details: %v", err) - } - - assert.JSONEq(t, string(inputJSON), string(outputJSON)) -} - -func TestAppSyncResolverTemplate_batchinvoke(t *testing.T) { - inputJSON, err := ioutil.ReadFile("./testdata/appsync-batchinvoke.json") - if err != nil { - t.Errorf("could not open test file. details: %v", err) - } - - var inputEvent AppSyncResolverTemplate - if err = json.Unmarshal(inputJSON, &inputEvent); err != nil { - t.Errorf("could not unmarshal event. details: %v", err) - } - assert.Equal(t, OperationBatchInvoke, inputEvent.Operation) - - outputJSON, err := json.Marshal(inputEvent) - if err != nil { - t.Errorf("could not marshal event. details: %v", err) - } - - assert.JSONEq(t, string(inputJSON), string(outputJSON)) -} - func TestAppSyncIdentity_IAM(t *testing.T) { inputJSON, err := ioutil.ReadFile("./testdata/appsync-identity-iam.json") if err != nil { diff --git a/events/testdata/appsync-batchinvoke.json b/events/testdata/appsync-batchinvoke.json deleted file mode 100644 index ad2a48d5..00000000 --- a/events/testdata/appsync-batchinvoke.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "version": "2017-02-28", - "operation": "BatchInvoke", - "payload": [{ - "arguments": { - "id": "postId1", - "count": 1, - "float": 1.2, - "flag": true - } - }, - { - "arguments": { - "id": "postId2", - "count": 2, - "float": 1.2 - } - }, - { - "arguments": { - "id": "postId3", - "count": 3, - "flag": false - } - } - ] -} diff --git a/events/testdata/appsync-invoke.json b/events/testdata/appsync-invoke.json deleted file mode 100644 index 12dc4339..00000000 --- a/events/testdata/appsync-invoke.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "2017-02-28", - "operation": "Invoke", - "payload": { - "field": "getPost", - "arguments": { - "id": "postId1", - "count": 1, - "float": 1.2, - "flag": true - } - } -}