Add new decorator to parse message data using a supplied Pydantic model
Description
Extend the added pubsub_messages function to add a new decorator which extracts the data in the MessagePublishedData.message.data field from the event, and deserialises it into a supplied Pydantic model, passing that deserialised Pydantic model instance to the handler.
Further details
This should be an overload of the original decorator, discriminated by an argument which is type, bound to a Pydantic model type.
Task list
Acceptance criteria
-
Decorator overload to perform message payload validation/parsing via a Pydantic model exists -
Validation errors should be caught and logged as exceptions, with a 400response to the caller
Links/references
Edited by Mike Knee