{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://slipstream.dev/schema/recipe-v1.json",
  "title": "RunsGreen recipe v1",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "format": "uri"
    },
    "version": {
      "type": "number",
      "const": 1
    },
    "extends": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]*@\\d+$"
    },
    "kind": {
      "type": "string",
      "enum": [
        "ci",
        "deploy",
        "artifact"
      ]
    },
    "env": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "string",
        "maxLength": 4096
      }
    },
    "secrets": {
      "minItems": 1,
      "maxItems": 8,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "const": "infisical"
          },
          "projectId": {
            "type": "string",
            "minLength": 1
          },
          "env": {
            "type": "string",
            "minLength": 1
          },
          "path": {
            "type": "string",
            "minLength": 1
          },
          "tokenEnv": {
            "type": "string",
            "pattern": "^[A-Z0-9_]{1,64}$"
          }
        },
        "required": [
          "from",
          "projectId",
          "env",
          "path"
        ],
        "additionalProperties": false
      }
    },
    "disable": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 40
      }
    },
    "envKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "toolRepos": {
      "maxItems": 8,
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[\\w.-]+\\/[\\w.-]+$"
      }
    },
    "stages": {
      "minItems": 0,
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              "cmd": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "env": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string",
                  "maxLength": 4096
                }
              },
              "timeout_s": {
                "type": "integer",
                "minimum": 30,
                "maximum": 1800
              },
              "secrets": {
                "type": "boolean"
              },
              "affected": {
                "type": "boolean"
              },
              "if_changed": {
                "maxItems": 64,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 4096
                }
              },
              "coverage_summary": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "after": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              }
            },
            "required": [
              "name",
              "cmd"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "parallel": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "cmd": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    },
                    "env": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "maxLength": 4096
                      }
                    },
                    "timeout_s": {
                      "type": "integer",
                      "minimum": 30,
                      "maximum": 1800
                    },
                    "secrets": {
                      "type": "boolean"
                    },
                    "affected": {
                      "type": "boolean"
                    },
                    "if_changed": {
                      "maxItems": 64,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 4096
                      }
                    },
                    "coverage_summary": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 256
                    },
                    "after": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    }
                  },
                  "required": [
                    "name",
                    "cmd"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "parallel"
            ],
            "additionalProperties": false
          }
        ]
      }
    }
  },
  "required": [
    "version",
    "stages"
  ],
  "additionalProperties": false
}
