mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:12:08 +08:00
Add a few annotations to test out schema info rendering
This commit is contained in:
@@ -19,7 +19,6 @@ from typing import (
|
||||
|
||||
import packaging.version
|
||||
from typing_extensions import (
|
||||
Literal,
|
||||
NotRequired,
|
||||
TypedDict,
|
||||
)
|
||||
|
||||
@@ -92,7 +92,14 @@ class UserToolSource(BaseModel):
|
||||
description: Optional[str] = None
|
||||
container: str
|
||||
requirements: Optional[List[Union[JavascriptRequirement, ResourceRequirement, ContainerRequirement]]] = []
|
||||
shell_command: str
|
||||
shell_command: Annotated[
|
||||
str,
|
||||
Field(
|
||||
title="shell_command",
|
||||
description="A string that contains the command to be executed. Parameters can be referenced inside $().",
|
||||
examples=["head -n '$(inputs.n_lines)' '$(inputs.data_input.path)'"],
|
||||
),
|
||||
]
|
||||
inputs: List[GalaxyToolParameterModel] = []
|
||||
outputs: List[IncomingToolOutput] = []
|
||||
citations: Optional[List[Citation]] = None
|
||||
|
||||
@@ -33,8 +33,10 @@ IncomingNotRequiredDatasetCollectionDescription = NotRequired[List["DatasetColle
|
||||
|
||||
|
||||
class ToolOutputBaseModelG(BaseModel, Generic[IncomingNotRequiredBoolT, IncomingNotRequiredStringT]):
|
||||
name: IncomingNotRequiredStringT
|
||||
label: Optional[str] = None
|
||||
name: Annotated[
|
||||
IncomingNotRequiredStringT, Field(description="Parameter name. Used when referencing parameter in workflows.")
|
||||
]
|
||||
label: Optional[Annotated[str, Field(description="Output label. Will be used as dataset name in history.")]] = None
|
||||
hidden: IncomingNotRequiredBoolT
|
||||
|
||||
|
||||
@@ -46,11 +48,19 @@ class ToolOutputDatasetG(
|
||||
Generic[IncomingNotRequiredBoolT, IncomingNotRequiredStringT],
|
||||
):
|
||||
type: Literal["data"]
|
||||
format: IncomingNotRequiredStringT
|
||||
format: Annotated[IncomingNotRequiredStringT, Field(description="The short name for the output datatype.")]
|
||||
format_source: Optional[str] = None
|
||||
metadata_source: Optional[str] = None
|
||||
discover_datasets: Optional[List["DatasetCollectionDescriptionT"]] = None
|
||||
from_work_dir: Optional[str] = None
|
||||
from_work_dir: Optional[
|
||||
Annotated[
|
||||
str,
|
||||
Field(
|
||||
title="from_work_dir",
|
||||
description="Relative path to a file produced by the tool in its working directory. Output’s contents are set to this file’s contents.",
|
||||
),
|
||||
]
|
||||
] = None
|
||||
|
||||
|
||||
ToolOutputDataset = ToolOutputDatasetG[bool, str]
|
||||
|
||||
@@ -5,8 +5,12 @@ from typing import (
|
||||
Union,
|
||||
)
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import (
|
||||
BaseModel,
|
||||
Field,
|
||||
)
|
||||
from typing_extensions import (
|
||||
Annotated,
|
||||
Literal,
|
||||
NotRequired,
|
||||
TypedDict,
|
||||
@@ -56,7 +60,26 @@ class ResourceRequirement(BaseModel):
|
||||
|
||||
class JavascriptRequirement(BaseModel):
|
||||
type: Literal["javascript"]
|
||||
expression_lib: Optional[List[str]]
|
||||
expression_lib: Optional[
|
||||
List[
|
||||
Annotated[
|
||||
str,
|
||||
Field(
|
||||
title="expression_lib",
|
||||
description="Provide Javascript/ECMAScript 5.1 code here that will be available for expressions inside the `shell_command` field.",
|
||||
examples=[
|
||||
r"""function pickValue() {
|
||||
if (inputs.conditional_parameter.test_parameter == "a") {
|
||||
return inputs.conditional_parameter.integer_parameter
|
||||
} else {
|
||||
return inputs.conditional_parameter.boolean_parameter
|
||||
}
|
||||
}"""
|
||||
],
|
||||
),
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
class XrefDict(TypedDict):
|
||||
|
||||
Reference in New Issue
Block a user