From d762372d555536ef7c89df10aa5dbaa3dd670e62 Mon Sep 17 00:00:00 2001 From: skshetry Date: Thu, 15 Sep 2022 16:30:10 +0545 Subject: [PATCH] schema: add strict schema validation for top-level plots (#8289) schema: add strict schema validation for plots --- dvc/schema.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dvc/schema.py b/dvc/schema.py index 14311fc7e..5b5c24baf 100644 --- a/dvc/schema.py +++ b/dvc/schema.py @@ -55,7 +55,6 @@ OUT_PSTAGE_DETAILED_SCHEMA = { } PLOTS = "plots" -PLOTS_SCHEMA = dict PLOT_PROPS = { Output.PARAM_PLOT_TEMPLATE: str, Output.PARAM_PLOT_X: str, @@ -111,6 +110,15 @@ def either_or(primary, fallback, fallback_includes=None): return validator +PLOT_DEFINITION = { + Output.PARAM_PLOT_X: str, + Output.PARAM_PLOT_Y: Any(str, [str], {str: Any(str, [str])}), + Output.PARAM_PLOT_X_LABEL: str, + Output.PARAM_PLOT_Y_LABEL: str, + Output.PARAM_PLOT_TITLE: str, + Output.PARAM_PLOT_TEMPLATE: str, +} +PLOTS_SCHEMA = {str: Any(PLOT_DEFINITION, None)} FOREACH_IN = { Required(FOREACH_KWD): Any(dict, list, str), Required(DO_KWD): STAGE_DEFINITION,