-
Notifications
You must be signed in to change notification settings - Fork 406
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
Parser (Pydantic) re-export Pydantic errors for data model validation #1687
Comments
Hey @kPOWz, would this work? Looking at Pydantic exported symbols, there doesn't seem to be any clash so I can export them directly too. |
Just read Pydantic V2 plan and the only breaking change it seems to apply here is I'll go ahead and merge the errors exposing, since Because it's a major version, we will come to that when we need to cross that bridge. I think there's a great chance in the future to make Pydantic built-in in Powertools to ease developing certain features like Feature Flags - the benchmarks and reduced package size look fantastic, but we need to apply due-diligence and weigh its pros/cons as usual. |
|
This is now released under 2.3.0 version! |
Use case
When writing validators and root validators it is useful to keep error formats consistent with the Pydantic
TypeError
s andValueError
s from the Pydantic errors moduleDue to how Pydantic is packaged, these errors are not exported by https://github.com/awslabs/aws-lambda-powertools-python/blob/develop/aws_lambda_powertools/utilities/parser/pydantic.py#L5
https://awslabs.github.io/aws-lambda-powertools-python/2.1.0/utilities/parser/#data-model-validation
Solution/User Experience
re-export the LPT packaged Pydantic errors module under
from aws_lambda_powertools.utilities.parser.pydantic.errors
ensure this will still work smoothly after switch to rust / pydantic core
Alternative solutions
No response
Acknowledgment
The text was updated successfully, but these errors were encountered: