{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cnvs-app/json-schema/cnvs-app-add-text-request-schema.json",
  "title": "AddTextRequest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cnvs-app-openapi.yml#/components/schemas/AddTextRequest",
  "type": "object",
  "required": [
    "x",
    "y",
    "content"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Optional stable id. Pass an existing id to UPDATE that node in place; omit to CREATE a new one with a fresh UUID."
    },
    "x": {
      "type": "number",
      "description": "World x (+x right)."
    },
    "y": {
      "type": "number",
      "description": "World y (+y DOWN, standard SVG)."
    },
    "content": {
      "type": "string",
      "description": "Raw content (up to 100 000 chars). Supports cnvs markup (Markdown-ish) and Mermaid (one diagram per node — entire content must be a single ```mermaid fenced block)."
    },
    "color": {
      "type": "string",
      "enum": [
        "auto",
        "black",
        "red",
        "blue",
        "green",
        "orange",
        "yellow",
        "pink",
        "purple",
        "maroon",
        "brown",
        "gray",
        "lightgray",
        "teal",
        "sage",
        "sky",
        "lavender"
      ],
      "description": "Ink color NAME — same mental model as clicking the ink picker. Case-insensitive. `auto` / `black` / omitted → theme-aware. `red` / `blue` / `green` and the extended palette (`orange`, `yellow`, `pink`, `purple`, `maroon`, `brown`, `gray`, `lightgray`, `teal`, `sage`, `sky`, `lavender`) → emphasis colors. Custom hex codes silently clamp to `auto` so AI writes never end up invisible on dark mode."
    },
    "width": {
      "type": [
        "number",
        "null"
      ],
      "description": "Explicit width in px (160–4096), or null for auto-fit."
    },
    "postit": {
      "type": "boolean",
      "description": "Renders as a yellow sticky note when true."
    },
    "author": {
      "$ref": "#/$defs/AuthorTag"
    }
  },
  "$defs": {
    "AuthorTag": {
      "type": "string",
      "description": "Author tag, charset `[A-Za-z0-9:_\\-.]`, max 80 chars. Defaults to `ai:rest` for REST mutations. Use `ai:<your-label>` (e.g. `ai:claude`, `ai:mybot`) so humans can tell AI edits apart.",
      "pattern": "^[A-Za-z0-9:_\\-.]{1,80}$"
    }
  }
}