{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rippit-com/json-schema/rippit-com-dataset-init-schema.json",
  "title": "DatasetInit",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rippit-com-bulk-openapi.json#/components/schemas/DatasetInit",
  "properties": {
    "name": {
      "type": "string",
      "maxLength": 128,
      "minLength": 1,
      "title": "Name",
      "description": "Any label, e.g. `Accounts (billing)`."
    },
    "description": {
      "type": "string",
      "maxLength": 2000,
      "title": "Description",
      "description": "What the table holds, shown in Rippit.",
      "default": ""
    },
    "columns": {
      "items": {
        "$ref": "#/$defs/DatasetColumn"
      },
      "type": "array",
      "minItems": 1,
      "title": "Columns"
    },
    "pkey_cols": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Pkey Cols",
      "description": "Columns that identify a row; re-uploads replace matching rows."
    },
    "append_only_dataset": {
      "type": "boolean",
      "title": "Append Only Dataset",
      "description": "Required when `pkey_cols` is empty: every uploaded row is kept.",
      "default": false
    },
    "updated_at_col": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Updated At Col"
    },
    "mode": {
      "type": "string",
      "enum": [
        "adhoc",
        "ongoing"
      ],
      "title": "Mode",
      "description": "adhoc = one-off dump, ongoing = cron upserts.",
      "default": "ongoing"
    }
  },
  "type": "object",
  "required": [
    "name",
    "columns"
  ],
  "$defs": {
    "DatasetColumn": {
      "properties": {
        "column": {
          "type": "string",
          "maxLength": 128,
          "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
          "title": "Column"
        },
        "type": {
          "type": "string",
          "title": "Type",
          "description": "Column type: int / float / string / bool / datetime / list<element: …>."
        }
      },
      "type": "object",
      "required": [
        "column",
        "type"
      ],
      "title": "DatasetColumn"
    }
  }
}