{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dpf-it-com/json-schema/dpf-it-com-update-spec-request-schema.json",
  "title": "Update Spec",
  "description": "Updates an existing spec's mutable fields. Only fields present in the request are\nchanged; omitted fields keep their current value. This only saves the settings — it does\nNOT regenerate code/SQL or re-run anything by itself. Call `start-analysis` afterward to\ndo that (the workspace.html UI always does both together as \"Update & Re-process\").\n\n`sourceType` is fixed at creation and cannot be changed here. `sampleFileName`/\n`formatFileName` only apply to sourceType=file specs; `lastRunTs` only applies to\nsourceType=tables specs; `sourceTables` applies to both sourceType=tables and\nsourceType=compaction. A sourceType=compaction spec accepts only `sourceTables`,\n`expirePriorSnapshots`, `computeSize` and `description` — sending a target field,\na file field or `merge` returns 400, since it has none of those.\n",
  "x-generated": "2026-11-06",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dpf-it-com-openapi.yml#/components/schemas/UpdateSpecRequest",
  "type": "object",
  "required": [
    "action",
    "workspaceId",
    "specName"
  ],
  "properties": {
    "action": {
      "type": "string",
      "enum": [
        "update-spec"
      ],
      "description": "Action type - must be \"update-spec\""
    },
    "workspaceId": {
      "type": "string",
      "format": "uuid",
      "description": "Workspace ID"
    },
    "specName": {
      "type": "string",
      "description": "Spec name (unique per workspace, from create-spec)"
    },
    "expirePriorSnapshots": {
      "type": "boolean",
      "description": "Optional, sourceType=compaction only — change whether a run also expires prior\nsnapshots and deletes the files it replaced. See create-spec for what each\nvalue means.\n"
    },
    "targetOption": {
      "type": "string",
      "enum": [
        "existing-tables",
        "target-schema-file",
        "auto-infer"
      ],
      "description": "Optional — change how the target schema is determined. See create-spec for what each value means."
    },
    "targetTables": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Optional — new target table name(s). Exactly one entry for sourceType=tables."
    },
    "targetSchemaFileName": {
      "type": "string",
      "description": "Optional — new target schema file name (upload it via the returned signedUrls, and include \"schemaFile\" in changedFiles)."
    },
    "sampleFileName": {
      "type": "string",
      "description": "Optional, sourceType=file only — new sample file name (upload via signedUrls; include \"sampleFile\" in changedFiles)."
    },
    "formatFileName": {
      "type": "string",
      "description": "Optional, sourceType=file only — new format file name (upload via signedUrls; include \"formatFile\" in changedFiles)."
    },
    "sourceTables": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Optional, sourceType=tables only — change the source table name(s) the generated query reads from."
    },
    "merge": {
      "type": "boolean",
      "description": "Optional — change merge/upsert mode."
    },
    "computeSize": {
      "type": "string",
      "enum": [
        "small",
        "large"
      ],
      "description": "Optional — change processing power. See create-spec for details."
    },
    "additionalPrompt": {
      "type": "string",
      "description": "Optional — change the AI instructions used at the next start-analysis.",
      "maxLength": 2000
    },
    "description": {
      "type": "string",
      "description": "Optional — change the spec's description.",
      "maxLength": 1000
    },
    "lastRunTs": {
      "type": "string",
      "format": "date-time",
      "description": "Optional, sourceType=tables only. Overrides the watermark table_job.py uses as the\n`:last_run_ts` lower bound in the generated SQL (normally this is set automatically to\nthe start ts of the spec's own last successful run). Set this to a past timestamp to\nforce the next run to reprocess data from that point on — e.g. to backfill after a bug\nfix, or replay a window that was missed. Must be a valid ISO 8601 timestamp.\n"
    },
    "changedFiles": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "sampleFile",
          "formatFile",
          "schemaFile"
        ]
      },
      "description": "Which of sampleFileName/formatFileName/targetSchemaFileName are being replaced — only those get a presigned upload URL in the response."
    }
  }
}