{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/verifiedhandles-org/json-schema/verifiedhandles-org-editor-context-schema.json",
  "title": "EditorContext",
  "description": "An entry as the editor opens it, and what the caller may do to it.",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/verifiedhandles-org-openapi.json#/components/schemas/EditorContext",
  "type": "object",
  "properties": {
    "vhid": {
      "type": "string"
    },
    "key": {
      "type": "string",
      "description": "The entry’s canonical key: its short name, or its VHID."
    },
    "signedIn": {
      "type": "boolean"
    },
    "csrf": {
      "description": "For a browser session’s changes. A key needs none.",
      "type": [
        "string",
        "null"
      ]
    },
    "capabilities": {
      "type": "object",
      "properties": {
        "canEditLive": {
          "type": "boolean",
          "description": "May save a change live, with no review."
        },
        "canPropose": {
          "type": "boolean",
          "description": "May propose a change (`POST /api/entity/{vhid}/proposals`)."
        },
        "canUploadMedia": {
          "type": "boolean"
        },
        "canUploadFromUrl": {
          "type": "boolean"
        },
        "canUploadUnlicensed": {
          "type": "boolean"
        },
        "canLinkImages": {
          "type": "boolean"
        }
      },
      "required": [
        "canEditLive",
        "canPropose",
        "canUploadMedia",
        "canUploadFromUrl",
        "canUploadUnlicensed",
        "canLinkImages"
      ],
      "additionalProperties": false,
      "description": "What the caller may do to this entry. All false signed out."
    },
    "tools": {
      "anyOf": [
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        },
        {
          "type": "null"
        }
      ],
      "description": "Reviewers’ and managers’ tools for the entry. Null for anyone who neither reviews nor manages entries. With `manage_entries` it carries `spotlightRanks` `{ top, standard, threshold }`: the ranks the Spotlight presets write (a Top pin, a standard spotlight) and the rank from which a spotlight stays above breakout external entries (Trending’s `manualPinThreshold`); null without it."
    },
    "proposePolicy": {
      "type": "string",
      "enum": [
        "registered",
        "trusted",
        "admin",
        "closed"
      ],
      "description": "Who may propose changes to it."
    },
    "editPolicy": {
      "type": "string",
      "enum": [
        "trusted",
        "admin"
      ],
      "description": "Who may edit it live."
    },
    "accountBlocked": {
      "type": "boolean"
    },
    "signInHost": {
      "type": "string",
      "description": "The host signing in takes a visitor to (JEMEDIA Accounts), which the editor’s “Editing is closed” notice names beside its Sign in."
    },
    "draft": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "vhid": {
              "type": "string"
            },
            "base_revision_id": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^\\d+$"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The revision the draft was edited against, or null."
            },
            "saved_at": {
              "type": "string",
              "format": "date-time",
              "description": "Its last change."
            },
            "expires_at": {
              "type": "string",
              "format": "date-time",
              "description": "When it is deleted unless changed again: 30 days after `saved_at`."
            },
            "draft": {
              "$ref": "#/$defs/EntryDraft"
            }
          },
          "required": [
            "vhid",
            "base_revision_id",
            "saved_at",
            "expires_at",
            "draft"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "Your own unsaved draft of this entry, as `GET /api/entity/{vhid}/draft` answers it, so the editor reads it here and not in a call of its own. Null when you have none, and signed out."
    },
    "openProposal": {
      "description": "The id of your own proposal still waiting on this entry, when you propose rather than edit live: a change you propose now is added to it. Null when none, signed out, or when you edit live.",
      "type": [
        "string",
        "null"
      ]
    },
    "baseRevisionId": {
      "description": "The entry’s current revision. Send it as `base_revision_id` with a change, so a change made meanwhile is caught.",
      "type": [
        "string",
        "null"
      ]
    },
    "editable": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string"
        },
        "subtitle": {
          "type": [
            "string",
            "null"
          ]
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "short": {
          "type": [
            "string",
            "null"
          ]
        },
        "image_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "image_links": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "string"
          }
        },
        "custom_handle_order": {
          "type": "boolean"
        },
        "entity_type": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "person",
                "organization",
                "brand"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "The entry’s type."
        },
        "vh_bio": {
          "anyOf": [
            {
              "$ref": "#/$defs/VhBio"
            },
            {
              "type": "null"
            }
          ],
          "description": "A person’s life facts entered by an editor, on an entry with no item; null for none."
        },
        "native_name": {
          "description": "The name in its own script, shown under the title; null for none.",
          "type": [
            "string",
            "null"
          ]
        },
        "native_name_lang": {
          "description": "Its language code (`ja`, `zh-hant`); null for none.",
          "type": [
            "string",
            "null"
          ]
        },
        "also_known_as": {
          "description": "Another name the subject is known by, as an editor gave it; null for none.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "title",
        "subtitle",
        "description",
        "short",
        "image_id",
        "image_links",
        "custom_handle_order",
        "entity_type",
        "vh_bio",
        "native_name",
        "native_name_lang",
        "also_known_as"
      ],
      "additionalProperties": false,
      "description": "The fields a change may send, as they are now."
    },
    "handles": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "platform_id": {
            "type": "string"
          },
          "value": {
            "description": "Null for an email address when the caller may not edit the entry live.",
            "type": [
              "string",
              "null"
            ]
          },
          "value_norm": {
            "description": "Its key as the site stores it (letter case folded where the platform ignores it), to tell whether another value is the same handle. Null where `value` is masked.",
            "type": [
              "string",
              "null"
            ]
          },
          "display": {
            "type": [
              "string",
              "null"
            ]
          },
          "masked": {
            "description": "Present on a masked email: the address is kept but not shown.",
            "type": "boolean",
            "const": true
          },
          "ref": {
            "description": "On a masked email: which stored handle it is (null when the entry no longer has it). Send it back as `{platform_id, value: null, ref}` to keep that address; leave it out of the list to remove it.",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "description": "The platform’s display name.",
            "type": [
              "string",
              "null"
            ]
          },
          "owner": {
            "type": "string",
            "enum": [
              "wikidata",
              "site"
            ],
            "description": "`wikidata`: the sync keeps it up to date. `site`: a person owns it."
          },
          "wd": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string",
                    "enum": [
                      "listed",
                      "deprecated",
                      "ended",
                      "outranked",
                      "gone"
                    ]
                  },
                  "since": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "removeAfter": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "replacedBy": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "qualifierOnly": {
                    "type": "boolean",
                    "description": "A YouTube channel ID the item states only as a qualifier on its YouTube handle: `state` is `gone`, but the sync counts it as listed and never removes it."
                  }
                },
                "required": [
                  "state",
                  "since",
                  "removeAfter",
                  "replacedBy",
                  "qualifierOnly"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "What the entry’s Wikidata item says about this value, or null when it says nothing."
          },
          "channel_title": {
            "description": "A YouTube row’s channel title, as VH knows it without asking YouTube: for a channel ID, the title VH’s handle checker last read, else the one the item’s Wikidata statement names; for a handle, its channel’s, once the checker has read it. The editor shows it under the row. Absent when there is none.",
            "type": "string"
          },
          "hand_placed": {
            "type": "boolean",
            "description": "An editor set its place inside its platform: it comes before the platform’s other accounts, which follow the site’s order. Send it back as it is (or true for a row moved inside its platform) to keep it; leaving it out keeps the stored one."
          },
          "order_note": {
            "description": "On a platform’s first account, when it has two or more: why it leads, in words, e.g. “First of 31 Instagram accounts: its name is the entry’s short name.” Absent otherwise.",
            "type": "string"
          }
        },
        "required": [
          "platform_id",
          "value",
          "value_norm",
          "display",
          "name",
          "owner",
          "wd",
          "hand_placed"
        ],
        "additionalProperties": false
      },
      "description": "Every handle, in order, as a change sends them back."
    },
    "heldBack": {
      "type": "array",
      "items": {},
      "description": "Values a person took off that Wikidata still lists, held back from the sync. An email’s are left out of both lists for a caller who may not edit the entry live, as its handle is masked."
    },
    "heldBackNotListed": {
      "type": "array",
      "items": {},
      "description": "Values a person took off that Wikidata listed once and no longer lists as current. Still held back from the sync (never deleted by itself); the editor shows them collapsed, each with Allow again."
    },
    "linkNames": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "string"
      },
      "description": "VHID → current title of each entry the description links to."
    },
    "provenance": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "string"
      },
      "description": "For each field the sync may manage, who manages it now."
    },
    "bioNotShown": {
      "anyOf": [
        {
          "$ref": "#/$defs/BioNotShown"
        },
        {
          "type": "null"
        }
      ],
      "description": "Life facts stored on the entry that its page does not state, and why (the editor’s own, or the Wikidata item’s); null when none are stored or the page states them. Null too while the date of birth is hidden from a caller who may not edit the entry live."
    },
    "qid": {
      "description": "The entry’s Wikidata item.",
      "type": [
        "string",
        "null"
      ]
    },
    "syncLocked": {
      "type": "boolean",
      "description": "The sync never changes this entry (it is protected or claimed)."
    },
    "descriptionSource": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ],
      "description": "The \"from Wikipedia\" credit, or null."
    },
    "image": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "kind": {
              "type": "string",
              "enum": [
                "commons",
                "local"
              ]
            },
            "commons_filename": {
              "type": [
                "string",
                "null"
              ]
            },
            "url": {
              "type": "string",
              "description": "The image on this site (`/img/w/…`)."
            },
            "width": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            },
            "height": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            },
            "commonsPage": {
              "type": [
                "string",
                "null"
              ]
            },
            "license": {
              "type": [
                "string",
                "null"
              ]
            },
            "license_name": {
              "type": [
                "string",
                "null"
              ]
            },
            "credit": {
              "type": [
                "string",
                "null"
              ]
            },
            "plate": {
              "description": "How the thumbnail is framed; null until the image is classified."
            }
          },
          "required": [
            "id",
            "kind",
            "commons_filename",
            "url",
            "width",
            "height",
            "commonsPage"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "gallery": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "commons",
              "local"
            ]
          },
          "commons_filename": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": "string",
            "description": "The image on this site (`/img/w/…`)."
          },
          "width": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "height": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "commonsPage": {
            "type": [
              "string",
              "null"
            ]
          },
          "license": {
            "type": [
              "string",
              "null"
            ]
          },
          "license_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit": {
            "type": [
              "string",
              "null"
            ]
          },
          "plate": {
            "description": "How the thumbnail is framed; null until the image is classified."
          }
        },
        "required": [
          "id",
          "kind",
          "commons_filename",
          "url",
          "width",
          "height",
          "commonsPage"
        ],
        "additionalProperties": false
      }
    },
    "galleryLogo": {
      "type": [
        "string",
        "null"
      ]
    },
    "platforms": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "uri_prefix": {
            "type": [
              "string",
              "null"
            ]
          },
          "url_template": {
            "type": "string",
            "description": "How a value becomes its link (doc 01 §4)."
          },
          "is_double": {
            "type": "boolean"
          },
          "at_prefix": {
            "type": "boolean"
          },
          "wikidata_prop": {
            "type": [
              "string",
              "null"
            ]
          },
          "case_fold": {
            "type": "boolean"
          },
          "icon": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "category",
          "uri_prefix",
          "url_template",
          "is_double",
          "at_prefix",
          "wikidata_prop",
          "case_fold",
          "icon"
        ],
        "additionalProperties": false
      },
      "description": "Every platform a handle may be on, the most used first."
    }
  },
  "required": [
    "vhid",
    "key",
    "signedIn",
    "csrf",
    "capabilities",
    "tools",
    "proposePolicy",
    "editPolicy",
    "accountBlocked",
    "signInHost",
    "draft",
    "openProposal",
    "baseRevisionId",
    "editable",
    "handles",
    "heldBack",
    "heldBackNotListed",
    "linkNames",
    "provenance",
    "bioNotShown",
    "qid",
    "syncLocked",
    "descriptionSource",
    "image",
    "gallery",
    "galleryLogo",
    "platforms"
  ],
  "additionalProperties": false,
  "$defs": {
    "BioNotShown": {
      "type": "object",
      "properties": {
        "reason": {
          "type": "string",
          "enum": [
            "no_kind",
            "not_person",
            "under_18",
            "birth_date_hidden",
            "item_facts_used"
          ],
          "description": "`no_kind`: the entry has no kind (only a person’s page states life facts); `not_person`: its kind is not Person; `under_18`: by the stored date of birth the subject is under 18; `birth_date_hidden`: “Hide date of birth” is on and nothing else is stated; `item_facts_used`: an editor’s facts on an entry with a Wikidata item, whose facts are used instead."
        },
        "source": {
          "type": "string",
          "enum": [
            "vh_bio",
            "wikidata"
          ],
          "description": "Whose facts they are: an editor’s (`vh_bio`) or the Wikidata item’s."
        },
        "text": {
          "type": "string",
          "description": "The same in words, as the Entry manager’s card says it."
        }
      },
      "required": [
        "reason",
        "source",
        "text"
      ],
      "additionalProperties": false,
      "description": "Life facts stored on an entry that its page does not state, and why."
    },
    "EntryDraft": {
      "type": "object",
      "properties": {
        "vhid": {
          "description": "The entry’s VHID. Optional when sending; it must be this entry’s.",
          "type": "string"
        },
        "savedAt": {
          "description": "When the draft was last changed, in milliseconds since 1970. Ignored when sending: the server keeps its own time.",
          "type": "number"
        },
        "fields": {
          "type": "object",
          "properties": {
            "title": {
              "type": "string"
            },
            "subtitle": {
              "type": "string"
            },
            "description": {
              "type": "string"
            },
            "short": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "description": "The entry’s fields as edited. The description is HTML, kept through the same allowlist as a saved description."
        },
        "handles": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "platform_id": {
                "type": "string"
              },
              "value": {
                "type": "string"
              },
              "display": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kept": {
                "description": "A masked email kept as stored.",
                "type": "boolean",
                "const": true
              },
              "ref": {
                "description": "Which stored email a kept one is.",
                "type": "string"
              }
            },
            "required": [
              "platform_id",
              "value"
            ],
            "additionalProperties": false
          }
        },
        "customOrder": {
          "description": "The handles are in the entry’s own order.",
          "type": "boolean"
        },
        "linkNames": {
          "description": "VHID → name, for the entries the description links to.",
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "string"
          }
        },
        "image": {
          "description": "The lead image as picked: null when removed, absent when untouched.",
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^\\d{1,19}$",
                  "description": "The image’s id."
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "commons",
                    "local"
                  ]
                },
                "commons_filename": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "kind",
                "commons_filename"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "gallery": {
          "description": "The images after the lead, when changed.",
          "maxItems": 5,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^\\d{1,19}$",
                "description": "The image’s id."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "commons",
                  "local"
                ]
              },
              "commons_filename": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "kind",
              "commons_filename"
            ],
            "additionalProperties": false
          }
        },
        "imageLinks": {
          "description": "Image id → link as typed, when changed.",
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "string"
          }
        },
        "relinquish": {
          "description": "Fields to hand to Wikidata on save.",
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "title",
              "subtitle",
              "description",
              "image"
            ]
          }
        },
        "takeover": {
          "description": "Fields to take back from Wikidata on save.",
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "title",
              "subtitle",
              "description",
              "image"
            ]
          }
        },
        "dropCredit": {
          "description": "Remove the Wikipedia credit on save.",
          "type": "boolean",
          "const": true
        },
        "creditPage": {
          "description": "A Wikipedia page named for the credit, as typed.",
          "type": "string"
        },
        "creditManage": {
          "description": "With `creditPage`: the description is not to go to the sync.",
          "type": "boolean",
          "const": false
        },
        "handleTakeover": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "handleRelinquish": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "handleRelease": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "fields"
      ],
      "additionalProperties": false,
      "description": "An unsaved edit to an entry, in the editor’s own shape."
    },
    "VhBio": {
      "type": "object",
      "properties": {
        "birth_date": {
          "type": "string",
          "description": "ISO 8601 at the source’s precision: `2004-10-21`, `2004-10` or `2004`."
        },
        "birth_date_source": {
          "type": "string",
          "description": "The address (http or https) of a source that states the date."
        },
        "birth_name": {
          "type": "string"
        },
        "birth_name_source": {
          "description": "Required with `birth_name`.",
          "type": "string"
        },
        "birth_place": {
          "type": "string"
        },
        "birth_place_source": {
          "description": "Required with `birth_place`.",
          "type": "string"
        }
      },
      "required": [
        "birth_date",
        "birth_date_source"
      ],
      "additionalProperties": false,
      "description": "A person’s life facts entered by an editor, each with its source."
    }
  }
}