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

Mark AppSyncResolverTemplate as Deprecated #460

Merged
merged 1 commit into from Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions events/appsync.go
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
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.