Skip to main content

Field Types & Options

Fields define the properties of your entities. Each field has a type and optional configuration.

Field Types

String Types

string

Basic text field.

title:
type: string
required: true

url

URL with validation.

website:
type: url
optional: true

Numeric Types

int

Integer number.

count:
type: int
default: 0

float

Floating point number.

rating:
type: float
optional: true

Boolean

isActive:
type: boolean
default: true

Date & Time

isoDate

ISO 8601 date string.

dueDate:
type: isoDate
optional: true

Object ID

objectId

MongoDB ObjectId reference.

authorId:
type: objectId
ref: User
required: true

Enums

Define a set of allowed values.

Simple format:

status:
type: enum
values: [draft, published, archived]
default: draft

Enhanced format with labels:

priority:
type: enum
values:
- key: low
label: Low Priority
- key: medium
label: Medium Priority
- key: high
label: High Priority
default: medium

Arrays

String Array

tags:
type: string[]
default: []

ObjectId Array

memberIds:
type: objectId[]
ref: User
default: []

Integer Array

scores:
type: int[]
default: []

Generic Array

items:
type: array
items:
type: string
default: []

Objects

object

Free-form object.

metadata:
type: object
optional: true

any

Any type (no validation).

data:
type: any
optional: true

Field Options

required / optional

email:
type: string
required: true # Field must be provided

bio:
type: string
optional: true # Field is optional

default

Default value when not provided.

status:
type: enum
values: [active, inactive]
default: active

label

Human-readable label for UI.

createdAt:
type: isoDate
label: Creation Date

ref

Reference to another entity (for objectId fields).

projectId:
type: objectId
ref: Project
required: true

expose

Control field visibility across surfaces.

passwordHash:
type: string
internal: true
expose:
contracts: false
create: false
update: false
read: false

Surfaces:

  • contracts - Zod schema
  • create - Create operations
  • update - Update operations
  • read - Read operations

internal

Mark field as internal (hidden by default, requires explicit expose).

secretKey:
type: string
internal: true
expose:
create: true # Only exposed during creation

select

Control MongoDB selection (default: true).

largeField:
type: string
select: false # Not selected by default

Include field in text search.

title:
type: string
search: true

trackChanges

Enable field-level change tracking.

approvalStatus:
type: enum
values: [pending, approved, rejected]
trackChanges: true

Special Field Types

secretKey

Encrypted secret (never selected by default).

apiSecret:
type: secretKey
internal: true

encryptedKey

Encrypted field (never selected by default).

encryptedData:
type: encryptedKey
internal: true

Example Entity with Various Field Types

entities:
Product:
fields:
# Basic fields
name:
type: string
required: true
label: Product Name
search: true

sku:
type: string
required: true
label: SKU

# Numeric fields
price:
type: float
required: true
label: Price

stock:
type: int
default: 0
label: Stock Count

# Enum
category:
type: enum
values: [electronics, clothing, food, other]
default: other
label: Category

# References
vendorId:
type: objectId
ref: Vendor
optional: true
label: Vendor

# Arrays
tags:
type: string[]
default: []
label: Tags

imageUrls:
type: string[]
default: []
label: Product Images

# Dates
releaseDate:
type: isoDate
optional: true
label: Release Date

# Objects
specs:
type: object
optional: true
label: Specifications

# Boolean
isActive:
type: boolean
default: true
label: Active Status

Next Steps