{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nexus/json-schema/nexus-task-template-xo-schema.json",
  "title": "TaskTemplateXO",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nexus-tasks-api-openapi.yml#/components/schemas/TaskTemplateXO",
  "required": [
    "enabled",
    "frequency",
    "name",
    "notificationCondition",
    "type"
  ],
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "description": "The type of task to be created."
    },
    "name": {
      "minLength": 1,
      "type": "string",
      "description": "The name of the task template."
    },
    "enabled": {
      "type": "boolean",
      "description": "Indicates if the task would be enabled."
    },
    "alertEmail": {
      "type": "string",
      "description": "e-mail for task notifications.",
      "format": "email"
    },
    "notificationCondition": {
      "type": "string",
      "description": "Condition required to notify a task execution.",
      "enum": [
        "FAILURE",
        "SUCCESS_FAILURE"
      ]
    },
    "frequency": {
      "$ref": "#/$defs/FrequencyXO"
    },
    "properties": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "description": "Additional properties for the task"
      },
      "description": "Additional properties for the task"
    },
    "formFields": {
      "type": "array",
      "description": "Metadata for each form field declared by the task descriptor, in the order the descriptor declares them. Populated on read responses; ignored on create/update.",
      "items": {
        "$ref": "#/$defs/FormFieldInfo"
      }
    },
    "concurrentRun": {
      "type": "boolean",
      "description": "Indicates whether the task can run concurrently with other instances of the same type."
    }
  },
  "$defs": {
    "FormFieldInfo": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Identifier of the form field; matches a key in the task's properties map."
        },
        "type": {
          "type": "string",
          "description": "Form field type, e.g. 'string', 'number', 'checkbox', 'repository'."
        },
        "label": {
          "type": "string",
          "description": "Human-readable label."
        },
        "helpText": {
          "type": "string",
          "description": "Help text shown beneath the input."
        },
        "required": {
          "type": "boolean",
          "description": "Whether the field must be supplied when creating or updating the task."
        },
        "initialValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "Initial value to seed the form with."
        },
        "minValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "Minimum numeric value (number fields only)."
        },
        "maxValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "Maximum numeric value (number fields only)."
        },
        "regexValidation": {
          "type": [
            "string",
            "null"
          ],
          "description": "Regular expression the value must match."
        },
        "storeApi": {
          "type": [
            "string",
            "null"
          ],
          "description": "Backend store API for Selectable fields (e.g. repository combobox)."
        },
        "storeFilters": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": [
              "string",
              "null"
            ],
            "description": "Filters to apply to the Selectable's store (e.g. 'type' = 'hosted,proxy', 'format' = 'maven2')."
          },
          "description": "Filters to apply to the Selectable's store (e.g. 'type' = 'hosted,proxy', 'format' = 'maven2')."
        }
      },
      "description": "Metadata for each form field declared by the task descriptor, in the order the descriptor declares them. Populated on read responses; ignored on create/update."
    },
    "FrequencyXO": {
      "required": [
        "schedule"
      ],
      "type": "object",
      "properties": {
        "schedule": {
          "type": "string",
          "description": "Type of schedule (\"manual\", \"once\", \"hourly\", \"daily\", \"weekly\", \"monthly\", \"cron\")"
        },
        "startDate": {
          "type": "integer",
          "description": "Start date of the task represented in unix timestamp. Does not apply for \"manual\" schedule.",
          "format": "int64"
        },
        "timeZoneOffset": {
          "type": "string",
          "description": "The offset time zone of the client. Example: "
        },
        "recurringDays": {
          "type": "array",
          "description": "Array with the number of the days the task must run. For \"weekly\" schedule allowed values, 1 to 7. For \"monthly\" schedule allowed values, 1 to 31, and 999 for the last day of the month.",
          "items": {
            "type": "integer",
            "description": "Array with the number of the days the task must run. For \"weekly\" schedule allowed values, 1 to 7. For \"monthly\" schedule allowed values, 1 to 31, and 999 for the last day of the month.",
            "format": "int32"
          }
        },
        "cronExpression": {
          "type": "string",
          "description": "Cron expression for the task. Only applies for \"cron\" schedule."
        }
      },
      "description": "Frequency of execution of the task."
    }
  }
}