Skip to content

Built-in Types & Formats

This page is the definitive reference for every type Repl can bind from a route segment or command-line token, and every input format each type accepts.


These types are usable as route constraints ({name:type}) and are inferred automatically from handler parameter types.

Constraint name(s).NET typeAccepted input
string (default)stringAny single token
alphastringLetters only ([a-zA-Z]+)
intintInteger — e.g. 42, -7, 1_000
longlongLarge integer — e.g. 1000000000
boolbooltrue or false
doubledoubleFloating point — e.g. 3.14, -0.5
guidGuidStandard GUID — e.g. 123e4567-e89b-12d3-a456-426614174000
emailstringValid email address — e.g. user@example.com
uriUriAny URI — e.g. https://example.com
urlUriHTTP/HTTPS URL with valid host
urnUriURN — e.g. urn:isbn:0451450523

Temporal scalars capture a single point in time or a duration. Each has one or more constraint name aliases — any alias is interchangeable.

Binds to DateOnly.

FormatExample
yyyy-MM-dd2024-01-15

Binds to DateTime.

FormatExample
yyyy-MM-dd2024-01-15
yyyy-MM-ddTHH:mm2024-01-15T10:30
yyyy-MM-dd HH:mm2024-01-15 10:30
yyyy-MM-ddTHH:mm:ss2024-01-15T10:30:45

Binds to DateTimeOffset. Accepts all datetime formats plus an optional timezone designator appended to the datetime.

FormatExample
yyyy-MM-dd2024-01-15
yyyy-MM-ddTHH:mm2024-01-15T10:30
yyyy-MM-ddTHH:mmK2024-01-15T10:30+05:00
yyyy-MM-ddTHH:mm:ss2024-01-15T10:30:45
yyyy-MM-ddTHH:mm:ssK2024-01-15T10:30:45Z
ISO 8601 round-trip2024-01-15T10:30:45.0000000+05:00

K is any valid offset: Z (UTC), +HH:mm, or -HH:mm.

Binds to TimeOnly.

FormatExample
HH:mm14:30
HH:mm:ss14:30:45

Binds to TimeSpan. Three format families are accepted; mixing families within a single value is not supported.

Compact tokens for each unit:

SuffixUnitExample
dDays30d
hHours8h
mMinutes30m
sSeconds45s
msMilliseconds500ms

Combine units in descending order (dhmsms). Underscore separators are optional:

1h30m → 1 hour 30 minutes
2d4h → 2 days 4 hours
1h30m45s → 1 hour 30 minutes 45 seconds
1h_30m_45s → same, with separators
P30D → 30 days
PT8H → 8 hours
P1DT2H30M → 1 day, 2 hours, 30 minutes
PT1H30M45S → 1 hour, 30 minutes, 45 seconds
HH:mm:ss → e.g. 08:30:00
d.HH:mm:ss → e.g. 1.08:30:00 (1 day, 8 hours, 30 minutes)

Temporal ranges capture an interval — a start and an end — from a single token. There are three types, one per temporal precision:

.NET typeStart/end typeDuration constraint
ReplDateRangeDateOnlyDuration must be whole days (d only, no sub-day units)
ReplDateTimeRangeDateTimeAny TimeSpan format
ReplDateTimeOffsetRangeDateTimeOffsetAny TimeSpan format

All three types expose .From and .To properties of their respective type.

Two forms are accepted for all three range types:

start..end # inclusive start-to-end range
start@duration # start plus a forward duration

The timestamp format depends on the range type:

ReplDateRange — uses date format:

2024-01-15

ReplDateTimeRange — uses datetime formats:

2024-01-15
2024-01-15T10:30
2024-01-15 10:30
2024-01-15T10:30:45

ReplDateTimeOffsetRange — uses datetimeoffset formats:

2024-01-15
2024-01-15T10:30
2024-01-15T10:30+05:00
2024-01-15T10:30:45Z

The duration part accepts all TimeSpan formats listed above, subject to the type constraint:

  • ReplDateRange@duration — whole-day units only: @30d, @P30D are valid; sub-day or calendar units (@8h, @P1M, @PT30M) are not valid
  • ReplDateTimeRange@duration — any TimeSpan format, e.g. @8h30m
  • ReplDateTimeOffsetRange@duration — any TimeSpan format
Terminal window
# Date-only range
myapp report --period 2024-01-01..2024-03-31
myapp report --period 2024-01-01@90d
# DateTime range — narrow to hours
myapp logs --range 2024-03-15T08:00..2024-03-15T18:00
myapp logs --range 2024-03-15T08:00@8h
# DateTimeOffset range — cross-timezone audit window
myapp audit --window 2024-01-15T00:00:00Z..2024-01-15T23:59:59Z
myapp audit --window 2024-01-15T00:00:00Z@1d
// Inferred from parameter type — no constraint name needed
app.Map("report period", (ReplDateRange period) => commands.Report(period));
app.Map("logs range", (ReplDateTimeRange range) => commands.Logs(range));
app.Map("audit window", (ReplDateTimeOffsetRange window) => commands.Audit(window));
// CLI usage
// myapp report period --period 2024-01-01..2024-03-31
// myapp logs range --range 2024-03-15T08:00@8h
// myapp audit window --window 2024-01-15T00:00:00Z@1d