Collections

array, json, vector, map — how to model lists and key-value structures.

array

A homogeneous list of items. Each item conforms to a sub-schema you define.

{
  "name": "Drops",
  "slug": "drops",
  "type": "array",
  "config": {
    "of": {
      "type": "reference",
      "config": { "targetSchema": "item" }
    },
    "minItems": 0,
    "maxItems": 10
  }
}

In the editor, items are shown as a repeatable list with add/remove/reorder controls.

The stored shape is a JSON array:

{ "drops": ["rec_01ITEM1...", "rec_01ITEM2..."] }

json

Arbitrary JSON. Use as an escape hatch when the shape is dynamic or doesn't fit a typed schema.

{
  "name": "AI config",
  "slug": "ai_config",
  "type": "json",
  "config": {
    "schema": {
      "type": "object",
      "properties": {
        "model": { "type": "string" },
        "temperature": { "type": "number" }
      }
    }
  }
}

The optional schema is a JSON Schema fragment used for validation and editor hints. Without it, the editor is a raw JSON textarea.

vector<T>

A homogeneous typed array of primitives. Less expressive than array but with cleaner codegen output.

{
  "name": "Tags",
  "slug": "tags",
  "type": "vector",
  "config": { "of": { "type": "text" } }
}

Generated TypeScript: tags: string[]. Generated C#: string[] Tags. Versus array of text, which would generate a nested item type.

map<T>

A key-value object where keys are strings and values share a single type.

{
  "name": "Resistances",
  "slug": "resistances",
  "type": "map",
  "config": { "of": { "type": "number", "config": { "min": 0, "max": 1 } } }
}

Stored as:

{ "resistances": { "fire": 0.5, "ice": 0.0, "lightning": 0.8 } }

When to use which

  • List of recordsarray of reference (or vector of reference if no per-item config).
  • List of strings, no per-item configvector of text.
  • Heterogeneous list → use select for variant tag + json for payload, or split into separate fields.
  • Dynamic key setmap.
  • One-off complex objectjson. But ask whether it should be its own schema first.