Built-in Data types
TypeSpec
Array
Template Parameters
Name | Description |
---|---|
Element | The type of the array elements |
Properties
None
DefaultKeyVisibility
Applies a visibility setting to a collection of properties.
Template Parameters
Name | Description |
---|---|
Source | An object whose properties are spread. |
Visibility | The visibility to apply to all properties. |
Properties
None
ExampleOptions
Options for example decorators
Properties
Name | Type | Description |
---|---|---|
title? | string | The title of the example |
description? | string | Description of the example |
object
Deprecated: object is deprecated. Please use {} for an empty model, Record<unknown>
for a record with unknown property types, unknown[]
for an array.
Represent a model
Properties
None
OmitDefaults
Represents a collection of properties with default values omitted.
Template Parameters
Name | Description |
---|---|
Source | An object whose spread property defaults are all omitted. |
Properties
None
OmitProperties
Represents a collection of omitted properties.
Template Parameters
Name | Description |
---|---|
Source | An object whose properties are spread. |
Keys | The property keys to omit. |
Properties
None
OperationExample
Operation example configuration.
Properties
Name | Type | Description |
---|---|---|
parameters? | unknown | Example request body. |
returnType? | unknown | Example response body. |
OptionalProperties
Represents a collection of optional properties.
Template Parameters
Name | Description |
---|---|
Source | An object whose spread properties are all optional. |
Properties
None
PickProperties
Represents a collection of properties with only the specified keys included.
Template Parameters
Name | Description |
---|---|
Source | An object whose properties are spread. |
Keys | The property keys to include. |
Properties
None
Record
Template Parameters
Name | Description |
---|---|
Element | The type of the properties |
Properties
None
ServiceOptions
Service options.
Properties
Name | Type | Description |
---|---|---|
title? | string | Title of the service. |
version? | string | Version of the service. |
UpdateableProperties
Represents a collection of updateable properties.
Template Parameters
Name | Description |
---|---|
Source | An object whose spread properties are all updateable. |
Properties
None
ArrayEncoding
Encoding for serializing arrays
Name | Value | Description |
---|---|---|
pipeDelimited | Each values of the array is separated by a | | |
spaceDelimited | Each values of the array is separated by a |
BytesKnownEncoding
Known encoding to use on bytes
Name | Value | Description |
---|---|---|
base64 | "base64" | Encode to Base64 |
base64url | "base64url" | Encode to Base64 Url |
DateTimeKnownEncoding
Known encoding to use on utcDateTime or offsetDateTime
Name | Value | Description |
---|---|---|
rfc3339 | "rfc3339" | RFC 3339 standard. https://www.ietf.org/rfc/rfc3339.txt Encode to string. |
rfc7231 | "rfc7231" | RFC 7231 standard. https://www.ietf.org/rfc/rfc7231.txt Encode to string. |
unixTimestamp | "unixTimestamp" | Encode a datetime to a unix timestamp. Unix timestamps are represented as an integer number of seconds since the Unix epoch and usually encoded as an int32. |
DurationKnownEncoding
Known encoding to use on duration
Name | Value | Description |
---|---|---|
ISO8601 | "ISO8601" | ISO8601 duration |
seconds | "seconds" | Encode to integer or float |
boolean
Boolean with true
and false
values.
bytes
Represent a byte array
decimal
A decimal number with any length and precision. This represent any decimal
value possible.
It is commonly represented as BigDecimal
in some languages.
decimal128
A 128-bit decimal number.
duration
A duration/time period. e.g 5s, 10h
float
A number with decimal value
float32
A 32 bit floating point number. (±1.5 x 10^−45
to ±3.4 x 10^38
)
float64
A 64 bit floating point number. (±5.0 × 10^−324
to ±1.7 × 10^308
)
int16
A 16-bit integer. (-32,768
to 32,767
)
int32
A 32-bit integer. (-2,147,483,648
to 2,147,483,647
)
int64
A 64-bit integer. (-9,223,372,036,854,775,808
to 9,223,372,036,854,775,807
)
int8
A 8-bit integer. (-128
to 127
)
integer
A whole number. This represent any integer
value possible.
It is commonly represented as BigInteger
in some languages.
numeric
A numeric type
offsetDateTime
A date and time in a particular time zone, e.g. “April 10th at 3:00am in PST”
plainDate
A date on a calendar without a time zone, e.g. “April 10th”
plainTime
A time on a clock without a time zone, e.g. “3:00 am”
safeint
An integer that can be serialized to JSON (−9007199254740991 (−(2^53 − 1))
to 9007199254740991 (2^53 − 1)
)
string
A sequence of textual characters.
uint16
A 16-bit unsigned integer (0
to 65,535
)
uint32
A 32-bit unsigned integer (0
to 4,294,967,295
)
uint64
A 64-bit unsigned integer (0
to 18,446,744,073,709,551,615
)
uint8
A 8-bit unsigned integer (0
to 255
)
unixTimestamp32
Represent a 32-bit unix timestamp datetime with 1s of granularity. It measures time by the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970.
url
Represent a URL string as described by https://url.spec.whatwg.org/
utcDateTime
An instant in coordinated universal time (UTC)”