Skip to content

Commit

Permalink
Use challenge level defined archives instead of phase level defined a…
Browse files Browse the repository at this point in the history
…rchives in pack README
  • Loading branch information
chrisvanrun committed Jan 2, 2024
1 parent 6d15c59 commit 50edd06
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Challenge phases pull their data from archives to test submissions on.

Your challenge has the following archives:

{% for phase in cookiecutter.challenge.phases -%}
* {{phase.archive.url}}
{% for archive in cookiecutter.challenge.archives -%}
* {{archive.url}}
{% endfor %}

---
Expand Down
66 changes: 30 additions & 36 deletions grand_challenge_forge/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,31 @@

logger = logging.getLogger(__name__)

ARCHIVE_SCHEMA = {
"type": "object",
"properties": {
"slug": {"type": "string"},
"url": {"type": "string"},
},
"required": ["slug", "url"],
}

COMPONENT_INTERFACE_SCHEMA = {
"type": "object",
"properties": {
"slug": {"type": "string"},
"relative_path": {"type": "string"},
"kind": {"type": "string"},
"super_kind": {"type": "string"},
},
"required": [
"slug",
"relative_path",
"kind",
"super_kind",
],
}


PACK_CONTEXT_SCHEMA = {
"type": "object",
Expand All @@ -15,60 +40,29 @@
"type": "object",
"properties": {
"slug": {"type": "string"},
"archives": {"type": "array", "items": ARCHIVE_SCHEMA},
"phases": {
"type": "array",
"items": {
"type": "object",
"properties": {
"slug": {"type": "string"},
"archive": {
"type": "object",
"properties": {"url": {"type": "string"}},
"required": ["url"],
},
"archive": ARCHIVE_SCHEMA,
"inputs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"slug": {"type": "string"},
"relative_path": {"type": "string"},
"kind": {"type": "string"},
"super_kind": {"type": "string"},
},
"required": [
"slug",
"relative_path",
"kind",
"super_kind",
],
},
"items": COMPONENT_INTERFACE_SCHEMA,
},
"outputs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"slug": {"type": "string"},
"relative_path": {"type": "string"},
"kind": {"type": "string"},
"super_kind": {"type": "string"},
},
"required": [
"slug",
"relative_path",
"kind",
"super_kind",
],
},
"items": COMPONENT_INTERFACE_SCHEMA,
},
},
"required": ["slug", "archive", "inputs", "outputs"],
"additionalProperties": True, # Allow additional properties
},
},
},
"required": ["slug", "phases"],
"required": ["slug", "phases", "archives"],
},
},
"required": ["challenge"],
Expand Down
14 changes: 14 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
DEFAULT_PACK_CONTEXT_STUB = {
"challenge": {
"slug": "challenge-slug",
"archives": [
{
"slug": "archive-slug",
"url": "https://grand-challenge.org/archives/archive-slug/"
},
{
"slug": "another-archive-slug",
"url": "https://grand-challenge.org/archives/another-archive-slug/"
},
{
"slug": "yet-another-archive-slug",
"url": "https://grand-challenge.org/archives/yet-another-archive-slug/"
}
],
"phases": [
{
"slug": "phase-slug",
Expand Down

0 comments on commit 50edd06

Please sign in to comment.