Skip to content

Commit b46bd9c

Browse files
authored
top-level plot collections: fail on empty dict (#10233)
* top-level plot collections: skip empty dict * tighten schema for plots; require key name
1 parent d711ecd commit b46bd9c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

dvc/repo/plots/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ def _collect_pipeline_files(repo, targets: List[str], props, onerror=None):
487487
if isinstance(elem, str):
488488
dvcfile_defs_dict[elem] = None
489489
else:
490+
assert elem
490491
k, v = next(iter(elem.items()))
491492
dvcfile_defs_dict[k] = v
492493

dvc/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def validator(data):
112112
Output.PARAM_PLOT_TITLE: str,
113113
Output.PARAM_PLOT_TEMPLATE: str,
114114
}
115-
SINGLE_PLOT_SCHEMA = {str: vol.Any(PLOT_DEFINITION, None)}
115+
SINGLE_PLOT_SCHEMA = {vol.Required(str): vol.Any(PLOT_DEFINITION, None)}
116116
ARTIFACTS = "artifacts"
117117
SINGLE_ARTIFACT_SCHEMA = vol.Schema({str: ARTIFACT_SCHEMA})
118118
FOREACH_IN = {

0 commit comments

Comments
 (0)