{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/grepr/json-schema/grepr-dataset-read-schema.json",
  "title": "DatasetRead",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grepr-datasets-api-openapi.yml#/components/schemas/DatasetRead",
  "properties": {
    "id": {
      "type": "string"
    },
    "integrationId": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "organizationId": {
      "type": "string"
    },
    "tables": {
      "additionalProperties": {
        "$ref": "#/$defs/TableConfig"
      },
      "default": {},
      "description": "Per-table configuration overrides, keyed by table key (e.g. logs_raw). Absent entries use system defaults.",
      "type": "object"
    },
    "teamIds": {
      "default": [],
      "description": "The team IDs that this dataset is associated with.",
      "items": {
        "description": "The team IDs that this dataset is associated with.",
        "type": "string"
      },
      "type": "array",
      "uniqueItems": true
    }
  },
  "required": [
    "id",
    "integrationId",
    "name",
    "organizationId"
  ],
  "type": "object",
  "$defs": {
    "PartitionConfig": {
      "description": "User-chosen partition layout.",
      "properties": {
        "fields": {
          "default": [],
          "description": "User-chosen partition fields applied in order.",
          "items": {
            "$ref": "#/$defs/PartitionFieldConfig"
          },
          "type": "array"
        }
      },
      "required": [
        "fields"
      ],
      "type": "object"
    },
    "PartitionFieldConfig": {
      "description": "User-chosen partition fields applied in order.",
      "properties": {
        "buckets": {
          "description": "Number of buckets to hash this column into.",
          "format": "int32",
          "maximum": 256,
          "minimum": 2,
          "type": "integer"
        },
        "column": {
          "description": "Built-in column (service/host) or a promoted tag key to partition by.",
          "type": "string"
        }
      },
      "required": [
        "buckets",
        "column"
      ],
      "type": "object"
    },
    "SortFieldConfig": {
      "description": "User-chosen sort fields, in precedence order.",
      "properties": {
        "column": {
          "description": "Built-in column or an attribute key to sort by.",
          "type": "string"
        },
        "direction": {
          "default": "ASC",
          "description": "Sort direction for this field.",
          "enum": [
            "ASC",
            "DESC"
          ],
          "type": "string"
        }
      },
      "required": [
        "column"
      ],
      "type": "object"
    },
    "TableConfig": {
      "description": "Per-table configuration overrides. Read-only here; use /datasets/{id}/{tableKey}/config to mutate.",
      "properties": {
        "partitionConfig": {
          "$ref": "#/$defs/PartitionConfig"
        },
        "sortFields": {
          "default": [],
          "description": "User-chosen sort fields, in precedence order.",
          "items": {
            "$ref": "#/$defs/SortFieldConfig"
          },
          "type": "array"
        }
      },
      "type": "object"
    }
  }
}