{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://library.mrm.org/schema/node.schema.json",
  "title": "MRM Library node manifest (<path>.json)",
  "description": "One manifest per collection (/collection/<slug>.json), work (/<work>.json) and part (/<work>/<part>.json). Leaves (sections) have their own JSON with the resolved frontmatter; a node lists children (parts) and, when it holds few enough, its sections with the resolved frontmatter of each. Long lists are paged: first 200 inline, the rest at ?page=N (children) or ?sections=N.",
  "type": "object",
  "required": [
    "path",
    "kind",
    "title",
    "trail",
    "url",
    "index",
    "works",
    "sectionCount",
    "children",
    "sections"
  ],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "path": {
      "type": "string"
    },
    "kind": {
      "enum": [
        "collection",
        "work",
        "part"
      ]
    },
    "partKind": {
      "enum": [
        "volume",
        "issue",
        "year",
        "book",
        "part"
      ]
    },
    "title": {
      "type": "string"
    },
    "displayTitle": {
      "type": "string",
      "description": "The title as shown in lists, headings and breadcrumbs (normalized case, no stray numerals or dashes). Present only when it differs; `title` is always the stored title."
    },
    "description": {
      "type": "string"
    },
    "collections": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "trail": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "title",
          "path"
        ],
        "properties": {
          "title": {
            "type": "string"
          },
          "displayTitle": {
            "type": "string",
            "description": "The title as shown in lists, headings and breadcrumbs (normalized case, no stray numerals or dashes). Present only when it differs; `title` is always the stored title."
          },
          "path": {
            "type": "string"
          }
        }
      }
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "index": {
      "type": "string",
      "format": "uri"
    },
    "markdown": {
      "type": "string",
      "format": "uri"
    },
    "works": {
      "type": "integer",
      "minimum": 0
    },
    "sectionCount": {
      "type": "integer",
      "minimum": 0
    },
    "years": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "children": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "path",
          "title",
          "kind",
          "works",
          "sections",
          "url",
          "index"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "displayTitle": {
            "type": "string",
            "description": "The title as shown in lists, headings and breadcrumbs (normalized case, no stray numerals or dashes). Present only when it differs; `title` is always the stored title."
          },
          "kind": {
            "enum": [
              "collection",
              "work",
              "part",
              "section"
            ]
          },
          "partKind": {
            "enum": [
              "volume",
              "issue",
              "year",
              "book",
              "part"
            ]
          },
          "description": {
            "type": "string"
          },
          "works": {
            "type": "integer"
          },
          "sections": {
            "type": "integer"
          },
          "authors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "published": {
            "type": "string"
          },
          "issues": {
            "type": "integer"
          },
          "pageStart": {
            "type": "integer"
          },
          "pageEnd": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "index": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    },
    "sections": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "path",
          "title",
          "position",
          "html",
          "markdown"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "displayTitle": {
            "type": "string",
            "description": "The title as shown in lists, headings and breadcrumbs (normalized case, no stray numerals or dashes). Present only when it differs; `title` is always the stored title."
          },
          "position": {
            "type": "integer",
            "minimum": 1
          },
          "html": {
            "type": "string",
            "format": "uri"
          },
          "markdown": {
            "type": "string",
            "format": "uri"
          },
          "index": {
            "type": "string",
            "format": "uri"
          },
          "pageStart": {
            "type": "integer"
          },
          "pageEnd": {
            "type": "integer"
          },
          "frontmatter": {
            "type": "object",
            "description": "Resolved frontmatter (work.schema.json); present when the node holds at most 200 sections."
          },
          "part": {
            "type": "object",
            "required": [
              "title",
              "path"
            ],
            "properties": {
              "title": {
                "type": "string"
              },
              "displayTitle": {
                "type": "string",
                "description": "The title as shown in lists, headings and breadcrumbs (normalized case, no stray numerals or dashes). Present only when it differs; `title` is always the stored title."
              },
              "path": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "page": {
      "type": "object"
    },
    "sectionsPage": {
      "type": "object"
    },
    "work": {
      "type": "object"
    },
    "dc": {
      "type": "object",
      "description": "Flat Dublin Core block."
    },
    "partOf": {
      "type": "string"
    },
    "prev": {
      "anyOf": [
        {
          "type": "null"
        },
        {
          "type": "object"
        }
      ]
    },
    "next": {
      "anyOf": [
        {
          "type": "null"
        },
        {
          "type": "object"
        }
      ]
    }
  }
}
