{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/latitude-so/json-schema/latitude-so-dataset-schema.json",
  "title": "Dataset",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/latitude-so-datasets-api-openapi.yml#/components/schemas/Dataset",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 24,
      "maxLength": 24,
      "description": "Stable dataset identifier."
    },
    "organizationId": {
      "type": "string",
      "minLength": 24,
      "maxLength": 24,
      "description": "Organization that owns this dataset."
    },
    "projectId": {
      "type": "string",
      "minLength": 24,
      "maxLength": 24,
      "description": "Project this dataset belongs to."
    },
    "slug": {
      "type": "string",
      "description": "URL-safe slug derived from `name`. Unique within the project."
    },
    "name": {
      "type": "string",
      "description": "Human-readable name."
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Free-form description, or `null` when not set."
    },
    "columns": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/DatasetColumn"
      },
      "description": "Ordered column schema (built-in + custom). `null` means the default schema: the four built-in fields, all visible."
    },
    "version": {
      "type": "integer",
      "minimum": 0,
      "description": "Current dataset version."
    },
    "createdAt": {
      "type": "string",
      "description": "ISO-8601 timestamp of creation."
    },
    "updatedAt": {
      "type": "string",
      "description": "ISO-8601 timestamp of the last update."
    }
  },
  "required": [
    "id",
    "organizationId",
    "projectId",
    "slug",
    "name",
    "description",
    "columns",
    "version",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "DatasetColumn": {
      "type": "object",
      "properties": {
        "identifier": {
          "type": "string",
          "description": "Stable, immutable column id. The key under which custom values are stored on each row."
        },
        "name": {
          "type": "string",
          "description": "Display name. Editable; the identifier never changes."
        },
        "source": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "builtin"
                  ],
                  "description": "A built-in field (`input`, `output`, `expectedOutput`, or `metadata`)."
                },
                "field": {
                  "type": "string",
                  "enum": [
                    "input",
                    "output",
                    "expectedOutput",
                    "metadata"
                  ],
                  "description": "Which built-in field this column projects."
                }
              },
              "required": [
                "kind",
                "field"
              ]
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "custom"
                  ],
                  "description": "A user-added column; its values live under the row's `custom` store."
                }
              },
              "required": [
                "kind"
              ]
            }
          ],
          "description": "Where the column's values come from."
        },
        "removed": {
          "type": "boolean",
          "description": "`true` for soft-removed columns (only returned when listing with `includeRemoved`). Removed columns are excluded from rows and the default schema, but keep their data and can be restored."
        }
      },
      "required": [
        "identifier",
        "name",
        "source"
      ]
    }
  }
}