-
Notifications
You must be signed in to change notification settings - Fork 161
Closed
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilityparserThis item relates to the Parser UtilityThis item relates to the Parser Utility
Milestone
Description
Use case
Using middy middleware we should be able to parse event based on built in schema or provided custom schema with envelopes.
Solution/User Experience
import { parser } from '@aws-lambda-powertools/parser/middleware';
import middy from '@middy/core';
import { EventBridgeEnvelope } from '@aws-lambda-powertools/parser/envelopes';
const order = z.object({
id: z.number(),
description: z.string(),
items: z.array(orderItem),
});
const lambdaHandler = async (_event: z.infer<typeof order>, _context: any) => {
logger.info('This is an INFO log with some context');
logger.info(_event);
// will output {id: 1, description: 'foo', items: [...]
};
export const handler = middy(lambdaHandler).use(parser(order, envelope));
Alternative solutions
No response
Acknowledgment
- This feature request meets Powertools for AWS Lambda (TypeScript) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Metadata
Assignees
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilityparserThis item relates to the Parser UtilityThis item relates to the Parser Utility
Type
Projects
Status
Shipped