Skip to content

Commit

Permalink
top-level plot collections: fail on empty dict (#10233)
Browse files Browse the repository at this point in the history
* top-level plot collections: skip empty dict

* tighten schema for plots; require key name
  • Loading branch information
skshetry authored Jan 12, 2024
1 parent d711ecd commit b46bd9c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions dvc/repo/plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ def _collect_pipeline_files(repo, targets: List[str], props, onerror=None):
if isinstance(elem, str):
dvcfile_defs_dict[elem] = None
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 b46bd9c

Please sign in to comment.