{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/dvc-yaml/latest.json",
  "title": "dvc.yaml",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/iterative/dvcyaml-schema/master/schema.json",
    "sourceSha256": "aabb0ba9a66e04429753d23bd6708c1fa2ff0dfa59e92f325f3caf934d5ae9b3",
    "fileMatch": [
      "dvc.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "vars": {
      "title": "Variables",
      "description": "List of values for substitution.\n\nMay include any dict or a path to a params file which may be a string or a dict to params in the file).\n\nUse elsewhere in `dvc.yaml` with the `${}` substitution expression.",
      "allOf": [
        {
          "$ref": "#/$defs/Vars"
        }
      ]
    },
    "stages": {
      "title": "Stages",
      "description": "List of stages that form a pipeline.",
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {
            "$ref": "#/$defs/ForeachDo"
          },
          {
            "$ref": "#/$defs/Matrix"
          },
          {
            "$ref": "#/$defs/Stage"
          }
        ]
      }
    },
    "plots": {
      "title": "Plots",
      "description": "Top level plots definition.",
      "oneOf": [
        {
          "$ref": "#/$defs/TopLevelPlots"
        },
        {
          "$ref": "#/$defs/TopLevelPlotsList"
        }
      ]
    },
    "params": {
      "title": "Params",
      "description": "List of parameter files",
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "metrics": {
      "title": "Metrics",
      "description": "List of metric files",
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "artifacts": {
      "title": "Artifacts",
      "description": "Top level artifacts definition.",
      "allOf": [
        {
          "$ref": "#/$defs/TopLevelArtifacts"
        }
      ]
    }
  },
  "additionalProperties": false,
  "$defs": {
    "VarPath": {
      "title": "VarPath",
      "description": "Path to params file with values for substitution.",
      "type": "string"
    },
    "VarDecl": {
      "title": "VarDecl",
      "description": "Dict of values for substitution.",
      "type": "object"
    },
    "Vars": {
      "title": "Vars",
      "type": "array",
      "items": {
        "oneOf": [
          {
            "$ref": "#/$defs/VarPath"
          },
          {
            "$ref": "#/$defs/VarDecl"
          }
        ]
      }
    },
    "DepModel": {
      "title": "DepModel",
      "description": "Path to a dependency (input) file or directory for the stage.",
      "type": "string"
    },
    "Dependencies": {
      "title": "Dependencies",
      "type": "array",
      "items": {
        "$ref": "#/$defs/DepModel"
      },
      "uniqueItems": true
    },
    "ParamKey": {
      "title": "ParamKey",
      "desc": "Parameter name (dot-separated).",
      "type": "string"
    },
    "CustomParamFileKeys": {
      "title": "CustomParamFileKeys",
      "desc": "Path to YAML/JSON/TOML/Python params file.",
      "type": "object",
      "additionalProperties": {
        "type": "array",
        "items": {
          "$ref": "#/$defs/ParamKey"
        },
        "uniqueItems": true
      }
    },
    "EmptyParamFileKeys": {
      "title": "EmptyParamFileKeys",
      "desc": "Path to YAML/JSON/TOML/Python params file.",
      "type": "object",
      "additionalProperties": {
        "type": "null"
      }
    },
    "Param": {
      "title": "Param",
      "oneOf": [
        {
          "$ref": "#/$defs/ParamKey"
        },
        {
          "$ref": "#/$defs/CustomParamFileKeys"
        },
        {
          "$ref": "#/$defs/EmptyParamFileKeys"
        }
      ]
    },
    "Params": {
      "title": "Params",
      "type": "array",
      "items": {
        "$ref": "#/$defs/Param"
      },
      "uniqueItems": true
    },
    "OutFlags": {
      "title": "OutFlags",
      "type": "object",
      "properties": {
        "cache": {
          "title": "Cache",
          "description": "Cache output by DVC",
          "default": true,
          "type": "boolean"
        },
        "persist": {
          "title": "Persist",
          "description": "Persist output between runs",
          "default": false,
          "type": "boolean"
        },
        "checkpoint": {
          "title": "Checkpoint",
          "description": "Indicate that the output is associated with in-code checkpoints",
          "default": false,
          "type": "boolean"
        },
        "desc": {
          "title": "Description",
          "description": "User description for the output",
          "type": "string"
        },
        "type": {
          "title": "Type",
          "description": "User assigned type of the output",
          "type": "string"
        },
        "labels": {
          "title": "Labels",
          "description": "User assigned labels of the output",
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "meta": {
          "title": "Meta",
          "description": "Custom metadata of the output.",
          "type": "object"
        },
        "remote": {
          "title": "Remote",
          "description": "Name of the remote to use for pushing/fetching",
          "type": "string"
        },
        "push": {
          "title": "Push",
          "description": "Whether the output should be pushed to remote during `dvc push`",
          "default": true,
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "Out": {
      "title": "Out",
      "description": "Path to an output file or dir of the stage.",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/OutFlags"
          }
        }
      ]
    },
    "Outs": {
      "title": "Outs",
      "type": "array",
      "items": {
        "$ref": "#/$defs/Out"
      },
      "uniqueItems": true
    },
    "PlotFlags": {
      "title": "PlotFlags",
      "type": "object",
      "properties": {
        "cache": {
          "title": "Cache",
          "description": "Cache output by DVC",
          "default": true,
          "type": "boolean"
        },
        "persist": {
          "title": "Persist",
          "description": "Persist output between runs",
          "default": false,
          "type": "boolean"
        },
        "checkpoint": {
          "title": "Checkpoint",
          "description": "Indicate that the output is associated with in-code checkpoints",
          "default": false,
          "type": "boolean"
        },
        "desc": {
          "title": "Description",
          "description": "User description for the output",
          "type": "string"
        },
        "type": {
          "title": "Type",
          "description": "User assigned type of the output",
          "type": "string"
        },
        "labels": {
          "title": "Labels",
          "description": "User assigned labels of the output",
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "meta": {
          "title": "Meta",
          "description": "Custom metadata of the output.",
          "type": "object"
        },
        "remote": {
          "title": "Remote",
          "description": "Name of the remote to use for pushing/fetching",
          "type": "string"
        },
        "push": {
          "title": "Push",
          "description": "Whether the output should be pushed to remote during `dvc push`",
          "default": true,
          "type": "boolean"
        },
        "x": {
          "title": "X",
          "description": "Default field name to use as x-axis data",
          "type": "string"
        },
        "y": {
          "title": "Y",
          "description": "Default field name to use as y-axis data",
          "type": "string"
        },
        "x_label": {
          "title": "X Label",
          "description": "Default label for the x-axis",
          "type": "string"
        },
        "y_label": {
          "title": "Y Label",
          "description": "Default label for the y-axis",
          "type": "string"
        },
        "title": {
          "title": "Title",
          "description": "Default plot title",
          "type": "string"
        },
        "header": {
          "title": "Header",
          "description": "Whether the target CSV or TSV has a header or not",
          "default": false,
          "type": "boolean"
        },
        "template": {
          "title": "Template",
          "description": "Default plot template",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "Plot": {
      "title": "Plot",
      "description": "Path to plots file or dir of the stage.\n\nData files may be JSON/YAML/CSV/TSV.\n\nImage files may be JPEG/GIF/PNG.",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/PlotFlags"
          }
        }
      ]
    },
    "Plots": {
      "title": "Plots",
      "type": "array",
      "items": {
        "$ref": "#/$defs/Plot"
      },
      "uniqueItems": true
    },
    "Stage": {
      "title": "Stage",
      "description": "A named stage of a pipeline.",
      "type": "object",
      "properties": {
        "cmd": {
          "title": "Cmd",
          "description": "(Required) Command to run (anything your system terminal can run).\n\nCan be a string or a list of commands.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "wdir": {
          "title": "Wdir",
          "description": "Working directory for the cmd, relative to `dvc.yaml`",
          "type": "string"
        },
        "deps": {
          "title": "Deps",
          "description": "List of the dependencies for the stage.",
          "allOf": [
            {
              "$ref": "#/$defs/Dependencies"
            }
          ]
        },
        "params": {
          "title": "Params",
          "description": "List of dot-separated parameter dependency keys to track from `params.yaml`.\n\nMay contain other YAML/JSON/TOML/Python parameter file names, with a sub-list of the param names to track in them (leave empty to include all).",
          "allOf": [
            {
              "$ref": "#/$defs/Params"
            }
          ]
        },
        "outs": {
          "title": "Outs",
          "description": "List of the outputs of the stage.",
          "allOf": [
            {
              "$ref": "#/$defs/Outs"
            }
          ]
        },
        "metrics": {
          "title": "Metrics",
          "description": "List of metrics of the stage written to JSON/TOML/YAML.",
          "allOf": [
            {
              "$ref": "#/$defs/Outs"
            }
          ]
        },
        "plots": {
          "title": "Plots",
          "description": "List of plots of the stage for visualization.\n\nPlots may be written to JSON/YAML/CSV/TSV for data or JPEG/GIF/PNG for images.",
          "allOf": [
            {
              "$ref": "#/$defs/Plots"
            }
          ]
        },
        "frozen": {
          "title": "Frozen",
          "description": "Assume stage as unchanged",
          "default": false,
          "type": "boolean"
        },
        "always_changed": {
          "title": "Always Changed",
          "description": "Assume stage as always changed",
          "default": false,
          "type": "boolean"
        },
        "vars": {
          "title": "Vars",
          "description": "List of stage-specific values for substitution.\n\nMay include any dict or a path to a params file.\n\nUse in the stage with the `${}` substitution expression.",
          "allOf": [
            {
              "$ref": "#/$defs/Vars"
            }
          ]
        },
        "desc": {
          "title": "Desc",
          "description": "Description of the stage",
          "type": "string"
        },
        "meta": {
          "title": "Meta",
          "description": "Additional information/metadata"
        }
      },
      "required": [
        "cmd"
      ],
      "additionalProperties": false
    },
    "ForeachDo": {
      "title": "ForeachDo",
      "type": "object",
      "properties": {
        "foreach": {
          "title": "Foreach",
          "description": "Iterable to loop through in foreach. Can be a parametrized string, list or a dict.\n\nThe stages will be generated by iterating through this data, by substituting data in the `do` block.",
          "oneOf": [
            {
              "type": "string",
              "pattern": "^\\$\\{.*?\\}$"
            },
            {
              "type": "array",
              "items": {}
            },
            {
              "type": "object"
            }
          ]
        },
        "do": {
          "title": "Do",
          "description": "Parametrized stage definition that'll be substituted over for each of the value from the foreach data.",
          "allOf": [
            {
              "$ref": "#/$defs/Stage"
            }
          ]
        }
      },
      "required": [
        "foreach",
        "do"
      ],
      "additionalProperties": false
    },
    "Matrix": {
      "title": "Matrix",
      "description": "A named stage of a pipeline.",
      "type": "object",
      "properties": {
        "cmd": {
          "title": "Cmd",
          "description": "(Required) Command to run (anything your system terminal can run).\n\nCan be a string or a list of commands.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "wdir": {
          "title": "Wdir",
          "description": "Working directory for the cmd, relative to `dvc.yaml`",
          "type": "string"
        },
        "deps": {
          "title": "Deps",
          "description": "List of the dependencies for the stage.",
          "allOf": [
            {
              "$ref": "#/$defs/Dependencies"
            }
          ]
        },
        "params": {
          "title": "Params",
          "description": "List of dot-separated parameter dependency keys to track from `params.yaml`.\n\nMay contain other YAML/JSON/TOML/Python parameter file names, with a sub-list of the param names to track in them (leave empty to include all).",
          "allOf": [
            {
              "$ref": "#/$defs/Params"
            }
          ]
        },
        "outs": {
          "title": "Outs",
          "description": "List of the outputs of the stage.",
          "allOf": [
            {
              "$ref": "#/$defs/Outs"
            }
          ]
        },
        "metrics": {
          "title": "Metrics",
          "description": "List of metrics of the stage written to JSON/TOML/YAML.",
          "allOf": [
            {
              "$ref": "#/$defs/Outs"
            }
          ]
        },
        "plots": {
          "title": "Plots",
          "description": "List of plots of the stage for visualization.\n\nPlots may be written to JSON/YAML/CSV/TSV for data or JPEG/GIF/PNG for images.",
          "allOf": [
            {
              "$ref": "#/$defs/Plots"
            }
          ]
        },
        "frozen": {
          "title": "Frozen",
          "description": "Assume stage as unchanged",
          "default": false,
          "type": "boolean"
        },
        "always_changed": {
          "title": "Always Changed",
          "description": "Assume stage as always changed",
          "default": false,
          "type": "boolean"
        },
        "vars": {
          "title": "Vars",
          "description": "List of stage-specific values for substitution.\n\nMay include any dict or a path to a params file.\n\nUse in the stage with the `${}` substitution expression.",
          "allOf": [
            {
              "$ref": "#/$defs/Vars"
            }
          ]
        },
        "desc": {
          "title": "Desc",
          "description": "Description of the stage",
          "type": "string"
        },
        "meta": {
          "title": "Meta",
          "description": "Additional information/metadata"
        },
        "matrix": {
          "title": "Matrix",
          "description": "Generate stages based on combination of variables.\n\nThe variable can be a list of values, or a parametrized string referencing a list.",
          "type": "object",
          "additionalProperties": {
            "oneOf": [
              {
                "type": "array",
                "items": {}
              },
              {
                "type": "string",
                "pattern": "^\\$\\{.*?\\}$"
              }
            ]
          }
        }
      },
      "required": [
        "cmd",
        "matrix"
      ],
      "additionalProperties": false
    },
    "X": {
      "title": "X",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "Y": {
      "title": "Y",
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            },
            "uniqueItems": true
          }
        ]
      }
    },
    "TopLevelPlotFlags": {
      "title": "TopLevelPlotFlags",
      "type": "object",
      "properties": {
        "x": {
          "title": "X",
          "description": "A single column name, or a dictionary of data-source and column pair",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/$defs/X"
            }
          ]
        },
        "y": {
          "title": "Y",
          "description": "A single column name, list of columns, or a dictionary of data-source and column pair",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              },
              "uniqueItems": true
            },
            {
              "$ref": "#/$defs/Y"
            }
          ]
        },
        "x_label": {
          "title": "X Label",
          "description": "Default label for the x-axis",
          "type": "string"
        },
        "y_label": {
          "title": "Y Label",
          "description": "Default label for the y-axis",
          "type": "string"
        },
        "title": {
          "title": "Title",
          "description": "Default plot title",
          "type": "string"
        },
        "template": {
          "title": "Template",
          "description": "Default plot template",
          "default": "linear",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "EmptyTopLevelPlotFlags": {
      "title": "EmptyTopLevelPlotFlags",
      "type": "null"
    },
    "TopLevelPlots": {
      "title": "TopLevelPlots",
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {
            "$ref": "#/$defs/TopLevelPlotFlags"
          },
          {
            "$ref": "#/$defs/EmptyTopLevelPlotFlags"
          }
        ]
      }
    },
    "TopLevelPlotsList": {
      "title": "TopLevelPlotsList",
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "$ref": "#/$defs/TopLevelPlots"
          }
        ]
      }
    },
    "TopLevelArtifactFlags": {
      "title": "TopLevelArtifactFlags",
      "type": "object",
      "properties": {
        "path": {
          "title": "Path",
          "description": "Path to the artifact",
          "type": "string"
        },
        "type": {
          "title": "Type",
          "description": "Type of the artifact",
          "type": "string"
        },
        "desc": {
          "title": "Desc",
          "description": "Description for the artifact",
          "type": "string"
        },
        "meta": {
          "title": "Meta",
          "description": "Custom metadata for the artifact",
          "type": "object"
        },
        "labels": {
          "title": "Labels",
          "description": "Labels for the artifact",
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        }
      },
      "required": [
        "path"
      ],
      "additionalProperties": false
    },
    "TopLevelArtifacts": {
      "title": "TopLevelArtifacts",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/TopLevelArtifactFlags"
      },
      "patternProperties": {
        "^[a-z0-9]([a-z0-9-/]*[a-z0-9])?$": {
          "$ref": "#/$defs/TopLevelArtifactFlags"
        }
      }
    }
  }
}
