File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -167,12 +167,16 @@ async def run(
167
167
# but excepts possible `self`) are keyword arguments.
168
168
sig = inspect .signature (func )
169
169
for name , param in sig .parameters .items ():
170
- if name not in kwargs and isinstance (param .default , FieldInfo ):
171
- default = param .default .default
172
- if default is PydanticUndefined :
173
- raise ValueError (f"Missing required argument { name !r} " )
174
- else :
170
+ if name not in kwargs :
171
+ if isinstance (param .default , FieldInfo ):
172
+ # The default value is a Pydantic Field.
173
+ default = param .default .default
174
+ if default is PydanticUndefined :
175
+ raise ValueError (f"Missing required argument { name !r} " )
175
176
kwargs [name ] = default
177
+ elif param .default != inspect .Parameter .empty :
178
+ # Normal default value.
179
+ kwargs [name ] = param .default
176
180
177
181
result = func (* args , ** kwargs )
178
182
if is_async_iterator (result ):
You can’t perform that action at this time.
0 commit comments