Closed
Description
When running make docs-api-local
I get the following error when browsing the docs for the utilities
Error importing module aws_lambda_powertools.utilities:
Traceback (most recent call last):
File "/Volumes/data/projects/aws-lambda-powertools-python/.venv/lib/python3.8/site-packages/pdoc/cli.py", line 234, in do_GET
out = self.html()
File "/Volumes/data/projects/aws-lambda-powertools-python/.venv/lib/python3.8/site-packages/pdoc/cli.py", line 266, in html
return pdoc.html(self.import_path_from_req_url,
File "/Volumes/data/projects/aws-lambda-powertools-python/.venv/lib/python3.8/site-packages/pdoc/__init__.py", line 173, in html
mod = Module(import_module(module_name, reload=reload),
File "/Volumes/data/projects/aws-lambda-powertools-python/.venv/lib/python3.8/site-packages/pdoc/__init__.py", line 234, in import_module
importlib.reload(mod)
File "/opt/homebrew/Cellar/python@3.8/3.8.11/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 169, in reload
_bootstrap._exec(spec, module)
File "<frozen importlib._bootstrap>", line 604, in _exec
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Volumes/data/projects/aws-lambda-powertools-python/aws_lambda_powertools/utilities/parser/models/apigw.py", line 46, in <module>
class APIGatewayEventRequestContext(BaseModel):
File "/Volumes/data/projects/aws-lambda-powertools-python/aws_lambda_powertools/utilities/parser/models/apigw.py", line 72, in APIGatewayEventRequestContext
def check_message_id(cls, values):
File "/Volumes/data/projects/aws-lambda-powertools-python/.venv/lib/python3.8/site-packages/pydantic/class_validators.py", line 119, in root_validator
f_cls = _prepare_validator(_func, allow_reuse)
File "/Volumes/data/projects/aws-lambda-powertools-python/.venv/lib/python3.8/site-packages/pydantic/class_validators.py", line 144, in _prepare_validator
raise ConfigError(f'duplicate validator function "{ref}"; if this is intended, set `allow_reuse=True`')
pydantic.errors.ConfigError: duplicate validator function "aws_lambda_powertools.utilities.parser.models.apigw.APIGatewayEventRequestContext.check_message_id"; if this is intended, set `allow_reuse=True`
What were you trying to accomplish?
Local testing of the API Docs
Expected Behavior
No errors
Current Behavior
Errors
Possible Solution
Add allow_reuse=True
as suggested. (Or some other better fix @risenberg-cyberark ?)
Steps to Reproduce (for bugs)
- run
make dev docs-api-local
- visit
http://localhost:8080/aws_lambda_powertools/utilities/
Environment
- Powertools version used: 1.19.0
- Packaging format (Layers, PyPi): Git
- AWS Lambda function runtime: Python 3.8.11 locally
- Debugging logs