{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://apigenie.pl/schemas/apigenie-docs-manifest.json",
  "title": "apigenie-docs.json",
  "description": "The manifest of a docs bundle (`apigenie-generator docs`, ADR-122), which the web components read. Adding members keeps formatVersion; removing a member or changing its meaning or type increments it, together with apigenieDocs.",
  "type": "object",
  "required": ["apigenieDocs", "formatVersion", "title", "generator", "locales", "prefixDefaultLocale", "documents"],
  "properties": {
    "apigenieDocs": {
      "description": "The version of the bundle; always equal to formatVersion.",
      "const": 1
    },
    "formatVersion": {
      "description": "The version of this format.",
      "const": 1
    },
    "title": { "type": "string" },
    "generator": {
      "type": "object",
      "required": ["name", "version"],
      "properties": {
        "name": { "const": "apigenie" },
        "version": { "type": "string" }
      }
    },
    "locales": {
      "description": "The first locale is the default one, untranslated.",
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["code"],
        "properties": {
          "code": { "description": "A BCP 47 tag such as en or pt-BR.", "type": "string" },
          "default": { "type": "boolean" }
        }
      }
    },
    "prefixDefaultLocale": { "type": "boolean" },
    "documents": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/document" }
    }
  },
  "$defs": {
    "document": {
      "type": "object",
      "required": ["id", "family", "title", "source", "files"],
      "properties": {
        "id": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$" },
        "family": { "enum": ["openapi", "swagger", "asyncapi", "graphql", "protobuf"] },
        "title": { "type": "string" },
        "version": { "type": "string" },
        "source": { "description": "The name of the input file.", "type": "string" },
        "files": {
          "description": "The document or documentation model per locale, as a path relative to the bundle.",
          "type": "object",
          "additionalProperties": { "type": "string" }
        },
        "changelog": { "type": "string" },
        "examples": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["file", "kind"],
            "properties": {
              "file": { "type": "string" },
              "title": { "type": "string" },
              "kind": { "type": "string", "examples": ["graphql-example", "file"] }
            }
          }
        }
      }
    }
  }
}
