{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://encode.wiki/api/v1/schema.json",
  "title": "Encode Wiki corpus document",
  "type": "object",
  "required": [
    "schemaVersion",
    "contentVersion",
    "id",
    "collection",
    "title",
    "canonicalUrl",
    "status",
    "license",
    "checksum",
    "contentFormat",
    "markdown"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "contentVersion": {
      "type": "string"
    },
    "id": {
      "type": "string",
      "pattern": "^(docs|articles)/"
    },
    "collection": {
      "enum": [
        "docs",
        "articles"
      ]
    },
    "title": {
      "type": "string",
      "minLength": 1
    },
    "description": {
      "type": "string"
    },
    "canonicalUrl": {
      "type": "string",
      "format": "uri"
    },
    "apiUrl": {
      "type": "string",
      "format": "uri"
    },
    "markdownUrl": {
      "type": "string",
      "format": "uri"
    },
    "status": {
      "enum": [
        "current",
        "needs-review",
        "archived"
      ]
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "license": {
      "type": "string",
      "minLength": 1
    },
    "dates": {
      "type": "object"
    },
    "authors": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "sources": {
      "type": "array"
    },
    "provenance": {
      "type": "object"
    },
    "headings": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "depth",
          "text",
          "anchor"
        ],
        "properties": {
          "depth": {
            "type": "integer",
            "minimum": 1,
            "maximum": 6
          },
          "text": {
            "type": "string"
          },
          "anchor": {
            "type": "string"
          }
        }
      }
    },
    "outboundReferences": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "checksum": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "contentFormat": {
      "const": "markdown"
    },
    "markdown": {
      "type": "string"
    }
  }
}
