{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/onclarity-com/json-schema/onclarity-com-update-collection-request-schema.json",
  "title": "UpdateCollectionRequest",
  "description": "The single collection edit (owner only on the user API): human metadata and/or the\nrecord contract, applied together.\n\nSend ``json_schema`` to change the contract — the FULL new schema; the backend diffs\nit (new fields added, missing fields DROPPED with their data, retyping rejected) and\nbumps the schema version. **A new required field on a collection that already holds\nrecords must carry a JSON Schema ``default``** — existing rows are backfilled with it.\n``slug`` is permanent and cannot be edited.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/onclarity-com-agent-store-api-openapi.yml#/components/schemas/UpdateCollectionRequest",
  "properties": {
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Title",
      "description": "New title (non-empty)."
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description",
      "description": "New description ('' clears it)."
    },
    "json_schema": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Json Schema",
      "description": "The complete new JSON Schema of a record (omit to keep it)."
    },
    "indexes": {
      "items": {
        "$ref": "#/$defs/IndexSpec"
      },
      "type": "array",
      "title": "Indexes",
      "description": "ADDITIONAL indexes to create (existing ones are kept unless their field is dropped). Only applied together with json_schema."
    },
    "ticket_link_field": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ticket Link Field",
      "description": "Set the field whose value is a ticket unique_id (text or integer; a field of the new json_schema when one is sent). Omit to keep the current link; send null to unlink."
    },
    "ticket_link_es_field": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ticket Link Es Field",
      "description": "The ES ticket field the link values are matched against. Tri-state per key (omitted = kept): send it alone to retarget the join of the EXISTING link (null = back to unique_id); setting ticket_link_field alone keeps the current join target."
    }
  },
  "type": "object",
  "$defs": {
    "IndexSpec": {
      "properties": {
        "fields": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Fields",
          "description": "Schema fields the index covers (1..5)."
        },
        "unique": {
          "type": "boolean",
          "title": "Unique",
          "description": "Create as a UNIQUE index.",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "fields"
      ],
      "title": "IndexSpec",
      "description": "One requested index over the collection's dynamic table (btree, scalar fields)."
    }
  }
}