Bool
The bool type — true/false values.
The bool type validates a boolean value. In data it is written compactly as T/F or verbosely as true/false.
For the boolean value syntax, see Booleans.
TypeDef
A bool MemberDef accepts only the options below. Any other key is invalid.
type
string
The type name bool. First positional value.
default
bool
Value used when the member is omitted. Second positional value.
optional
bool
If true, the member may be omitted. Shorthand: ? suffix on the key.
null
bool
If true, the member may be null. Shorthand: * suffix on the key.
Examples
active: bool
---
~ T # ✓ true
~ false # ✓
~ yes # ✗ expected-booleanOptional with a default:
verified?: { bool, T } # optional; defaults to true when omitted
---
~ {} # ✓ verified resolves to T
~ F # ✓ verified is FNullable:
Optional, nullable & defaults
T/true/F/false
the boolean
any other token
expected-boolean error
N, key nullable (*)
null
N, not nullable
forbidden-null error
omitted, default set
the default
omitted, optional (?), no default
absent
omitted, required
missing-value error
See Also
Last updated
Was this helpful?
