Skip to content

Commit

Permalink
tighten schema for plots; require key name
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed Jan 12, 2024
1 parent cfeb6bc commit 3a82fba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dvc/repo/plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ def _collect_pipeline_files(repo, targets: List[str], props, onerror=None):
for elem in plots_def:
if isinstance(elem, str):
dvcfile_defs_dict[elem] = None
elif elem:
else:
assert elem
k, v = next(iter(elem.items()))
dvcfile_defs_dict[k] = v

Expand Down
2 changes: 1 addition & 1 deletion dvc/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def validator(data):
Output.PARAM_PLOT_TITLE: str,
Output.PARAM_PLOT_TEMPLATE: str,
}
SINGLE_PLOT_SCHEMA = {str: vol.Any(PLOT_DEFINITION, None)}
SINGLE_PLOT_SCHEMA = {vol.Required(str): vol.Any(PLOT_DEFINITION, None)}
ARTIFACTS = "artifacts"
SINGLE_ARTIFACT_SCHEMA = vol.Schema({str: ARTIFACT_SCHEMA})
FOREACH_IN = {
Expand Down

0 comments on commit 3a82fba

Please sign in to comment.