Skip to content

Commit

Permalink
Mark AppSyncResolverTemplate as Deprecated (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmoffatt authored Jul 27, 2022
1 parent 6796528 commit 151c2c1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 84 deletions.
8 changes: 4 additions & 4 deletions events/appsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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"
)

Expand Down
40 changes: 0 additions & 40 deletions events/appsync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
27 changes: 0 additions & 27 deletions events/testdata/appsync-batchinvoke.json

This file was deleted.

13 changes: 0 additions & 13 deletions events/testdata/appsync-invoke.json

This file was deleted.

0 comments on commit 151c2c1

Please sign in to comment.