# Fields & types

> Every field key a recipe accepts, the 20 value types the engine generates, and how a field declares a checksum-valid identifier.

Section: Recipes · Type: reference · Last updated: 2026-09-13

A field is a column. Its type decides what kind of value appears; the other keys decide where values come from (a pack, a pattern, a fixed list), how they mix, what must hold, and how the column is labelled. The engine implements 20 types. An identifier with a check digit is declared on the field (type_def: digits, weights, modulus), and every value passes that arithmetic — so a system that rejects one has found a real bug.

## The picture

Field (name + type) → Source (pack · pattern · list) → Mix (weights · shape) → Value (per row)

type decides the kind; the other keys decide the source, the mix and the rules.

## The 20 value types

- person.fullName — A person's full name from the locale pack of the recipe's region
- company.name — A company name from the region's locale pack
- internet.email — A valid-format email address, built from the region's names
- phone — Format from the locale pack (role phone.format), or a pattern
- au.mobile — Alias of phone
- date — ISO date (whole days). min/max are YEAR bounds as numbers, e.g. min: 2026, max: 2026 for a single year. Omit both for the default 2018-2024 window. Add shape: "weekday" for business days only, or month_weights for seasonality. For a point IN TIME, use datetime.
- datetime — A time to the minute: YYYY-MM-DDTHH:MM. The date half acts as date (year bounds, month_weights, weekdays); the time is uniform. no_overlap and row rules compare to the minute (half-open: 10:00 out, 10:00 in). after and flow timestamps use the day; flow writes whole days.
- int — Integer; honours min/max
- float — Decimal number; honours min/max
- finance.amount — Alias of float for money
- enum — Picks from values (required); optional weights for distribution
- finance.card — Luhn-valid payment card number
- bool — True/false. Optional values sets the spelling the system under test expects (["yes","no"], ["1","0"]) — default "true"/"false". Optional weights: [p_true, p_false] skews the split; default even.
- internet.url — URL on the reserved .test domain, so a generated address can never resolve to a real site. A field named for an image (avatar, logo, thumbnail) gets an image path.

- id — Unique row identifier; also used for foreign-key fields via ref
- bank.account — Bank account number (id-style digits)
- address.full — A full street address from the region's locale pack
- text — Free text needs a source: pool (a pack dataset), role, pattern or values; with none, the run is refused.
- row — Draws one column of a named CORRELATED TABLE in the locale pack — set table and column. Two fields naming the same table are guaranteed to come from the SAME row, so values that must agree cannot disagree: {name, typical_gender} stops 'Evie Gupta / male', {suburb, postcode, state} stops a Mumbai postcode in a…
- pool — Draws from a named pool in the locale pack for the recipe's region — set pool: '<name>' alongside. Reaches lists the engine has never heard of (iwi, medicine_names, specialties) with no engine change. A pool no registered pack carries stops the run with missing_packs; nothing is invented.

## Where values come from

- type — What kind of value — text, number, date, choice, identifier.
- type_def — A rule the recipe sets for this column — a check digit, or a code built in parts.
- role (e.g. person.names) — Draw real-world values of a named kind, e.g. surnames. Names a value kind a pack provides. If no loaded pack provides it, the recipe will not validate.
- pool (e.g. surnames) — Draw from a named list supplied by a pack.
- pattern (e.g. BR-##-A) — Keep a shape without keeping the value — BR-##-A. # is a digit, A an uppercase letter, a a lowercase one. Everything else is copied through.
- values (e.g. bronze, silver, gold) — The full set this column is allowed to contain.
- generate — Name the generator directly instead of inferring one.
- table (e.g. suburbs) — Which pack table this column is drawn from. Goes with type "row" — the whole row is drawn together, so suburb, state and postcode agree with each other.
- column (e.g. region) — Which column of that pack table this one takes.

## Labels

- sensitivity — Personal, health, linked, or safe.
- category — Your own grouping for the legend.
- note — A note for your team. Ignored by the engine.

## Which keys act on which kinds

- min — number, date fields only
- max — number, date fields only
- shape — number, date fields only
- dist — number fields only
- month_weights — date fields only
- params_when — number, date fields only
- after — date fields only
- values — choice, text fields only
- weights — choice fields only
- weights_when — choice fields only
- pattern — text fields only
- scope — reference fields only
- fanout — reference fields only
- aggregate — number fields only

- rollup — number fields only

## A field of each source

```json
{
  "fields": [
    {
      "name": "surname",
      "type": "text",
      "role": "person.surnames"
    },
    {
      "name": "ref",
      "type": "text",
      "pattern": "BR-##-A",
      "unique": true
    },
    {
      "name": "tier",
      "values": [
        "bronze",
        "silver",
        "gold"
      ],
      "weights": [
        70,
        20,
        10
      ]
    },
    {
      "name": "member_no",
      "type_def": {
        "digits": 9,
        "checksum": {
          "algorithm": "weighted_mod",
          "weights": [
            1,
            4,
            3,
            7,
            5,
            8,
            6,
            9,
            10
          ],
          "modulus": 11,
          "remainder_from": "zero"
        }
      },
      "sensitivity": "pii"
    }
  ]
}
```

role draws from a pack, pattern keeps a shape, values fixes the set, type_def declares the checksum every value passes.

## Common questions

**Which type should I use for an identifier?**

Use id for a row key or a foreign key (with ref). When the system under test validates the number, declare it: type_def carries the digits, the weights, the modulus and where the check digit sits, read out of the validator. finance.card is Luhn-valid as it stands. Every value passes the declared arithmetic, so an accepting system is exercised and a rejecting one has found a genuine problem. Nothing country-specific ships; worked declarations for tax, business and health numbers are in examples/packs/types.

**What happens with a type the engine does not know?**

An unknown type falls back to shape-preserving text, and validate_recipe warns about it. Prefer a listed type; the warning names the closest one.

**Why is a key I set being ignored?**

Some keys only act on some kinds of field: min and max on numbers and dates, weights on choices, pattern on text, scope and fanout on references. A key on the wrong kind parses and is silently ignored; validate_recipe reports it as a warning.

## Related

- [Entities](https://theworklens.com/docs/recipes/entities): How a recipe declares its tables — name, row count, fields, and the table-level constructs that shape whole rows.
- [Rules & constraints](https://theworklens.com/docs/recipes/rules): What must hold on every row — ranges, uniqueness, date order, conditional presence, and constraints across columns.
- [Recipe schema](https://theworklens.com/docs/reference/recipe-schema): The 13 top-level keys of a recipe, the minimal example, and what the engine supports and does not — from the schema it serves to agents.
- [Locale packs](https://theworklens.com/docs/packs/locale): Names, companies, streets, suburbs and bank codes for a region come from a locale pack you register. None ships with WorkLens; examples live in the repository.

_← Previous: [Entities](https://theworklens.com/docs/recipes/entities) · Next: [Relationships](https://theworklens.com/docs/recipes/relationships) →_

_Types come from the schema payload the MCP server serves; keys from the studio’s reference tab. Source: get_recipe_schema + recipe-rules.ts._

_Canonical: https://theworklens.com/docs/recipes/fields · This copy: https://theworklens.com/docs/recipes/fields.md_
