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 goesDeclaring 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 stringflag: { any, anyOf: [bool, int] }
---
~ hello # ✗ matches neitherEach 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 3TypeDef
An any MemberDef accepts only the options below.
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
See Also
Last updated
Was this helpful?
