Skip to content

Commit

Permalink
CLI: allow struct inputs as JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed May 1, 2024
1 parent 6b6d906 commit 421b0a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 3 additions & 0 deletions WDL/CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,9 @@ def runner_input_value(s_value, ty, downloadable, root):
return Value.Array(
ty.item_type, [runner_input_value(s_value, ty.item_type, downloadable, root)]
)
if isinstance(ty, Type.StructInstance):
# allow structs as JSON
return Value.from_json(ty, json.loads(s_value))
if isinstance(ty, Type.Any):
# infer dynamically-typed runtime overrides
try:
Expand Down
6 changes: 1 addition & 5 deletions tests/runner.t
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,5 @@ task test_task {
>>>
}
EOF
$miniwdl run issue686.wdl -i '{
"read_group": {
"ID": "test"
}
}'
$miniwdl run issue686.wdl read_group='{"ID":"test"}'
is "$?" "0" "ensure optional fields in structs initialized from JSON (issue 686 regression)"

0 comments on commit 421b0a8

Please sign in to comment.