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
I have searched GitHub for a duplicate issue and I'm sure this is something new
I have searched Google & StackOverflow for a solution and couldn't find anything
I have read and followed the docs and still think this is a bug
I am confident that the issue is with pydantic (not my code, or another library in the ecosystem like FastAPI or mypy)
Description
We are facing several test failures while using pydantic v=1.10.15 with AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers' :
Current :
============================================================================ short test summary info =============================================================================
FAILED tests/model/test_resource_validator.py::TestResourceValidatorFailure::test_connector_with_empty_properties - AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers'
FAILED tests/model/test_resource_validator.py::TestResourceValidatorFailure::test_connector_with_invalid_permission - AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers'
FAILED tests/model/test_resource_validator.py::TestResourceValidatorFailure::test_connector_with_invalid_permission_type - AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers'
FAILED tests/model/test_resource_validator.py::TestResourceValidatorFailure::test_connector_without_source - AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers'
FAILED tests/translator/test_translator.py::test_transform_invalid_document[error_graphqlapi] - AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers'
=============================================================== 5 failed, 3967 passed, 5 rerun in 75.20s (0:01:15) ===============================================================
make: **
Expected:
Class 'error_wrappers' should be imported in pydantic.v1 version 1.10.15 so that this runs as expected in version 1.10.14
TOTAL 9365 267 3768 224 96%
Required test coverage of 95% reached. Total coverage: 95.83%
Lineofcodewherethiserrortypecheckisdefinedinourpackage:
https://github.com/aws/serverless-application-model/blob/develop/samtranslator/model/__init__.py#L348Importdefinedherehttps://github.com/aws/serverless-application-model/blob/44562dc000b991b99c80798e4a35ff9fbe8397d9/samtranslator/compat.py#L1-L6defvalidate_properties_and_return_model(self, cls: Type[RT]) ->RT:
""" Given a resource properties, return a typed object from the definitions of SAM schema model param: resource_properties: properties from input template cls: schema models """try:
returncls.parse_obj(self._generate_resource_dict()["Properties"])
exceptpydantic.error_wrappers.ValidationErrorase:
error_properties: str=""withsuppress(KeyError):
error_properties=".".join(str(x) forxine.errors()[0]["loc"])
raiseInvalidResourceException(self.logical_id, f"Property '{error_properties}' is invalid.") frome
I think the problem has already been addressed in pydantc 1.10.X-fixes. this is the branch that we release the 1.10.x from it.
Please test the branch and confirm the fix. Then we will release 1.10.16 soon.
Initial Checks
Description
We are facing several test failures while using pydantic v=1.10.15 with AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers' :
Current :
============================================================================ short test summary info =============================================================================
FAILED tests/model/test_resource_validator.py::TestResourceValidatorFailure::test_connector_with_empty_properties - AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers'
FAILED tests/model/test_resource_validator.py::TestResourceValidatorFailure::test_connector_with_invalid_permission - AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers'
FAILED tests/model/test_resource_validator.py::TestResourceValidatorFailure::test_connector_with_invalid_permission_type - AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers'
FAILED tests/model/test_resource_validator.py::TestResourceValidatorFailure::test_connector_without_source - AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers'
FAILED tests/translator/test_translator.py::test_transform_invalid_document[error_graphqlapi] - AttributeError: module 'pydantic.v1' has no attribute 'error_wrappers'
=============================================================== 5 failed, 3967 passed, 5 rerun in 75.20s (0:01:15) ===============================================================
make: **
Expected:
Class 'error_wrappers' should be imported in pydantic.v1 version 1.10.15 so that this runs as expected in version 1.10.14
TOTAL 9365 267 3768 224 96%
Required test coverage of 95% reached. Total coverage: 95.83%
Line of code where this error type check is defined in our package:
https://github.com/aws/serverless-application-model/blob/develop/samtranslator/model/__init__.py#L348
Example Code
Steps to reproduce:
$ gh repo clone aws/serverless-application-model
$ cd serverless-application-model
$ python3 -m venv _e
$ . _e/bin/activate
(_e) $ pip install -e '.[dev]'
(_e) $ pip install pydantic==1.10.15
(_e) $ make test
Affected Components
.model_dump()
and.model_dump_json()
model_construct()
, pickling, private attributes, ORM modeThe text was updated successfully, but these errors were encountered: