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.
Scalar types
Section titled “Scalar types”These types are usable as route constraints ({name:type}) and are inferred automatically from handler parameter types.
| Constraint name(s) | .NET type | Accepted input |
|---|---|---|
string (default) | string | Any single token |
alpha | string | Letters only ([a-zA-Z]+) |
int | int | Integer — e.g. 42, -7, 1_000 |
long | long | Large integer — e.g. 1000000000 |
bool | bool | true or false |
double | double | Floating point — e.g. 3.14, -0.5 |
guid | Guid | Standard GUID — e.g. 123e4567-e89b-12d3-a456-426614174000 |
email | string | Valid email address — e.g. user@example.com |
uri | Uri | Any URI — e.g. https://example.com |
url | Uri | HTTP/HTTPS URL with valid host |
urn | Uri | URN — e.g. urn:isbn:0451450523 |
Temporal scalar types
Section titled “Temporal scalar types”Temporal scalars capture a single point in time or a duration. Each has one or more constraint name aliases — any alias is interchangeable.
date / dateonly / date-only
Section titled “date / dateonly / date-only”Binds to DateOnly.
| Format | Example |
|---|---|
yyyy-MM-dd | 2024-01-15 |
datetime / date-time
Section titled “datetime / date-time”Binds to DateTime.
| Format | Example |
|---|---|
yyyy-MM-dd | 2024-01-15 |
yyyy-MM-ddTHH:mm | 2024-01-15T10:30 |
yyyy-MM-dd HH:mm | 2024-01-15 10:30 |
yyyy-MM-ddTHH:mm:ss | 2024-01-15T10:30:45 |
datetimeoffset / date-time-offset
Section titled “datetimeoffset / date-time-offset”Binds to DateTimeOffset. Accepts all datetime formats plus an optional timezone designator appended to the datetime.
| Format | Example |
|---|---|
yyyy-MM-dd | 2024-01-15 |
yyyy-MM-ddTHH:mm | 2024-01-15T10:30 |
yyyy-MM-ddTHH:mmK | 2024-01-15T10:30+05:00 |
yyyy-MM-ddTHH:mm:ss | 2024-01-15T10:30:45 |
yyyy-MM-ddTHH:mm:ssK | 2024-01-15T10:30:45Z |
| ISO 8601 round-trip | 2024-01-15T10:30:45.0000000+05:00 |
K is any valid offset: Z (UTC), +HH:mm, or -HH:mm.
time / timeonly / time-only
Section titled “time / timeonly / time-only”Binds to TimeOnly.
| Format | Example |
|---|---|
HH:mm | 14:30 |
HH:mm:ss | 14:30:45 |
timespan / time-span
Section titled “timespan / time-span”Binds to TimeSpan. Three format families are accepted; mixing families within a single value is not supported.
Compact duration
Section titled “Compact duration”Compact tokens for each unit:
| Suffix | Unit | Example |
|---|---|---|
d | Days | 30d |
h | Hours | 8h |
m | Minutes | 30m |
s | Seconds | 45s |
ms | Milliseconds | 500ms |
Combine units in descending order (d → h → m → s → ms). Underscore separators are optional:
1h30m → 1 hour 30 minutes2d4h → 2 days 4 hours1h30m45s → 1 hour 30 minutes 45 seconds1h_30m_45s → same, with separatorsISO 8601 duration
Section titled “ISO 8601 duration”P30D → 30 daysPT8H → 8 hoursP1DT2H30M → 1 day, 2 hours, 30 minutesPT1H30M45S → 1 hour, 30 minutes, 45 secondsStandard .NET colon format
Section titled “Standard .NET colon format”HH:mm:ss → e.g. 08:30:00d.HH:mm:ss → e.g. 1.08:30:00 (1 day, 8 hours, 30 minutes)Temporal range types
Section titled “Temporal range types”Temporal ranges capture an interval — a start and an end — from a single token. There are three types, one per temporal precision:
| .NET type | Start/end type | Duration constraint |
|---|---|---|
ReplDateRange | DateOnly | Duration must be whole days (d only, no sub-day units) |
ReplDateTimeRange | DateTime | Any TimeSpan format |
ReplDateTimeOffsetRange | DateTimeOffset | Any TimeSpan format |
All three types expose .From and .To properties of their respective type.
Syntax
Section titled “Syntax”Two forms are accepted for all three range types:
start..end # inclusive start-to-end rangestart@duration # start plus a forward durationTimestamp formats
Section titled “Timestamp formats”The timestamp format depends on the range type:
ReplDateRange — uses date format:
2024-01-15ReplDateTimeRange — uses datetime formats:
2024-01-152024-01-15T10:302024-01-15 10:302024-01-15T10:30:45ReplDateTimeOffsetRange — uses datetimeoffset formats:
2024-01-152024-01-15T10:302024-01-15T10:30+05:002024-01-15T10:30:45ZDuration formats (for @duration)
Section titled “Duration formats (for @duration)”The duration part accepts all TimeSpan formats listed above, subject to the type constraint:
ReplDateRange@duration— whole-day units only:@30d,@P30Dare valid; sub-day or calendar units (@8h,@P1M,@PT30M) are not validReplDateTimeRange@duration— anyTimeSpanformat, e.g.@8h30mReplDateTimeOffsetRange@duration— anyTimeSpanformat
Examples
Section titled “Examples”# Date-only rangemyapp report --period 2024-01-01..2024-03-31myapp report --period 2024-01-01@90d
# DateTime range — narrow to hoursmyapp logs --range 2024-03-15T08:00..2024-03-15T18:00myapp logs --range 2024-03-15T08:00@8h
# DateTimeOffset range — cross-timezone audit windowmyapp audit --window 2024-01-15T00:00:00Z..2024-01-15T23:59:59Zmyapp audit --window 2024-01-15T00:00:00Z@1dRoute registration
Section titled “Route registration”// Inferred from parameter type — no constraint name neededapp.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