Skip to content

Commit 206b22e

Browse files
Fix bug: disambiguate None pdefault vs. no default in rest_module
1 parent 3d00c43 commit 206b22e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "ad_sdl.wei"
3-
version = "0.7.2"
3+
version = "0.7.3"
44
description = "The Rapid Prototyping Laboratory's Workflow Execution Interface."
55
authors = [
66
{name = "Rafael Vescovi", email = "ravescovi@anl.gov"},

src/wei/modules/rest_module.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,15 @@ def decorator(function):
334334
)
335335
if type_hint.__name__ == "UploadFile":
336336
# * Add a file parameter to the action
337+
parameter_info = signature.parameters[parameter_name]
337338
action.files.append(
338339
ModuleActionFile(
339340
name=parameter_name,
340-
required=True,
341+
required=True
342+
if parameter_info.default
343+
== inspect.Parameter.empty
344+
is None
345+
else False,
341346
description=description,
342347
)
343348
)
@@ -355,7 +360,11 @@ def decorator(function):
355360
name=parameter_name,
356361
type=pretty_type_repr(type_hint),
357362
default=default,
358-
required=True if default is None else False,
363+
required=True
364+
if parameter_info.default
365+
== inspect.Parameter.empty
366+
is None
367+
else False,
359368
description=description,
360369
)
361370
)

0 commit comments

Comments
 (0)