-
Notifications
You must be signed in to change notification settings - Fork 421
Feature request: Parsing nested Parser envelopes #2691
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
Comments
Note: we have a RFC for Event Source Data Classes but not for Parser (after the former is done). |
Hey @heitorlessa. Please note that It's a bit problematic for me to get a nested event, so if you got some examples of such payloads and scenarios, it will allow to further implement this feature. Please see that this Pr Contains two new functions def chained_parse(event: Dict[str, Any], model: Type[Model], envelopes: List[Type[Envelope]]) -> List: which receives a list of envelopes to extract the nested event from. In case the model itself is not to be parsed as an envelope, the last envelope can be For example: parsed_event: List[MySnsBusiness] = chained_parse(
event=raw_event,
model=MySnsBusiness,
envelopes=[envelopes.X, envelopes.Y, None],
) same with @lambda_handler_decorator
def event_parser(
handler: Callable[[Any, LambdaContext], EventParserReturnType],
event: Dict[str, Any],
context: LambdaContext,
model: Type[Model],
envelope: Optional[Union[Type[Envelope], List[Type[Envelope]]]] = None,
) -> EventParserReturnType: which in case envelope is a list, will use chained envelope with the same logic. WDYT about this kind of solution? Please note that without actual nested use cases it's purely a theoretical solution |
We are closing this issue since it hasn't gotten much traction since it was open. |
|
Discussed in #2287
Originally posted by sk0g May 18, 2023
So we have payloads that are essentially Kinesis Firehouse events containing an SQS event. Is there a way to unwrap this using
@event_parser()
? If not, what's the next best thing?The text was updated successfully, but these errors were encountered: