{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ptc/json-schema/ptc-stream-transformation-schema.json",
  "title": "StreamTransformation",
  "description": "Model to start a stream transformation background job.",
  "x-generated": "2026-12-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ptc-codebeamer-api-openapi.yml#/components/schemas/StreamTransformation",
  "type": "object",
  "properties": {
    "dropTableRowData": {
      "type": "array",
      "description": "Table row data to be dropped during the transformation.",
      "items": {
        "$ref": "#/$defs/TableRowLocator"
      }
    },
    "excludedSourceItemIds": {
      "type": "array",
      "description": "IDs of source items to exclude during transformation.",
      "items": {
        "type": "integer",
        "format": "int32",
        "description": "IDs of source items to exclude during transformation."
      }
    },
    "fullOverwrite": {
      "type": "boolean",
      "description": "Whether or not to use full overwrite."
    },
    "platformBaselineId": {
      "type": "integer",
      "format": "int32",
      "description": "ID of the platform baseline."
    },
    "platformBranchIds": {
      "type": "array",
      "description": "IDs of the platform branches to process on the transformed stream. Passed branches are created if missing. If not specified, all branches that exist on both the platform and transformed streams are processed.",
      "items": {
        "type": "integer",
        "format": "int32",
        "description": "IDs of the platform branches to process on the transformed stream. Passed branches are created if missing. If not specified, all branches that exist on both the platform and transformed streams are processed."
      },
      "uniqueItems": true
    },
    "platformStreamId": {
      "type": "integer",
      "format": "int32",
      "description": "ID of the platform stream."
    },
    "redactSourceItemIds": {
      "type": "array",
      "description": "IDs of source items to redact during transformation.",
      "items": {
        "type": "integer",
        "format": "int32",
        "description": "IDs of source items to redact during transformation."
      }
    },
    "redactSourceItemRows": {
      "type": "array",
      "description": "Table row locators for source items to redact during transformation.",
      "items": {
        "$ref": "#/$defs/TableRowLocator"
      }
    },
    "redactTemplateIds": {
      "type": "array",
      "description": "IDs of templates to use for redaction.",
      "items": {
        "type": "integer",
        "format": "int32",
        "description": "IDs of templates to use for redaction."
      }
    },
    "scheduleComputedFieldUpdate": {
      "type": "boolean",
      "description": "Whether or not to schedule computed field update after transformation."
    },
    "trackerAttributesToCopy": {
      "type": "array",
      "description": "Attributes to copy when creating a new tracker during transformation.",
      "items": {
        "type": "string",
        "description": "Attributes to copy when creating a new tracker during transformation."
      },
      "uniqueItems": true
    },
    "transformationFieldLocators": {
      "type": "array",
      "description": "Field locators and their transformation expressions.",
      "items": {
        "$ref": "#/$defs/TransformationFieldLocator"
      }
    },
    "transformedStreamId": {
      "type": "integer",
      "format": "int32",
      "description": "ID of the transformed stream. Provide this to use an existing transformed stream. Exactly one of transformedStreamName or transformedStreamId must be provided."
    },
    "transformedStreamName": {
      "type": "string",
      "description": "Name of the transformed stream. Provide this to create a new transformed stream. Exactly one of transformedStreamName or transformedStreamId must be provided."
    },
    "workingCopyStreamId": {
      "type": "integer",
      "format": "int32",
      "description": "ID of the working copy stream. Optional. Provide this to use an existing working copy stream. Do not provide workingCopyStreamName at the same time."
    },
    "workingCopyStreamName": {
      "type": "string",
      "description": "Name of the working copy stream. Optional. Provide this to create a new working copy stream. Do not provide workingCopyStreamId at the same time."
    }
  },
  "required": [
    "platformBaselineId",
    "platformStreamId"
  ],
  "$defs": {
    "FieldValueTransformationModel": {
      "type": "object",
      "description": "List of expressions used to transform the field values.",
      "properties": {
        "expressionType": {
          "type": "string",
          "enum": [
            "SIMPLE",
            "WIKI_TABLE"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type"
      ]
    },
    "TableRowLocator": {
      "type": "object",
      "description": "Model representing a table row.",
      "properties": {
        "itemId": {
          "type": "integer",
          "format": "int32",
          "description": "ID of the item."
        },
        "rowIdx": {
          "type": "integer",
          "format": "int32",
          "description": "Index of the row to be dropped."
        },
        "tableFieldId": {
          "type": "integer",
          "format": "int32",
          "description": "ID of the table field."
        }
      },
      "required": [
        "itemId",
        "rowIdx",
        "tableFieldId"
      ]
    },
    "TransformationFieldLocator": {
      "type": "object",
      "description": "Model to locate fields and specify expressions used to transform their values.",
      "properties": {
        "columnId": {
          "type": "integer",
          "format": "int32",
          "description": "ID of the column."
        },
        "expressions": {
          "type": "array",
          "description": "List of expressions used to transform the field values.",
          "items": {
            "$ref": "#/$defs/FieldValueTransformationModel"
          },
          "minItems": 1
        },
        "fieldId": {
          "type": "integer",
          "format": "int32",
          "description": "ID of the field."
        },
        "itemId": {
          "type": "integer",
          "format": "int32",
          "description": "ID of the item."
        },
        "rowIdx": {
          "type": "integer",
          "format": "int32",
          "description": "ID of the row."
        }
      },
      "required": [
        "expressions",
        "fieldId",
        "itemId"
      ]
    }
  }
}