Skip to content

Commit

Permalink
Allow reference to external job file
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Dec 7, 2023
1 parent bc5487a commit 37f908f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 37 deletions.
19 changes: 15 additions & 4 deletions lib/galaxy/tool_util/schemas/test_file_from_xsd.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from __future__ import annotations

import json
from typing import Union
from typing import (
Optional,
Union,
)

# bug with pydantic, need everything in namespace, otherwise fails with
# `pydantic.errors.PydanticUserError: `ListOfTests` is not fully defined; you should define `TestDiscoveredDataset`, then call `ListOfTests.model_rebuild()`.`
Expand All @@ -14,6 +17,7 @@
from pydantic import (
BaseModel,
ConfigDict,
Field,
RootModel,
)
from pydantic.dataclasses import dataclass
Expand All @@ -38,9 +42,16 @@ class TestOutputCollection(TestOutputCollection_):
class Test(BaseModel):
model_config = extra_forbidden

doc: str
job: Job
outputs: dict[str, AnyOutput]
doc: Optional[str] = Field(None, description="Describes the purpose of the test.")
job: Job = Field(
...,
description="Defines job to execute. Can be a path to a file or an line dictionary describing the job inputs.",
)

outputs: dict[str, AnyOutput] = Field(
...,
description="Defines assertions about outputs (datasets, collections or parameters). Each key corresponds to a labeled output, values are dictionaries describing the expected output.",
)


class ListOfTests(RootModel):
Expand Down
87 changes: 54 additions & 33 deletions lib/galaxy/tool_util/schemas/test_file_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1543,36 +1543,43 @@
"type": "object"
},
"Job": {
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"$ref": "#/$defs/Collection"
},
{
"$ref": "#/$defs/LocationFile"
},
{
"$ref": "#/$defs/PathFile"
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"$ref": "#/$defs/Collection"
},
{
"$ref": "#/$defs/LocationFile"
},
{
"$ref": "#/$defs/PathFile"
},
{
"type": "null"
}
]
},
{
"type": "null"
}
]
},
"title": "Job",
"type": "object"
"type": "object"
},
{
"type": "string"
}
],
"title": "Job"
},
"LocationFile": {
"additionalProperties": false,
Expand Down Expand Up @@ -2146,11 +2153,25 @@
"additionalProperties": false,
"properties": {
"doc": {
"title": "Doc",
"type": "string"
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Describes the purpose of the test.",
"title": "Doc"
},
"job": {
"$ref": "#/$defs/Job"
"allOf": [
{
"$ref": "#/$defs/Job"
}
],
"description": "Defines job to execute. Can be a path to a file or an line dictionary describing the job inputs."
},
"outputs": {
"additionalProperties": {
Expand Down Expand Up @@ -2178,12 +2199,12 @@
}
]
},
"description": "Defines assertions about outputs (datasets, collections or parameters). Each key corresponds to a labeled output, values are dictionaries describing the expected output.",
"title": "Outputs",
"type": "object"
}
},
"required": [
"doc",
"job",
"outputs"
],
Expand Down

0 comments on commit 37f908f

Please sign in to comment.