{
  "$id": "https://json.schemastore.org/azure-deviceupdate-manifest-definitions-4.0.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "updateId": {
      "type": "object",
      "title": "Update identity",
      "description": "Unique update identifier.",
      "properties": {
        "provider": {
          "type": "string",
          "title": "Update provider",
          "description": "Entity who is creating or directly responsible for the update. It can be a company name.",
          "minLength": 1,
          "maxLength": 64,
          "pattern": "^[a-zA-Z0-9.-]+$"
        },
        "name": {
          "type": "string",
          "title": "Update name",
          "description": "Identifier for a class of update. It can be a device class or model name.",
          "minLength": 1,
          "maxLength": 64,
          "pattern": "^[a-zA-Z0-9.-]+$"
        },
        "version": {
          "type": "string",
          "title": "Update version",
          "description": "Two to four part dot separated numerical version numbers. Each part must be a number between 0 and 2147483647 and leading zeroes will be dropped.",
          "pattern": "^\\d+(?:\\.\\d+)+$",
          "examples": ["1.0", "2021.11.8"]
        }
      },
      "additionalProperties": false,
      "required": ["provider", "name", "version"]
    },
    "compatibility": {
      "type": "array",
      "title": "Update compatibility",
      "description": "List of device property sets this update is compatible with.",
      "items": {
        "$ref": "azure-deviceupdate-manifest-definitions-4.0.json#/definitions/compatibilityInfo"
      },
      "minItems": 1,
      "maxItems": 10
    },
    "compatibilityInfo": {
      "type": "object",
      "title": "Update compatibility info",
      "description": "Properties of a device this update is compatible with.",
      "additionalProperties": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "propertyNames": {
          "minLength": 1,
          "maxLength": 32
        }
      },
      "minProperties": 1,
      "maxProperties": 5
    },
    "file": {
      "type": "object",
      "title": "Update file",
      "description": "Update payload file, e.g. binary, firmware, script, etc. Must be unique within update.",
      "properties": {
        "filename": {
          "$ref": "azure-deviceupdate-manifest-definitions-4.0.json#/definitions/filename"
        },
        "sizeInBytes": {
          "type": "number",
          "title": "File size",
          "description": "File size in number of bytes.",
          "minimum": 1,
          "maximum": 2147483648
        },
        "hashes": {
          "$ref": "azure-deviceupdate-manifest-definitions-4.0.json#/definitions/fileHashes"
        }
      },
      "additionalProperties": false,
      "required": ["filename", "sizeInBytes", "hashes"]
    },
    "filename": {
      "type": "string",
      "title": "Update file name",
      "description": "Update payload file name.",
      "minLength": 1,
      "maxLength": 255
    },
    "fileHashes": {
      "type": "object",
      "title": "File hashes",
      "description": "Base64-encoded file hashes with algorithm name as key. At least SHA-256 algorithm must be specified, and additional algorithm may be specified if supported by agent.",
      "properties": {
        "sha256": {
          "type": "string",
          "title": "SHA-256 hash value",
          "description": "Base64-encoded file hash value using SHA-256 algorithm."
        }
      },
      "additionalProperties": {
        "type": "string",
        "propertyNames": {
          "maxLength": 10
        }
      },
      "maxProperties": 2,
      "required": ["sha256"]
    },
    "referenceStepType": {
      "type": "string",
      "title": "'Reference' step type",
      "description": "Instruction step type that installs another update.",
      "const": "reference"
    },
    "inlineStepType": {
      "type": "string",
      "title": "'Inline' step type",
      "description": "Instruction step type that performs code execution.",
      "const": "inline"
    },
    "inlineStepHandler": {
      "type": "string",
      "title": "Step handler",
      "description": "Identity of handler on device that can execute this step.",
      "pattern": "^\\S+/\\S+:\\d{1,5}$",
      "minLength": 5,
      "maxLength": 32,
      "examples": [
        "microsoft/script:1",
        "microsoft/swupdate:1",
        "microsoft/apt:1"
      ]
    },
    "inlineStepHandlerProperties": {
      "type": "object",
      "title": "Handler properties",
      "description": "JSON object that agent will pass to handler as arguments.",
      "additionalProperties": true
    }
  },
  "description": "Shared schema definitions for 'Import Manifest' and 'Update Manifest'.",
  "title": "JSON Schema Definitions for Azure Device Update for IoT Hub Manifests version 4.0",
  "type": "object"
}
