{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Vultr documentation export version 1",
  "oneOf": [
    { "$ref": "#/$defs/manifest" },
    { "$ref": "#/$defs/page" },
    { "$ref": "#/$defs/operation" },
    { "$ref": "#/$defs/example" }
  ],
  "$defs": {
    "hash": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
    "strings": { "type": "array", "items": { "type": "string" } },
    "resource": {
      "type": "object",
      "required": ["id", "url", "sha256"],
      "properties": {
        "id": { "type": "string" },
        "url": { "type": "string", "pattern": "^/docs/export/v1/" },
        "sha256": { "$ref": "#/$defs/hash" },
        "title": { "type": "string" },
        "kind": { "enum": ["guide", "operation"] },
        "operation_id": { "type": "string" },
        "method": { "type": "string" },
        "path": { "type": "string" },
        "deprecated": { "type": "boolean" }
      },
      "additionalProperties": false
    },
    "manifest": {
      "type": "object",
      "required": ["schema_version", "schema_url", "schema_sha256", "revision", "api_url", "pages", "operations", "examples", "openapi", "live_sources"],
      "properties": {
        "schema_version": { "const": "1.0" },
        "schema_url": { "const": "/docs/export/v1/schema.json" },
        "schema_sha256": { "$ref": "#/$defs/hash" },
        "revision": { "$ref": "#/$defs/hash" },
        "api_url": { "type": "string" },
        "pages": { "type": "array", "items": { "$ref": "#/$defs/resource" } },
        "operations": { "type": "array", "items": { "$ref": "#/$defs/resource" } },
        "examples": { "type": "array", "items": { "$ref": "#/$defs/resource" } },
        "openapi": {
          "type": "object", "required": ["url", "sha256"],
          "properties": { "url": { "const": "/docs/openapi.json" }, "sha256": { "$ref": "#/$defs/hash" } },
          "additionalProperties": false
        },
        "live_sources": {
          "type": "object", "required": ["models", "model_cards", "model_pages"],
          "properties": {
            "models": {
              "type": "object", "required": ["url", "format", "schema_version"],
              "properties": {
                "url": { "const": "/v1/models?output_modalities=all" },
                "format": { "const": "provider-document" },
                "schema_version": { "const": "2.4" }
              },
              "additionalProperties": false
            },
            "model_cards": { "$ref": "#/$defs/liveSource" },
            "model_pages": { "$ref": "#/$defs/liveSource" }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "liveSource": {
      "type": "object", "required": ["url"],
      "properties": { "url": { "type": "string" } }, "additionalProperties": false
    },
    "page": {
      "type": "object",
      "required": ["schema_version", "id", "kind", "title", "section", "description", "canonical_url", "markdown_url", "markdown_sha256", "content_format", "markdown", "headings", "dependencies"],
      "properties": {
        "schema_version": { "const": "1.0" },
        "id": { "type": "string", "pattern": "^page:" },
        "kind": { "enum": ["guide", "operation"] },
        "title": { "type": "string" },
        "section": { "type": "string" },
        "description": { "type": "string" },
        "canonical_url": { "type": "string" },
        "markdown_url": { "type": "string" },
        "markdown_sha256": { "$ref": "#/$defs/hash" },
        "content_format": { "const": "gfm+html" },
        "markdown": { "type": "string" },
        "headings": {
          "type": "array",
          "items": {
            "type": "object", "required": ["id", "level", "text"],
            "properties": { "id": { "type": "string" }, "level": { "type": "integer" }, "text": { "type": "string" } },
            "additionalProperties": false
          }
        },
        "dependencies": {
          "type": "object", "required": ["operations", "schemas", "examples", "model_types"],
          "properties": {
            "operations": { "$ref": "#/$defs/strings" }, "schemas": { "$ref": "#/$defs/strings" },
            "examples": { "$ref": "#/$defs/strings" }, "model_types": { "$ref": "#/$defs/strings" }
          }, "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "operation": {
      "type": "object",
      "required": ["schema_version", "id", "operation_id", "method", "path", "deprecated", "canonical_url", "openapi_url", "openapi_sha256", "contract", "example_id"],
      "properties": {
        "schema_version": { "const": "1.0" }, "id": { "type": "string", "pattern": "^operation:" },
        "operation_id": { "type": "string" }, "method": { "enum": ["GET", "POST", "PUT", "DELETE", "PATCH"] },
        "path": { "type": "string" }, "deprecated": { "type": "boolean" },
        "canonical_url": { "type": "string" }, "openapi_url": { "const": "/docs/openapi.json" },
        "openapi_sha256": { "$ref": "#/$defs/hash" }, "contract": { "type": "object" },
        "example_id": { "type": "string", "pattern": "^example:operation/" }
      },
      "additionalProperties": false
    },
    "example": {
      "type": "object",
      "required": ["schema_version", "id", "origin", "verification", "variants"],
      "properties": {
        "schema_version": { "const": "1.0" }, "id": { "type": "string", "pattern": "^example:" },
        "origin": { "enum": ["maintained", "generated"] }, "verification": { "const": "not_reported" },
        "variants": {
          "type": "array", "minItems": 1,
          "items": {
            "type": "object", "required": ["label", "language", "code", "sha256"],
            "properties": {
              "label": { "type": "string" }, "language": { "type": "string" },
              "code": { "type": "string" }, "sha256": { "$ref": "#/$defs/hash" }
            }, "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    }
  }
}
