{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/liquibase-flow-file/latest.json",
  "title": "Liquibase Flow File",
  "x-lintel": {
    "source": "https://www.liquibase.org/json/schema/liquibase-flow-file-latest.json",
    "sourceSha256": "209a621df828f46dfcd0b0d3ce020988d87973f6b90f99fb8ee9eef7222ff8ca",
    "fileMatch": [
      "*.flowfile.yaml",
      "*.flowfile.yml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "include": {
      "$ref": "#/$defs/variable",
      "description": "Include other properties files as global variables, accessible in any stage. The key value pairs in the included file are imported with a prefix appended; the prefix is specified here as the key."
    },
    "globalVariables": {
      "$ref": "#/$defs/variable",
      "description": "Variables which can be accessed in any stage. Variables can be used in the definition of other variables, and may be defined in any order."
    },
    "stages": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/stage"
      }
    },
    "endStage": {
      "$ref": "#/$defs/stage",
      "description": "This stage runs after all of the stages in the stages block. The end stage is guaranteed to execute. If there is an exception in any stage, the end stage will still execute."
    }
  },
  "required": [
    "stages"
  ],
  "$defs": {
    "variable": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^[a-zA-Z0-9._-]+$": {
          "type": "string"
        }
      }
    },
    "stage": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "globalArgs": {
          "$ref": "#/$defs/variable"
        },
        "stageVariables": {
          "$ref": "#/$defs/variable",
          "description": "Variables which can be accessed only in this stage. Variables can be used in the definition of other variables, and may be defined in any order."
        },
        "actions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/action"
          },
          "description": "The actions to run in this stage."
        },
        "if": {
          "type": [
            "string",
            "null"
          ],
          "description": "Conditional control of whether the stage is executed or skipped"
        }
      },
      "required": [
        "actions"
      ],
      "additionalProperties": false
    },
    "action": {
      "type": "object",
      "properties": {
        "type": {
          "type": [
            "string",
            "null"
          ],
          "description": "Specify the type of the action. If omitted or left empty, it is assumed that the type is 'liquibase'."
        },
        "if": {
          "type": [
            "string",
            "null"
          ],
          "description": "Conditional control of whether the stage is executed or skipped"
        },
        "continueOnError": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Prevents a flow from failing when an action fails. Set to true to continue execution after the failing action."
        }
      },
      "additionalProperties": {
        "type": [
          "number",
          "string",
          "boolean",
          "object",
          "array",
          "null"
        ]
      }
    }
  },
  "additionalProperties": false
}
