Skip to content

Commit 657fed3

Browse files
Make mypy happy?
1 parent 8195bda commit 657fed3

File tree

1 file changed

+8
-1
lines changed
  • aws_lambda_powertools/event_handler/openapi

1 file changed

+8
-1
lines changed

aws_lambda_powertools/event_handler/openapi/models.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414

1515

1616
class OpenapiExtensions(BaseModel):
17+
"""
18+
This class serves as a Pydantic proxy model to add OpenAPI extensions.
19+
20+
OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping
21+
and add only the provided value in the schema.
22+
"""
23+
1724
openapi_extensions: Optional[Dict[str, Any]] = None
1825

1926
# This rule is valid for Pydantic v1 and v2
@@ -474,7 +481,7 @@ class SecurityBase(OpenapiExtensions):
474481
description: Optional[str] = None
475482

476483
if PYDANTIC_V2:
477-
model_config = {"extra": "allow", "populate_by_name": True}
484+
model_config = {"extra": "allow", "populate_by_name": True} # type: ignore
478485

479486
else:
480487

0 commit comments

Comments
 (0)