{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usewrit-app/json-schema/usewrit-app-dataset-list-schema.json",
  "title": "DatasetList",
  "description": "`GET /v1/datasets` — a bespoke `{datasets}` envelope, NOT `{data, count}`.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usewrit-app-datasets-api-openapi.yml#/components/schemas/DatasetList",
  "type": "object",
  "required": [
    "datasets"
  ],
  "properties": {
    "datasets": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Dataset"
      }
    }
  },
  "$defs": {
    "Dataset": {
      "type": "object",
      "description": "One entry in the unified dataset catalogue.",
      "required": [
        "id",
        "name",
        "source_type",
        "run_count",
        "last_updated"
      ],
      "properties": {
        "id": {
          "type": "integer",
          "format": "int64",
          "description": "The id of the workflow/crawl that produced the data."
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "source_type": {
          "type": "string",
          "description": "`crawl` for a whole-site crawl dataset, otherwise `workflow`.",
          "enum": [
            "crawl",
            "workflow"
          ]
        },
        "run_count": {
          "type": "integer",
          "description": "Distinct successful runs that contributed at least one record."
        },
        "last_updated": {
          "type": [
            "string",
            "null"
          ],
          "description": "Newest contributing run's timestamp."
        },
        "origin": {
          "type": "string",
          "description": "Where the dataset lives — present on a cloud-linked daemon, which merges forwarded cloud crawl datasets into this list."
        }
      }
    }
  }
}