-
Notifications
You must be signed in to change notification settings - Fork 485
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
Add AWS AppSyncEvent #1939
base: master
Are you sure you want to change the base?
Add AWS AppSyncEvent #1939
Conversation
@PankajRawat333 Thanks for the PR. Please refer type information from https://www.npmjs.com/package/@types/aws-lambda?activeTab=code. Source: https://github.com/aws-samples/cdk-typescript-appsync-lambda/blob/main/src/Resolver/src/resolver.ts#L24. |
@ashishdhingra I have updated type according to above link. |
@PankajRawat333 Thanks for addressing comments for the PR. Discussed this PR with the team. @normj would have a high level look. Meanwhile, could you also please follow up with the Lambda team to get the schema details and data types for each field (since these are not documented in detail)? We would need to make sure to use the correct types for each field to avoid making any breaking changes in future for missed scenario. |
@ashishdhingra Received the AppSync schema from the internal group in the aws-powertool repository. All type information was accurate, but I renamed a few classes based on the schema. |
@PankajRawat333 Provided some review comments. Also update test cases (and JSON file names) accordingly while addressing the review comments. |
/// <summary> | ||
/// Gets or sets the variables passed to the GraphQL operation. | ||
/// </summary> | ||
public Dictionary<string, object> Variables { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the data type for key value be object
or string
? Refer https://docs.powertools.aws.dev/lambda/python/1.15.0/api/utilities/data_classes/appsync_resolver_event.html#aws_lambda_powertools.utilities.data_classes.appsync_resolver_event.AppSyncResolverEventInfo.variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per https://www.npmjs.com/package/@types/aws-lambda?activeTab=code, the data type for value is any
. So we are good for it to be object
.
/// <summary> | ||
/// Represents the event payload received from AWS AppSync. | ||
/// </summary> | ||
public class AppSyncEvent<TArguments> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be a Resolver event. Should we change the name to AppSyncResolverEvent<TArguments>
? Refer:
- https://www.npmjs.com/package/@types/aws-lambda?activeTab=code
- https://github.com/aws-powertools/powertools-lambda-typescript/blob/09f0aaaf92233d326acd9e5fbd21a5c241cdbfe7/packages/parser/src/schemas/appsync.ts#L108
We would also need to change documentation comment for this class, update Readme and it's example.
Is AppSyncAuthorizerEvent
outside the scope for this PR for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PankajRawat333 Please advise if AppSyncAuthorizerEvent
outside the scope for this PR for now.
/// <summary> | ||
/// Represents Amazon Cognito User Pools authorization identity for AppSync | ||
/// </summary> | ||
public class AppSyncCognitoIdentity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we didn't implement AppSyncOidcIdentity
and AppSyncLambdaIdentity
? Please refer below links:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PankajRawat333 Please advise on this.
|
||
# Sample Function | ||
|
||
The following is a sample class and Lambda function that receives AppSync event record data as an `appSyncResolverEvent` and logs some of the incoming event data. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change AppSync
to AppSync resolver
@PankajRawat333 PR builds line locally and
Also,
|
Issue #, if available:
#1938
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.