{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/hammerkit.json",
  "$comment": "https://no0dles.gitbook.io",
  "additionalProperties": false,
  "definitions": {
    "buildFileEnvs": {
      "title": "environment variables",
      "description": "Environment values for the current build task\nhttps://no0dles.gitbook.io/hammerkit/build-file/environment-variables",
      "type": "object",
      "additionalProperties": {
        "description": "environment variable",
        "type": "string"
      }
    },
    "buildFileTasks": {
      "title": "tasks",
      "description": "Task for the current build file\nhttps://no0dles.gitbook.io/hammerkit/task",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/task"
      }
    },
    "buildFileServices": {
      "title": "services",
      "description": "Services for the current build file\nhttps://no0dles.gitbook.io/hammerkit/service",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/service"
      }
    },
    "buildFileIncludes": {
      "title": "includes",
      "description": "Includes to other build files\nhttps://no0dles.gitbook.io/hammerkit/build-file/includes",
      "type": "object",
      "additionalProperties": {
        "$ref": "https://json.schemastore.org/base.json#/definitions/path"
      }
    },
    "buildFileReferences": {
      "title": "references",
      "description": "References to other build files\nhttps://no0dles.gitbook.io/hammerkit/build-file/references",
      "type": "object",
      "additionalProperties": {
        "$ref": "https://json.schemastore.org/base.json#/definitions/path"
      }
    },
    "task": {
      "title": "task",
      "description": "Task for the current build file\nhttps://no0dles.gitbook.io/hammerkit/task",
      "anyOf": [
        {
          "$ref": "#/definitions/containerTask"
        },
        {
          "$ref": "#/definitions/localTask"
        }
      ]
    },
    "localTask": {
      "title": "local task",
      "description": "Task that gets executed in the local shell in the current directory",
      "type": "object",
      "additionalProperties": false,
      "required": ["cmds"],
      "properties": {
        "description": {
          "$ref": "#/definitions/taskCommand"
        },
        "labels": {
          "$ref": "#/definitions/taskLabels"
        },
        "extend": {
          "$ref": "#/definitions/taskExtend"
        },
        "cache": {
          "$ref": "#/definitions/taskCache"
        },
        "continuous": {
          "$ref": "#/definitions/taskContinuous"
        },
        "envs": {
          "$ref": "#/definitions/taskEnvs"
        },
        "needs": {
          "$ref": "#/definitions/taskNeeds"
        },
        "deps": {
          "$ref": "#/definitions/taskDeps"
        },
        "src": {
          "$ref": "#/definitions/taskSrc"
        },
        "generates": {
          "$ref": "#/definitions/taskGenerates"
        },
        "cmds": {
          "description": "Commands for the current task",
          "type": "array",
          "items": {
            "$ref": "#/definitions/taskCommand"
          }
        }
      }
    },
    "containerTask": {
      "title": "container task",
      "description": "Container task for the current build file\nhttps://no0dles.gitbook.io/hammerkit/task/container",
      "type": "object",
      "required": ["image", "cmds"],
      "additionalProperties": false,
      "properties": {
        "description": {
          "$ref": "#/definitions/taskCommand"
        },
        "extend": {
          "$ref": "#/definitions/taskExtend"
        },
        "labels": {
          "$ref": "#/definitions/taskLabels"
        },
        "cache": {
          "$ref": "#/definitions/taskCache"
        },
        "continuous": {
          "$ref": "#/definitions/taskContinuous"
        },
        "envs": {
          "$ref": "#/definitions/taskEnvs"
        },
        "needs": {
          "$ref": "#/definitions/taskNeeds"
        },
        "deps": {
          "$ref": "#/definitions/taskDeps"
        },
        "src": {
          "$ref": "#/definitions/taskSrc"
        },
        "generates": {
          "$ref": "#/definitions/taskGenerates"
        },
        "cmds": {
          "description": "Commands for the current task",
          "type": "array",
          "items": {
            "$ref": "#/definitions/taskCommand"
          }
        },
        "shell": {
          "title": "task shell",
          "description": "Define which shell is used to execute the commands",
          "type": "string"
        },
        "image": {
          "title": "task image",
          "description": "Container image for the current task to run commands in",
          "type": "string"
        },
        "ports": {
          "description": "A list of ports that get exposed on the host from the container <localPort>:<targetPort>",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "description": "<localPort>:<targetPort>",
            "type": "string",
            "pattern": "\\d+:\\d+"
          }
        },
        "mounts": {
          "description": "File paths that get mounted into the container\nhttps://no0dles.gitbook.io/hammerkit/task/container#adding-mounts",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "\\d+:\\d+"
          }
        }
      }
    },
    "taskCommand": {
      "anyOf": [
        {
          "title": "command",
          "description": "Command to be executed for the current task",
          "type": "string"
        },
        {
          "title": "task command with path extension",
          "description": "Command to be executed in sub directory for the current task",
          "type": "object",
          "additionalProperties": false,
          "required": ["cmd"],
          "properties": {
            "cmd": {
              "title": "command",
              "description": "Command to be executed for the task",
              "type": "string"
            },
            "path": {
              "$ref": "https://json.schemastore.org/base.json#/definitions/path",
              "title": "command path",
              "description": "Path below build file path"
            }
          }
        }
      ]
    },
    "taskDescription": {
      "description": "Description for the current task",
      "type": "string"
    },
    "taskExtend": {
      "description": "Extension task as a base template\nhttps://no0dles.gitbook.io/hammerkit/task/extending",
      "type": "string"
    },
    "taskCache": {
      "description": "compare type for detecting changes in source files\nhttps://no0dles.gitbook.io/hammerkit/task/caching",
      "type": "string",
      "enum": ["checksum", "modify-date", "none"]
    },
    "taskContinuous": {
      "description": "The task runs continuous and does not end without cancellation\nhttps://no0dles.gitbook.io/hammerkit/task/watching#continuous-tasks",
      "type": "boolean"
    },
    "taskLabels": {
      "title": "label options",
      "description": "A map of label values for the current task\nhttps://no0dles.gitbook.io/hammerkit/labels",
      "type": "object",
      "additionalProperties": {
        "description": "label value",
        "type": "string"
      }
    },
    "taskEnvs": {
      "title": "task environment variables",
      "description": "Environment values for the current build file\nhttps://no0dles.gitbook.io/hammerkit/build-file/environment-variables",
      "type": "object",
      "additionalProperties": {
        "description": "environment value",
        "type": "string"
      }
    },
    "taskNeeds": {
      "description": "Service needs that need to get ready before the current task\nhttps://no0dles.gitbook.io/hammerkit/task/needs",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string"
      }
    },
    "taskDeps": {
      "description": "Task dependencies that get executed before the current task\nhttps://no0dles.gitbook.io/hammerkit/task/dependencies",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string"
      }
    },
    "taskSrc": {
      "description": "Source files and folders for the current task\nhttps://no0dles.gitbook.io/hammerkit/task#source",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "$ref": "https://json.schemastore.org/base.json#/definitions/path"
      }
    },
    "taskGenerates": {
      "description": "Generated files and folders for the current task\n\nhttps://no0dles.gitbook.io/hammerkit/task#generate",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "$ref": "https://json.schemastore.org/base.json#/definitions/path"
      }
    },
    "service": {
      "title": "service",
      "description": "A daemon in the background",
      "anyOf": [
        {
          "$ref": "#/definitions/containerService"
        },
        {
          "$ref": "#/definitions/kubernetesService"
        }
      ]
    },
    "kubernetesService": {
      "title": "kubernetes service",
      "description": "Kubernetes service for the current build file\nhttps://no0dles.gitbook.io/hammerkit/service/kubernetes",
      "type": "object",
      "required": ["context", "selector", "ports"],
      "additionalProperties": false,
      "properties": {
        "kubeconfig": {
          "description": "Kube config for the current service\nhttps://no0dles.gitbook.io/hammerkit/service/kubernetes#config",
          "type": "string"
        },
        "context": {
          "description": "Kubernetes context for the current service\nhttps://no0dles.gitbook.io/hammerkit/service/kubernetes#config",
          "type": "string"
        },
        "ports": {
          "description": "A list of ports that get exposed on the host from the service <localPort>:<targetPort>",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "description": "<localPort>:<targetPort>",
            "type": "string",
            "pattern": "\\d+:\\d+"
          }
        },
        "selector": {
          "title": "service selector",
          "description": "Selector to specify which resource gets forwarded to\nhttps://no0dles.gitbook.io/hammerkit/service/kubernetes",
          "type": "object",
          "required": ["type", "name"],
          "additionalProperties": false,
          "properties": {
            "type": {
              "description": "resource type for the current service",
              "type": "string",
              "enum": ["deployment", "service", "pod"]
            },
            "name": {
              "description": "resource name for the kubernetes resource",
              "type": "string"
            }
          }
        }
      }
    },
    "containerService": {
      "title": "container service",
      "description": "Container service for the current build file\nhttps://no0dles.gitbook.io/hammerkit/service/kubernetes",
      "type": "object",
      "required": ["image"],
      "additionalProperties": false,
      "properties": {
        "labels": {
          "title": "label options",
          "description": "A map of label values for the current service\nhttps://no0dles.gitbook.io/hammerkit/labels",
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "envs": {
          "title": "service environment variables",
          "description": "Environment values for the current service\nhttps://no0dles.gitbook.io/hammerkit/build-file/environment-variables",
          "type": "object",
          "additionalProperties": {
            "description": "environment value",
            "type": "string"
          }
        },
        "healthcheck": {
          "title": "service healthcheck",
          "description": "Check to detect if the service is started and ready\nhttps://no0dles.gitbook.io/hammerkit/service/container#healthcheck",
          "type": "object",
          "required": ["cmd"],
          "additionalProperties": false,
          "properties": {
            "cmd": {
              "description": "task to check if the service is healthy",
              "type": "string"
            }
          }
        },
        "image": {
          "description": "Container image for the current service to run commands in",
          "type": "string"
        },
        "ports": {
          "description": "A list of ports that get exposed on the host from the container <localPort>:<targetPort>\nhttps://no0dles.gitbook.io/hammerkit/service/container#mounts",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "description": "<localPort>:<targetPort>",
            "type": "string",
            "pattern": "\\d+:\\d+"
          }
        },
        "volumes": {
          "description": "A list of volumes that get attached to the container <name>:<containerPath>\nhttps://no0dles.gitbook.io/hammerkit/service/container#mounts",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "description": "<name>:<containerPath>",
            "type": "string",
            "pattern": "\\d+:\\d+"
          }
        },
        "mounts": {
          "description": "File paths that get mounted into the container <localPath>:<containerPath>\nhttps://no0dles.gitbook.io/hammerkit/service/container#mounts",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "description": "<localPath>:<containerPath>",
            "pattern": "\\d+:\\d+"
          }
        }
      }
    }
  },
  "description": "Build tool with support for containerization\nhttps://no0dles.gitbook.io/hammerkit/build-file",
  "properties": {
    "envs": {
      "$ref": "#/definitions/buildFileEnvs"
    },
    "tasks": {
      "$ref": "#/definitions/buildFileTasks"
    },
    "services": {
      "$ref": "#/definitions/buildFileServices"
    },
    "includes": {
      "$ref": "#/definitions/buildFileIncludes"
    },
    "references": {
      "$ref": "#/definitions/buildFileReferences"
    }
  },
  "title": "JSON Schema for hammerkit's build file",
  "type": "object"
}
