Skip to content

Commit dd4d8a7

Browse files
committed
style: fix whitespace in UploadFile schema implementation
1 parent d6fb2c1 commit dd4d8a7

File tree

1 file changed

+7
-9
lines changed
  • aws_lambda_powertools/event_handler/openapi

1 file changed

+7
-9
lines changed

aws_lambda_powertools/event_handler/openapi/params.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ def __get_pydantic_core_schema__(
119119
cls._validate,
120120
serialization=core_schema.to_string_ser_schema(),
121121
)
122-
122+
123123
# Add OpenAPI schema info
124124
schema["json_schema_extra"] = {
125125
"type": "string",
126126
"format": "binary",
127127
"description": "A file uploaded as part of a multipart/form-data request",
128128
}
129-
129+
130130
return schema
131131

132132
@classmethod
@@ -137,27 +137,25 @@ def _validate(cls, value: Any) -> UploadFile:
137137
if isinstance(value, bytes):
138138
return cls(file=value)
139139
raise ValueError(f"Expected UploadFile or bytes, got {type(value)}")
140-
140+
141141
@classmethod
142142
def __get_validators__(cls):
143143
"""Return validators for Pydantic v1 compatibility."""
144144
yield cls._validate
145-
145+
146146
@classmethod
147-
def __get_pydantic_json_schema__(
148-
cls, _core_schema: Any, field_schema: Any
149-
) -> dict[str, Any]:
147+
def __get_pydantic_json_schema__(cls, _core_schema: Any, field_schema: Any) -> dict[str, Any]:
150148
"""Modify the JSON schema for OpenAPI compatibility."""
151149
# Handle both Pydantic v1 and v2 schemas
152150
json_schema = field_schema(_core_schema) if callable(field_schema) else {}
153-
151+
154152
# Add binary file format for OpenAPI
155153
json_schema.update(
156154
type="string",
157155
format="binary",
158156
description="A file uploaded as part of a multipart/form-data request",
159157
)
160-
158+
161159
return json_schema
162160

163161

0 commit comments

Comments
 (0)