From 8562445608131b5fb175f84f953b2fda0950864d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20G=C3=B6bel?= <dgoebel@techfak.uni-bielefeld.de>
Date: Tue, 21 Mar 2023 11:08:05 +0100
Subject: [PATCH] Make usage and output docs mandatory for workflows

#23
---
 app/api/utils.py                |  4 +++-
 app/schemas/workflow_version.py | 14 +++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/app/api/utils.py b/app/api/utils.py
index 7c80a76..bf86b23 100644
--- a/app/api/utils.py
+++ b/app/api/utils.py
@@ -67,7 +67,9 @@ async def check_repo(repo: GitRepository, client: AsyncClient) -> None:
         Http client with an open connection. Dependency Injection.
     """
     await repo.check_files_exist(
-        ["README.md", "CHANGELOG.md", "main.nf", "nextflow_schema.json"], client=client, raise_error=True
+        ["README.md", "CHANGELOG.md", "main.nf", "nextflow_schema.json", "docs/usage.md", "docs/output.md"],
+        client=client,
+        raise_error=True,
     )
 
 
diff --git a/app/schemas/workflow_version.py b/app/schemas/workflow_version.py
index d9bdf91..d1e4890 100644
--- a/app/schemas/workflow_version.py
+++ b/app/schemas/workflow_version.py
@@ -63,9 +63,19 @@ class WorkflowVersionFull(WorkflowVersionReduced):
     )
     changelog_url: AnyHttpUrl = Field(
         ...,
-        description="URL to download CHAnGELOG.md from",
+        description="URL to download CHANGELOG.md from",
         example="https://raw.githubusercontent.com/example/example/CHANGELOG.md",
     )
+    usage_url: AnyHttpUrl = Field(
+        ...,
+        description="URL to download usage.md from",
+        example="https://raw.githubusercontent.com/example/example/docs/usage.md",
+    )
+    output_url: AnyHttpUrl = Field(
+        ...,
+        description="URL to download output.md from",
+        example="https://raw.githubusercontent.com/example/example/docs/output.md",
+    )
     parameter_schema_url: AnyHttpUrl = Field(
         ...,
         description="URL to download nextflow_schema.json from",
@@ -78,6 +88,8 @@ class WorkflowVersionFull(WorkflowVersionReduced):
             workflow_id=db_version.workflow_id,
             readme_url=repo.downloadFileURL("README.md"),
             changelog_url=repo.downloadFileURL("CHANGELOG.md"),
+            usage_url=repo.downloadFileURL("docs/usage.md"),
+            output_url=repo.downloadFileURL("docs/output.md"),
             parameter_schema_url=repo.downloadFileURL("nextflow_schema.json"),
             **WorkflowVersionReduced.from_db_version(db_version).dict(),
         )
-- 
GitLab