A MemberDef (Member Definition) is the core way to define the type, validation rules, and constraints for a single value in an Internet Object schema. With MemberDefs, you can precisely control how each field is validated, using concise and powerful Internet Object syntax.
Every MemberDef is strictly validated against its type's TypeDef, ensuring schema correctness and interoperability.
What is a MemberDef?
A MemberDef is an IO object that defines:
The type of a value (e.g., number, string, object, array)
Any validation rules, constraints, or options for that value (e.g., min, max, choices, etc.)
Optional default value, nullability, or optionality (using positional values and conventions)
Only options and positional values defined in theTypeDeffor that type are valid in MemberDefs.
MemberDef Syntax and Usage
A MemberDef is always a { ... } object in Internet Object format, typically with:
Type as the first value (by position or as a type: key)
Positional values (like default or choices, if supported by the TypeDef)
Q: Can I use both forms together? A: Yes—use Object Schema for nested structure, MemberDef for each field (even nested).
Q: What if my MemberDef contains a nested schema? A: Use schema: { ... } inside the MemberDef for deep validation.
Q: What error do I get if I use the wrong form or invalid key? A: Validation fails, usually with a "type mismatch" or "unexpected/invalid field" error, depending on context and TypeDef.
Q: Where do I find all valid options for each type? A: See the TypeDef reference.
# Valid MemberDefs with various types and constraints
age: {number, min: 10, max: 99}
# With 20 as default value
age: {number, 20}
# With choices [10,20,30,40,50] and default 20
age: {int16, 20, [10, 20, 30, 40, 50]}
# With constraints and nullability set specifically
age: {number, min: 10, max: 99, null: T}
age: {number, minimum: 10, maximum: 99} # ❌ 'minimum'/'maximum' not valid for number
age: {number, length: 10} # ❌ 'length' not valid for number
flowchart TD
A["{ ... }"] --> B{Is first value a known data type?}
B -- Yes --> C[MemberDef]
B -- No --> D{Contains 'type' or 'schema' as member?}
D -- Yes --> E[MemberDef]
D -- No --> F[Object Schema]