{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/okfindex-com/json-schema/okfindex-com-base-schema.json",
  "title": "Base",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/okfindex-com-openapi.yml#/components/schemas/Base",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The 64-character ID returned by the API."
    },
    "name": {
      "type": "string",
      "description": "Base name."
    },
    "visibility": {
      "type": "string",
      "description": "private or public; only explicit publication makes a base public."
    },
    "dataset": {
      "allOf": [
        {
          "$ref": "#/$defs/Dataset"
        }
      ],
      "description": "Dataset metadata, or null. Public reads use the last explicit publication.",
      "nullable": true
    },
    "created_at": {
      "type": "string",
      "description": "Creation date, ISO 8601."
    },
    "updated_at": {
      "type": "string",
      "description": "Last change, ISO 8601."
    },
    "documents": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Document count when returned by the base list; null otherwise."
    },
    "bytes": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Current original bytes in the owner's base list; null in other private responses. Omitted from public responses."
    },
    "api": {
      "type": "string",
      "description": "Metadata URL."
    },
    "export_url": {
      "type": "string",
      "description": "ZIP download URL."
    },
    "history_url": {
      "type": "string",
      "description": "Owner-only paginated export of all retained versions. Follow next and download each version by its returned URLs."
    },
    "okf_url": {
      "type": "string",
      "description": "OKF root index URL."
    },
    "public_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Public page URL while published; null when private."
    },
    "embed_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Public search iframe URL while published; null when private. Uses the same public API and limits. No account controls inside the iframe."
    },
    "publication": {
      "allOf": [
        {
          "$ref": "#/$defs/BasePublication"
        }
      ],
      "description": "Latest publication declaration, or null before first publication.",
      "nullable": true
    }
  },
  "required": [
    "id",
    "name",
    "visibility",
    "dataset",
    "created_at",
    "updated_at",
    "documents",
    "bytes",
    "api",
    "export_url",
    "okf_url",
    "public_url",
    "embed_url",
    "publication"
  ],
  "$defs": {
    "BasePublication": {
      "type": "object",
      "properties": {
        "author": {
          "type": "string",
          "description": "Author or attribution declared by the publisher."
        },
        "source_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Declared HTTPS source, or null for uploaded files."
        },
        "terms": {
          "type": "string",
          "description": "Terms declared by the publisher. This is not an independent license verification."
        },
        "published_at": {
          "type": "string",
          "description": "Date of the last explicit publication, ISO 8601."
        }
      },
      "required": [
        "author",
        "source_url",
        "terms",
        "published_at"
      ]
    },
    "Dataset": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string",
          "description": "Dataset description, 1–2000 characters."
        },
        "fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DatasetField"
          },
          "description": "1–30 fields, each with a name and description."
        },
        "coverage": {
          "type": "string",
          "description": "Geographic, temporal or subject coverage, 1–300 characters."
        },
        "format": {
          "type": "string",
          "description": "Source format, for example CSV or JSON, 1–40 characters."
        },
        "update_frequency": {
          "type": "string",
          "description": "Declared update schedule, 1–200 characters. No automatic check is performed."
        },
        "license": {
          "type": "string",
          "description": "Declared license or access terms, 1–300 characters. Not independently verified."
        },
        "source_url": {
          "type": "string",
          "description": "HTTPS origin URL, at most 1000 characters, without credentials."
        }
      },
      "required": [
        "description",
        "fields",
        "coverage",
        "format",
        "update_frequency",
        "license",
        "source_url"
      ]
    },
    "DatasetField": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Field name, 1–80 characters."
        },
        "description": {
          "type": "string",
          "description": "Meaning, 1–200 characters."
        }
      },
      "required": [
        "name",
        "description"
      ]
    }
  }
}