{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pagegoat-com/json-schema/pagegoat-com-comment-schema.json",
  "title": "Comment",
  "description": "A review comment on a site. A reply is a comment whose `parentId` points at the thread root; replies are one level deep and never anchored.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pagegoat-com-openapi.yml#/components/schemas/Comment",
  "required": [
    "anchor",
    "authorSub",
    "body",
    "createdAt",
    "edited",
    "id",
    "status",
    "updatedAt"
  ],
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Comment id.",
      "format": "uuid"
    },
    "parentId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Thread root for a reply, or null for a top-level comment.",
      "format": "uuid"
    },
    "anchorText": {
      "type": [
        "string",
        "null"
      ],
      "description": "The selected text this comment is anchored to. Duplicated from `anchor.text` as a flat convenience field, and the only anchor data that exists on comments created before anchoring was added."
    },
    "anchor": {
      "$ref": "#/$defs/CommentAnchor"
    },
    "body": {
      "type": "string",
      "description": "The comment text."
    },
    "authorSub": {
      "type": "string",
      "description": "Subject claim of the author's token."
    },
    "status": {
      "type": "string",
      "description": "Thread status.",
      "enum": [
        "open",
        "resolved"
      ]
    },
    "resolvedBy": {
      "type": [
        "string",
        "null"
      ],
      "description": "Subject of whoever resolved the thread, or null while it is open."
    },
    "edited": {
      "type": "boolean",
      "description": "True once the author has edited the body."
    },
    "createdAt": {
      "type": "string",
      "description": "When the comment was created (ISO-8601, UTC).",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "description": "When it was last changed (ISO-8601, UTC).",
      "format": "date-time"
    }
  },
  "$defs": {
    "CommentAnchor": {
      "required": [
        "text"
      ],
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "text": {
          "maxLength": 300,
          "type": "string",
          "description": "The selected text, whitespace-normalized. The primary selector."
        },
        "prefix": {
          "type": [
            "string",
            "null"
          ],
          "description": "Roughly 48 characters of page text immediately before the selection, used to tell repeated quotes apart."
        },
        "suffix": {
          "type": [
            "string",
            "null"
          ],
          "description": "Roughly 48 characters immediately after the selection."
        },
        "start": {
          "type": [
            "string",
            "null"
          ],
          "description": "CSS path to the element holding the selection's first character."
        },
        "startOffset": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Offset of that character within the start element's own text.",
          "format": "int32"
        },
        "end": {
          "type": [
            "string",
            "null"
          ],
          "description": "CSS path to the element holding the selection's last character."
        },
        "endOffset": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Offset one past that character, within the end element's own text.",
          "format": "int32"
        },
        "page": {
          "type": [
            "string",
            "null"
          ],
          "description": "Page within a multi-file site: \"/\" for the entrypoint, otherwise a path relative to the site root."
        },
        "version": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Site version the selection was made against, so a stale anchor can say which version it described.",
          "format": "int32"
        }
      },
      "description": "Where on the page a comment was left. Several redundant descriptions of one spot, because each survives a different kind of edit. Resolved in the browser, never by the API. All fields are optional; `text` alone is a usable anchor."
    }
  }
}