Shapes

The small type language that says what a field's values look like.

A shape is a type written as a string, or an object of them. Every value a page sends is checked against its field's shape before it's stored or broadcast, so pages can only ever send what the manifest allows.

PropTypeDescription
string"string" · "string(140)"Text, up to 1000 characters or the length given (up to 100000).
number"number" · "number(0..1)"Any finite number, optionally within a range. Either end may be left open: "number(0..)".
integer"integer" · "integer(1..5)"A whole number, optionally within a range.
boolean"boolean"true or false.
url"url"An http(s) URL up to 2048 characters.
color"color"#rgb, #rgba, #rrggbb or #rrggbbaa.
enum"enum(a|b|c)"One of the listed strings (up to 100 options).
any"any"Any JSON.
  • Add ? to make a value optional: "string(80)?" may be left out or null.
  • An object of shapes describes an object, nested up to four deep. Keys not in the shape are refused.
  • A field with no shape accepts any JSON up to 4 KB.
socket.json