{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/simple-ai/json-schema/simple-ai-custom-data-table-update-schema.json",
  "title": "Custom Data Table Update",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/simple-ai-custom-data-api-openapi.yml#/components/schemas/CustomDataTableUpdate",
  "type": "object",
  "required": [
    "label",
    "columns"
  ],
  "properties": {
    "label": {
      "type": "string",
      "title": "Label",
      "description": "Human-readable table name shown in Simple AI."
    },
    "searchIndexingEnabled": {
      "type": "boolean",
      "title": "Search Indexing Enabled",
      "description": "Whether this table can be searched with the custom data search and facets endpoints."
    },
    "columns": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CustomDataColumnInput"
      },
      "minItems": 1,
      "title": "Columns"
    }
  },
  "$defs": {
    "CustomDataColumnInput": {
      "type": "object",
      "required": [
        "name",
        "type",
        "displayName"
      ],
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 63,
          "pattern": "^[a-z]([a-z0-9]+(_[a-z0-9]+)*)?$",
          "title": "Name",
          "description": "Column identifier. Use lowercase letters, numbers, and underscores."
        },
        "type": {
          "$ref": "#/$defs/CustomDataColumnType"
        },
        "displayName": {
          "type": "string",
          "title": "Display Name",
          "description": "Human-readable column name shown in Simple AI."
        },
        "referenceTable": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reference Table",
          "description": "Required for REFERENCE columns. Use a custom table name or a supported system reference table such as calls."
        },
        "jsonSchema": {
          "anyOf": [
            {
              "type": "object",
              "additionalProperties": true
            },
            {
              "type": "null"
            }
          ],
          "title": "JSON Schema",
          "description": "Required for OBJECT columns. Provide an OpenAPI/JSON Schema object that describes the structured value."
        }
      },
      "title": "Custom Data Column Input"
    },
    "CustomDataColumnType": {
      "type": "string",
      "enum": [
        "STRING",
        "NUMERIC",
        "BOOLEAN",
        "JSONB",
        "TIMESTAMP",
        "REFERENCE",
        "STRING_ARRAY",
        "NUMERIC_ARRAY",
        "BOOLEAN_ARRAY",
        "TIMESTAMP_ARRAY",
        "OBJECT"
      ],
      "title": "Custom Data Column Type"
    }
  }
}