aws / serverless-application-model

The AWS Serverless Application Model (AWS SAM) transform is a AWS CloudFormation macro that transforms SAM templates into CloudFormation templates.
https://aws.amazon.com/serverless/sam
Apache License 2.0
9.29k stars 2.37k forks source link

fix: AttributeError: module 'pydantic.v1' has no attribute 'error_wrapper' #3611

Closed shikha372 closed 3 weeks ago

shikha372 commented 3 weeks ago

Issue #3600

Description of changes

Added exception block to catch 'AttributeError' happening due to missing error_wrapper import in pydantic v1.10.15

This is a workaround till pydantic team solves the issue at their end: Ticket to pydantic team https://github.com/pydantic/pydantic/issues/9625

Description of how you validated changes

Tests ran successfully in python virtual env.

Commands used:

python3 -m venv .venv
source .venv/bin/activate
make init
make test
make pr

black /Users/shikagg/sam_clone/serverless-application-model/samtranslator/model/__init__.py  -> to fix error 
1 file would be reformatted, 364 files would be left unchanged.
make: *** [format-check] Error 1

Result

Required test coverage of 95% reached. Total coverage: 95.80%

3973 passed in 83.39s (0:01:23) 

Checklist

Examples?

Please reach out in the comments if you want to add an example. Examples will be added to sam init through aws/aws-sam-cli-app-templates.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.