For the complete documentation index, see llms.txt. This page is also available as Markdown.

Any

The any type — accepts any value, optionally constrained by anyOf or choices.

The any type accepts a value of any type. It is the default when a field is declared without a type (name is the same as name: any). You can still narrow it with choices or, for a union of types, anyOf.

a, b: any, c: { type: any }
---
~ hello, 42, T        # ✓ — anything goes

Declaring alternatives (anyOf)

anyOf lets a field accept any one of several types or MemberDefs — Internet Object's union type.

id: { any, anyOf: [string, int] }
---
~ 42        # ✓ matches int
~ abc       # ✓ matches string
flag: { any, anyOf: [bool, int] }
---
~ hello     # ✗ matches neither

Each alternative may be a full MemberDef or a SchemaDef:

value: { any, anyOf: [{ int, multipleOf: 5 }, { int, multipleOf: 3 }] }
---
~ 10        # ✓ multiple of 5
~ 9         # ✓ multiple of 3

TypeDef

An any MemberDef accepts only the options below.

Option
Type
Description

type

string

The type name any.

default

any

Value used when the member is omitted.

choices

array

Restricts the value to a fixed set (of any type).

anyOf

array of MemberDef/type

The value must match one of these.

optional

bool

If true, the member may be omitted. Shorthand: ? suffix.

null

bool

If true, the member may be null. Shorthand: * suffix.

choices

Optional, nullable & defaults

Implementation status (beta)

  • Keyed null: is not yet honored — use the * suffix.

See Also

Last updated

Was this helpful?