{
  "$id": "https://niklasrosenstein.github.io/gitopsctr/schemas/apis/gitopsctr.io/v1/Stack/authored.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string"
    },
    "apiVersion": {
      "const": "gitopsctr.io/v1"
    },
    "kind": {
      "const": "Stack"
    },
    "metadata": {
      "additionalProperties": false,
      "properties": {
        "name": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "spec": {
      "additionalProperties": false,
      "properties": {
        "artifactImports": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "apiVersion": {
                "pattern": "^[^/]+/[^/]+$",
                "type": "string"
              },
              "fromPromotion": {
                "additionalProperties": false,
                "properties": {
                  "stack": {
                    "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
                    "type": "string"
                  }
                },
                "required": [
                  "stack"
                ],
                "title": "PromotionStackReference",
                "type": "object"
              },
              "kind": {
                "pattern": "^[A-Z][A-Za-z0-9]*$",
                "type": "string"
              },
              "name": {
                "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
                "type": "string"
              },
              "unit": {
                "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
                "type": "string"
              }
            },
            "required": [
              "unit",
              "name",
              "apiVersion",
              "kind",
              "fromPromotion"
            ],
            "title": "ArtifactImport",
            "type": "object"
          },
          "type": "array"
        },
        "parameters": {
          "type": "object"
        },
        "template": {
          "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
          "type": "string"
        },
        "units": {
          "anyOf": [
            {
              "items": {
                "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        }
      },
      "required": [
        "template"
      ],
      "type": "object"
    }
  },
  "required": [
    "apiVersion",
    "kind",
    "metadata",
    "spec"
  ],
  "title": "Stack (gitopsctr.io/v1)",
  "type": "object"
}
