You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/utilities/parser.mdx
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -438,3 +438,21 @@ class EventBridgeEnvelope(BaseEnvelope): # highlight-line
438
438
2. Implemented the `parse` abstract method taking `data` and `model` as parameters
439
439
3. Then, we parsed the incoming data with our envelope to confirm it matches EventBridge's structure defined in `EventBridgeModel`
440
440
4. Lastly, we call `_parse` from `BaseEnvelope` to parse the data in our envelope (.detail) using the customer model
441
+
442
+
## FAQ
443
+
444
+
**When should I use parser vs data_classes utility?**
445
+
446
+
Use data classes utility when you're after autocomplete, self-documented attributes and helpers to extract data from common event sources.
447
+
448
+
Parser is best suited for those looking for a trade-off between defining their models for deep validation, parsing and autocomplete for an additional dependency to be brought in.
449
+
450
+
**How do I import X from Pydantic?**
451
+
452
+
We export most common classes, exceptions, and utilities from Pydantic as part of parser e.g. `from aws_lambda_powertools.utilities.parser import BaseModel`.
453
+
454
+
If what's your trying to use isn't available as part of the high level import system, use the following escape hatch mechanism:
455
+
456
+
```python:title=escape_hatch.py
457
+
from aws_lambda_powertools.utilities.parser.pydantic import<what you'd like to import'>
0 commit comments