Skip to content

Commit

Permalink
Fix cmd definition union issue for VS Code
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed Jul 7, 2023
1 parent 2296394 commit b44278c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 5 additions & 1 deletion gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
Template = PlotTemplateName | FilePath


class Cmds(BaseModel):
__root__: list[str]


class OutFlags(BaseModel):
cache: bool | None = Field(True, description="Cache output by DVC")
persist: bool | None = Field(
Expand Down Expand Up @@ -247,7 +251,7 @@ class Stage(BaseModel):
A named stage of a pipeline.
"""

cmd: str | list[str] = Field(..., description=CMD_DESC)
cmd: str | Cmds = Field(..., description=CMD_DESC)
wdir: str | None = Field(
None,
description="Working directory for the cmd, relative to `dvc.yaml`",
Expand Down
12 changes: 8 additions & 4 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@
]
}
},
"Cmds": {
"title": "Cmds",
"type": "array",
"items": {
"type": "string"
}
},
"DepModel": {
"title": "DepModel",
"description": "Path to a dependency (input) file or directory for the stage.",
Expand Down Expand Up @@ -367,10 +374,7 @@
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
"$ref": "#/definitions/Cmds"
}
]
},
Expand Down

0 comments on commit b44278c

Please sign in to comment.