Skip to content
/ dvc Public
forked from iterative/dvc

Commit

Permalink
don't allow loading stages without cmd
Browse files Browse the repository at this point in the history
This was loosened when introducing parametrization.
But, `foreach`..`do` should be considered first
before stage's regular structure. And, cmd is made
required (as it should have been)

Related: iterative#5371, iterative#5370, iterative#5312
  • Loading branch information
skshetry committed Feb 1, 2021
1 parent bb46043 commit 7d9b6aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dvc/schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from voluptuous import Any, Optional, Required, Schema
from voluptuous import Any, Exclusive, Optional, Required, Schema

from dvc import dependency, output
from dvc.hash_info import HashInfo
Expand Down Expand Up @@ -79,7 +79,7 @@
VARS_SCHEMA = [str, dict]

STAGE_DEFINITION = {
StageParams.PARAM_CMD: Any(str, list),
Required(StageParams.PARAM_CMD): Any(str, list),
Optional(StageParams.PARAM_WDIR): str,
Optional(StageParams.PARAM_DEPS): [str],
Optional(StageParams.PARAM_PARAMS): [Any(str, dict)],
Expand All @@ -100,7 +100,7 @@
Required(FOREACH_KWD): Any(dict, list, str),
Required(DO_KWD): STAGE_DEFINITION,
}
SINGLE_PIPELINE_STAGE_SCHEMA = {str: Any(STAGE_DEFINITION, FOREACH_IN)}
SINGLE_PIPELINE_STAGE_SCHEMA = {str: Exclusive(FOREACH_IN, STAGE_DEFINITION)}
MULTI_STAGE_SCHEMA = {
STAGES: SINGLE_PIPELINE_STAGE_SCHEMA,
VARS_KWD: VARS_SCHEMA,
Expand Down

0 comments on commit 7d9b6aa

Please sign in to comment.