Skip to content

Bug: DynamoDBStreamSchema can't be extended properly #3740

@blytheaw

Description

@blytheaw

Expected Behavior

I should be able to extend the Zod schema DynamoDBStreamSchema and appropriately access values at Records[*].dynamodb after parsing and in inferred types.

This should work when using the new-ish DynamoDBMarshalled helper which removes the need for the built-in transform that is breaking this currently.

Current Behavior

If you extend DynamoDBStreamSchema as in this example, any other values/types from the DynamoDBStreamChangeRecord (i.e. Records[*].dynamodb.*) are lost.

Ideally the DynamoDBStreamChangeRecord could be extended as well, but because this schema currently has a Zod transform in it, it cannot be extended.

Code snippet

See Discord thread: https://discord.com/channels/1006478942305263677/1006527385409179678/1350204854148010048

Steps to Reproduce

See Discord thread: https://discord.com/channels/1006478942305263677/1006527385409179678/1350204854148010048

Possible Solution

Export a base schema for DynamoDBStream that doesn't have a transform as part of it so it can be extended

Powertools for AWS Lambda (TypeScript) version

latest

AWS Lambda function runtime

22.x

Packaging format used

npm

Execution logs

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompletedThis item is complete and has been merged/shippedparserThis item relates to the Parser Utility

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions