---
title: "Value types (ValueType)"
description: "Generated from the doc schema (CatalogDocSchema, @canonify/kernel-catalog/doc): each field’s type, default and description are the schema’s own, and each example is a bundle file that readBundle…"
order: 16
id: "model/value-type"
---

# Value types (ValueType)

Generated from the doc schema (`CatalogDocSchema`, @canonify/kernel-catalog/doc): each field’s type, default and description are the schema’s own, and each example is a bundle file that readBundle decodes. A field’s Example is its value in one of those examples.

## ValueType {#valuetype}

What a stored property holds.

One of, told apart by `t`:

- [ValueType.text](value-type.md#valuetype.text)
- [ValueType.integer](value-type.md#valuetype.integer)
- [ValueType.decimal](value-type.md#valuetype.decimal)
- [ValueType.quantity](value-type.md#valuetype.quantity)
- [ValueType.money](value-type.md#valuetype.money)
- [ValueType.boolean](value-type.md#valuetype.boolean)
- [ValueType.date](value-type.md#valuetype.date)
- [ValueType.time](value-type.md#valuetype.time)
- [ValueType.instant](value-type.md#valuetype.instant)
- [ValueType.duration](value-type.md#valuetype.duration)
- [ValueType.set](value-type.md#valuetype.set)
- [ValueType.file](value-type.md#valuetype.file)
- [ValueType.json](value-type.md#valuetype.json)
- [EnumType](value-type.md#enumtype)

## ValueType.text {#valuetype.text}

Text (stored NFC; blank after trim is no value).

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"text"` | yes | — | `"text"` | The value kind: text. |
| `format` | `"line"` \| `"long"` \| `"email"` \| `"phone"` \| `"url"` \| `"currency"` | no | — | `"long"` | How the text is read and checked: one line (default), long text, an email address, a phone number, an http(s) URL or an ISO 4217 currency code. |
| `maxLength` | integer (greater than 0) | no | — | `254` | At most this many characters (code points). |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "text", "format": "email", "maxLength": 254 }
```

## ValueType.integer {#valuetype.integer}

A whole number, |v| ≤ 2^53−1.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"integer"` | yes | — | `"integer"` | The value kind: integer. |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "integer" }
```

## ValueType.decimal {#valuetype.decimal}

An exact decimal with a fixed number of fraction digits.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"decimal"` | yes | — | `"decimal"` | The value kind: decimal. |
| `scale` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` \| `7` \| `8` \| `9` | yes | — | `2` | Digits after the decimal point, 0–9; the value is stored as value × 10^scale. |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "decimal", "scale": 2 }
```

## ValueType.quantity {#valuetype.quantity}

An exact decimal amount of a unit.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"quantity"` | yes | — | `"quantity"` | The value kind: quantity. |
| `unit` | string | yes | — | `"h"` | The unit code: a UNITS row (percent among them) or a unit the org declares in settings.units. |
| `scale` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` \| `7` \| `8` \| `9` | yes | — | `1` | Digits after the decimal point, 0–9; the value is stored as value × 10^scale. |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "quantity", "unit": "h", "scale": 1 }
```

## ValueType.money {#valuetype.money}

An amount of money in integer minor units of its currency.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"money"` | yes | — | `"money"` | The value kind: money. |
| `currency` | [ValueType.money.currency](value-type.md#valuetype.money.currency) | yes | — | `"DKK"` | The currency: a fixed code or a property path; mandatory, there is no default currency (C23). |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "money", "currency": "DKK" }
```

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "money", "currency": { "fromProp": ["pr_6w8y0a2c4e"] } }
```

## ValueType.money.currency {#valuetype.money.currency}

The currency: a fixed code or a property path; mandatory, there is no default currency (C23).

One of:

- [ValueType.money.currency.fromProp](value-type.md#valuetype.money.currency.fromprop)
- string

## ValueType.money.currency.fromProp {#valuetype.money.currency.fromprop}

The currency read from another property of the row or of a required parent.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `fromProp` | [PropPath](shapes.md#proppath) | yes | — | `["pr_6w8y0a2c4e"]` | A path of property ids along required to-one refs, ending at a required text{format:currency} property (C23). |

## ValueType.boolean {#valuetype.boolean}

True or false.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"boolean"` | yes | — | `"boolean"` | The value kind: boolean. |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "boolean" }
```

## ValueType.date {#valuetype.date}

A calendar date, YYYY-MM-DD.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"date"` | yes | — | `"date"` | The value kind: date. |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "date" }
```

## ValueType.time {#valuetype.time}

A time of day, HH:MM (C19).

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"time"` | yes | — | `"time"` | The value kind: time. |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "time" }
```

## ValueType.instant {#valuetype.instant}

A point in time, YYYY-MM-DDTHH:MM:SS.sssZ.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"instant"` | yes | — | `"instant"` | The value kind: instant. |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "instant" }
```

## ValueType.duration {#valuetype.duration}

A length of time in integer milliseconds (C18).

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"duration"` | yes | — | `"duration"` | The value kind: duration. |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "duration" }
```

## ValueType.set {#valuetype.set}

Any number of distinct values from a declared list, or of a shared enum domain.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"set"` | yes | — | `"set"` | The value kind: set. |
| `of` | [ValueType.set.of](value-type.md#valuetype.set.of) | yes | — | (see the example) | The values the set may hold: a declared list, or a shared enum domain’s. |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{
  "t": "set",
  "of": {
    "values": [
      { "code": "low", "label": "Low" },
      { "code": "high", "label": "High" }
    ],
    "ordered": false
  }
}
```

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "set", "of": { "enum": "en_4p8s2w6y0b" } }
```

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "set", "of": { "enum": "en_4p8s2w6y0b", "only": ["ev_8n3q5s7u9w"] } }
```

## ValueType.set.of {#valuetype.set.of}

The values the set may hold: a declared list, or a shared enum domain’s.

One of:

- [ValueType.set.of.values](value-type.md#valuetype.set.of.values)
- [ValueType.set.of.enum](value-type.md#valuetype.set.of.enum)

## ValueType.set.of.values {#valuetype.set.of.values}

The values the set may hold.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `values` | [EnumValue](value-type.md#enumvalue)[] | yes | — | (see the example) | The declared values, in their order. |
| `ordered` | boolean | no | — | `false` | Whether the declared order is a ranking (comparisons and sorting follow it). |

## ValueType.set.of.enum {#valuetype.set.of.enum}

The shared enum domain the set holds values of (or the subset `only` lists).

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `enum` | [EnumId](shapes.md#enumid) | yes | — | `"en_4p8s2w6y0b"` | The shared enum domain whose values it holds (an EnumDecl of the doc’s enums; tick lj5). |
| `only` | [EnumValueId](shapes.md#enumvalueid)[] (at least one) | no | — | `["ev_8n3q5s7u9w"]` | The values of the domain it allows, by id (a draft may write their codes): a sub-domain; left out, every value (tick 0tb). |

## ValueType.file {#valuetype.file}

A stored file, by its id.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"file"` | yes | — | `"file"` | The value kind: file. |
| `accept` | string[] | no | — | `["application/pdf"]` | The accepted media types: each an exact type (e.g. image/png) or type/* (any subtype of one top-level type, e.g. image/*). No other wildcard. |
| `maxBytes` | integer (greater than 0) | no | — | `10485760` | The largest file accepted, in bytes. |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "file", "accept": ["application/pdf"], "maxBytes": 10485760 }
```

## ValueType.json {#valuetype.json}

A JSON value of a declared shape.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"json"` | yes | — | `"json"` | The value kind: json. |
| `schema` | [JsonShape](value-type.md#jsonshape) | yes | — | (see the example) | The shape the value must have. |

The `type` of a stored property (an item of `properties` in `types/<name>.json`).

```json
{
  "t": "json",
  "schema": {
    "type": "object",
    "props": { "sku": { "type": "string" } },
    "required": ["sku"]
  }
}
```

## EnumType {#enumtype}

One of a declared list of values, or of a shared enum domain’s.

One of:

- [EnumType.values](value-type.md#enumtype.values)
- [EnumType.enum](value-type.md#enumtype.enum)

## EnumType.values {#enumtype.values}

One of a declared list of values.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"enum"` | yes | — | `"enum"` | The value kind: enum. |
| `values` | [EnumValue](value-type.md#enumvalue)[] | yes | — | (see the example) | The declared values, in their order. |
| `ordered` | boolean | no | — | `true` | Whether the declared order is a ranking (comparisons and sorting follow it). |

The `type` of a stored enum property (an item of `properties` in `types/<name>.json`).

```json
{
  "t": "enum",
  "values": [
    { "code": "low", "label": "Low" },
    { "code": "high", "label": "High" }
  ],
  "ordered": true
}
```

## EnumType.enum {#enumtype.enum}

One of the values of a shared enum domain (or of the subset `only` lists).

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `t` | `"enum"` | yes | — | `"enum"` | The value kind: enum. |
| `enum` | [EnumId](shapes.md#enumid) | yes | — | `"en_4p8s2w6y0b"` | The shared enum domain whose values it holds (an EnumDecl of the doc’s enums; tick lj5). |
| `only` | [EnumValueId](shapes.md#enumvalueid)[] (at least one) | no | — | `["ev_8n3q5s7u9w","ev_1b3d5f7h9k"]` | The values of the domain it allows, by id (a draft may write their codes): a sub-domain; left out, every value (tick 0tb). |

The `type` of a stored enum property (an item of `properties` in `types/<name>.json`).

```json
{ "t": "enum", "enum": "en_4p8s2w6y0b" }
```

The `type` of a stored enum property (an item of `properties` in `types/<name>.json`).

```json
{
  "t": "enum",
  "enum": "en_4p8s2w6y0b",
  "only": ["ev_8n3q5s7u9w", "ev_1b3d5f7h9k"]
}
```

## EnumValue {#enumvalue}

One declared value of an enum or set.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `id` | [EnumValueId](shapes.md#enumvalueid) | yes (propose assigns it; a new declaration leaves it out) | — | — | An enum value id (`ev_…`); renames keep it. |
| `code` | [Ident](shapes.md#ident) | yes | — | `"low"` | The code stored in the column and accepted as input. |
| `label` | [Text](shapes.md#text) | yes (a draft may leave it out: propose writes a default made from the name, `catalog.label_defaulted`) | — | `"Low"` | The words shown for this value. |
| `meaning` | [ValueMeaning](value-type.md#valuemeaning) | no | — | `"critical"` | What the value means (a band value: critical, warn or good). |
| `color` | [EnumColorToken](value-type.md#enumcolortoken) | no | — | `"hot"` | The tone its chip is shown in. |

An item of `values` in an enum or set value type.

```json
{ "code": "gold", "label": "Gold" }
```

An item of `values` in an enum or set value type.

```json
{ "code": "overdue", "label": "Overdue", "meaning": "critical", "color": "hot" }
```

## JsonShape {#jsonshape}

The closed JSON shape a json value is validated against.

One of, told apart by `type`:

- [JsonShape.string](value-type.md#jsonshape.string)
- [JsonShape.enum](value-type.md#jsonshape.enum)
- [JsonShape.array](value-type.md#jsonshape.array)
- [JsonShape.object](value-type.md#jsonshape.object)
- [JsonShape.any](value-type.md#jsonshape.any)

## JsonShape.string {#jsonshape.string}

A JSON scalar.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `type` | `"string"` \| `"number"` \| `"integer"` \| `"boolean"` \| `"null"` | yes | — | `"string"` | A JSON scalar type. |

The `schema` of a json value type.

```json
{ "type": "string" }
```

## JsonShape.enum {#jsonshape.enum}

A string from a fixed list.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `type` | `"enum"` | yes | — | `"enum"` | One of a list of strings. |
| `values` | string[] | yes | — | `["small","large"]` | The strings the value may be. |

The `schema` of a json value type.

```json
{ "type": "enum", "values": ["small", "large"] }
```

## JsonShape.array {#jsonshape.array}

A JSON array of one item shape.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `type` | `"array"` | yes | — | `"array"` | A JSON array. |
| `items` | [JsonShape](value-type.md#jsonshape) | yes | — | `{"type":"string"}` | The shape of every item. |
| `maxItems` | integer (greater than 0) | no | — | `10` | At most this many items. |

The `schema` of a json value type.

```json
{ "type": "array", "items": { "type": "string" }, "maxItems": 10 }
```

## JsonShape.object {#jsonshape.object}

A JSON object with a closed set of keys.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `type` | `"object"` | yes | — | `"object"` | A JSON object. |
| `props` | Record<string, [JsonShape](value-type.md#jsonshape)> | yes | — | `{"sku":{"type":"string"}}` | The shape of each allowed key; other keys are refused. |
| `required` | string[] | no | — | `["sku"]` | The keys that must be present. |

The `schema` of a json value type.

```json
{
  "type": "object",
  "props": { "sku": { "type": "string" }, "qty": { "type": "integer" } },
  "required": ["sku"]
}
```

## JsonShape.any {#jsonshape.any}

Any JSON value.

| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
| `type` | `"any"` | yes | — | `"any"` | Any JSON value (compile warns: value.json_untyped). |

The `schema` of a json value type.

```json
{ "type": "any" }
```

## ValueMeaning {#valuemeaning}

What the value means: live, terminal-good, terminal-bad or sink for a state; critical, warn or good for a band.

Type: `"live"` | `"terminal-good"` | `"terminal-bad"` | `"sink"` | `"critical"` | `"warn"` | `"good"`.

## EnumColorToken {#enumcolortoken}

The tone the value is shown in: hot, warm, cool, good, info or neutral.

Type: `"hot"` | `"warm"` | `"cool"` | `"good"` | `"info"` | `"neutral"`.
