Skip to content

Commit

Permalink
Support for string workflow parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
suecharo committed Sep 25, 2024
1 parent 2314e7d commit a15c762
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ Documentation = "https://github.com/sapporo-wes/sapporo-service/blob/main/README
Repository = "https://github.com/sapporo-wes/sapporo-service.git"

[project.optional-dependencies]
tests = ["isort", "mypy", "pylint", "pytest-cov", "pytest-mock", "pytest"]
tests = [
"isort",
"mypy",
"pylint",
"pytest-cov",
"pytest-mock",
"pytest",
"types-PyYAML",
]

[project.scripts]
sapporo = "sapporo.app:main"
Expand Down
5 changes: 4 additions & 1 deletion sapporo/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ def write_file(run_id: str, key: RunDirStructureKeys, content: Any) -> None:
file.parent.mkdir(parents=True, exist_ok=True)
with file.open(mode="w", encoding="utf-8") as f:
if file.suffix == ".json":
content = json.dumps(content, indent=2)
if key == "wf_params" and isinstance(content, str):
pass
else:
content = json.dumps(content, indent=2)
elif key == "state":
content = content.value
else:
Expand Down
9 changes: 7 additions & 2 deletions sapporo/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,14 @@ class RunListResponse(BaseModel):


class RunRequest(BaseModel):
workflow_params: Dict[str, Any] = Field(
workflow_params: Union[Dict[str, Any], str] = Field(
...,
description=GA4GH_WES_SCHEMAS["RunRequest"]["properties"]["workflow_params"]["description"],
description=GA4GH_WES_SCHEMAS["RunRequest"]["properties"]["workflow_params"]["description"] + """\n
**sapporo-wes-2.0.0 extension:**
- original wes-1.1.0: Dict[str, Any]
- sapporo-wes-2.0.0: Union[Dict[str, Any], str]
""",
)
workflow_type: str = Field(
...,
Expand Down

0 comments on commit a15c762

Please sign in to comment.