Skip to content

Commit a15c762

Browse files
committed
Support for string workflow parameter
1 parent 2314e7d commit a15c762

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

pyproject.toml

+9-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ Documentation = "https://github.com/sapporo-wes/sapporo-service/blob/main/README
4747
Repository = "https://github.com/sapporo-wes/sapporo-service.git"
4848

4949
[project.optional-dependencies]
50-
tests = ["isort", "mypy", "pylint", "pytest-cov", "pytest-mock", "pytest"]
50+
tests = [
51+
"isort",
52+
"mypy",
53+
"pylint",
54+
"pytest-cov",
55+
"pytest-mock",
56+
"pytest",
57+
"types-PyYAML",
58+
]
5159

5260
[project.scripts]
5361
sapporo = "sapporo.app:main"

sapporo/run.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ def write_file(run_id: str, key: RunDirStructureKeys, content: Any) -> None:
5959
file.parent.mkdir(parents=True, exist_ok=True)
6060
with file.open(mode="w", encoding="utf-8") as f:
6161
if file.suffix == ".json":
62-
content = json.dumps(content, indent=2)
62+
if key == "wf_params" and isinstance(content, str):
63+
pass
64+
else:
65+
content = json.dumps(content, indent=2)
6366
elif key == "state":
6467
content = content.value
6568
else:

sapporo/schemas.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,14 @@ class RunListResponse(BaseModel):
294294

295295

296296
class RunRequest(BaseModel):
297-
workflow_params: Dict[str, Any] = Field(
297+
workflow_params: Union[Dict[str, Any], str] = Field(
298298
...,
299-
description=GA4GH_WES_SCHEMAS["RunRequest"]["properties"]["workflow_params"]["description"],
299+
description=GA4GH_WES_SCHEMAS["RunRequest"]["properties"]["workflow_params"]["description"] + """\n
300+
**sapporo-wes-2.0.0 extension:**
301+
302+
- original wes-1.1.0: Dict[str, Any]
303+
- sapporo-wes-2.0.0: Union[Dict[str, Any], str]
304+
""",
300305
)
301306
workflow_type: str = Field(
302307
...,

0 commit comments

Comments
 (0)