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
<strong>Looking to auto-generate models from JSON, YAML, JSON Schemas, OpenApi, etc?</strong>
56
-
<br/><br/>
57
-
Use Koudai Aono's <ahref="https://github.com/koxudaxi/datamodel-code-generator">data model code generation tool for Pydantic</a>
58
-
</Note><br/>
59
-
60
51
## Parsing events
61
52
62
53
You can parse inbound events using **event_parser** decorator, or the standalone `parse` function. Both are also able to parse either dictionary or JSON string as an input.
<strong>Looking to auto-generate models from JSON, YAML, JSON Schemas, OpenApi, etc?</strong>
458
+
<br/><br/>
459
+
Use Koudai Aono's <ahref="https://github.com/koxudaxi/datamodel-code-generator">data model code generation tool for Pydantic</a>
460
+
</Note><br/>
461
+
462
+
There are number of advanced use cases well documented in Pydantic's doc such as creating [immutable models](https://pydantic-docs.helpmanual.io/usage/models/#faux-immutability), [declaring fields with dynamic values]((https://pydantic-docs.helpmanual.io/usage/models/#field-with-dynamic-default-value)) e.g. UUID, and [helper functions to parse models from files, str](https://pydantic-docs.helpmanual.io/usage/models/#helper-functions), etc.
463
+
464
+
Two possible unknown use cases are Models and exception' serialization. Models have methods to [export them](https://pydantic-docs.helpmanual.io/usage/exporting_models/) as `dict`, `JSON`, `JSON Schema`, and Validation exceptions can be exported as JSON.
465
+
466
+
```python:title=serializing_models_exceptions.py
467
+
from aws_lambda_powertools.utilities import Logger
468
+
from aws_lambda_powertools.utilities.parser import parse, BaseModel, ValidationError, validator
0 commit comments