-
Notifications
You must be signed in to change notification settings - Fork 579
Conversation
- Add LexV2Event and LexV2Response structures - Add support for Kendra integration and sub-slot elicitation - Include test fixtures and example usage - Add implementation documentation
Codecov Report
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.94%. Comparing base (9dac8a5) to head (ea8f66c).
Additional details and impacted files
@@ Coverage Diff @@ ## main #615 +/- ## ======================================= Coverage 74.94% 74.94% ======================================= Files 36 36 Lines 1401 1401 ======================================= Hits 1050 1050 Misses 273 273 Partials 78 78
☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
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.
Does Lex allow non-UUID session IDs? If not, we could replace this with a placeholder value that would represent something legal.
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.
Lex V2 accepts any string for sessionId, I'll update this in the next commit to be similar to a UUID format https://docs.aws.amazon.com/lexv2/latest/dg/lambda-input-format.html
image
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.
Would recommend a data type for InvocationSource:
// InvocationSource represents the source of the invocation within the Lex Bot lifecycle. type LexInvocationSource string const ( LexInvocationSourceDialogCodeHook InvocationSource = "DialogCodeHook" LexInvocationSourceFulfillmentCodeHook InvocationSource = "FulfillmentCodeHook" )
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.
Would recommend a data type for InputMode:
// InputMode represents the mode of innput from the user. type InputMode string const ( InputModeText InputMode = "Text" InputModeVoice InputMode = "Voice" InputModeDTMF InputMode = "DTMF" )
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.
intentionally kept these as plain string types to match the pattern used throughout the aws-lambda-go events library (see lex.go, cognito.go, apigw.go)
AWS can add new enum values without requiring library updates. Developers are pointed to the official AWS docs for valid values if they want to add type-safe constants in their own code.
https://docs.aws.amazon.com/lexv2/latest/dg/lambda-input-format.html
https://docs.aws.amazon.com/lexv2/latest/dg/lambda-response-format.html
This approach keeps the library minimal while remaining flexible as AWS evolves the service.
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.
The LexV2Event struct is missing the optional InvocationLabel:
The documentation does not describes this field as optional, but testing has shown that the field is optional, so it can be represented as a string pointer.
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.
Is InputTranscript actually optional? If so, it could be a pointer, so that the json struct tag omitempty, results in a nil value instead of a default empty string.
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.
thanks will add InvocationLabel in next commit
InputTranscript: The documentation not explicitly mark inputTranscript as required. However, I'm keeping it as a regular string with omitempty because it represents user input and is present in all standard DialogCodeHook and FulfillmentCodeHook invocations. It's a core field fundamental to Lex's operation. Making it a pointer would incorrectly signal it's rarely used, when it's present in nearly every event. The omitempty tag handles edge cases where it might be absent. While the docs don't say "required" verbatim, the field's purpose and typical usage patterns indicate it's a standard field rather than optional.
- Add InvocationLabel field as optional pointer - Update sessionId examples to use UUID format for realism - Keep InputTranscript as string (core field, present in standard invocations)
Issue #, if available: #518
Description of changes:
This PR adds complete Amazon Lex V2 event support to aws-lambda-go, including:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.