diff --git a/lib/galaxy/tool_util/schemas/test_file_from_xsd.py b/lib/galaxy/tool_util/schemas/test_file_from_xsd.py index d9e833de6887..b410962900f8 100644 --- a/lib/galaxy/tool_util/schemas/test_file_from_xsd.py +++ b/lib/galaxy/tool_util/schemas/test_file_from_xsd.py @@ -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()`.` @@ -14,6 +17,7 @@ from pydantic import ( BaseModel, ConfigDict, + Field, RootModel, ) from pydantic.dataclasses import dataclass @@ -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): diff --git a/lib/galaxy/tool_util/schemas/test_file_schema.json b/lib/galaxy/tool_util/schemas/test_file_schema.json index cd7c591478f6..6993898502f1 100644 --- a/lib/galaxy/tool_util/schemas/test_file_schema.json +++ b/lib/galaxy/tool_util/schemas/test_file_schema.json @@ -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, @@ -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": { @@ -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" ],