We support a specific set of Kinds:
- '_': Void (also Null or Unit)
- 'i': Elem (a list element)
- 't': True
- 'f': False
- 'x': Bytes (Bytes)
- '"': String (String)
- '-': Int (Int64)
- '.': Float64 (Float64)
- '/': Decimal (String)
- '9': Nanoseconds (Int64) (used for duration and time)
- 'z': Date Time ISO 8601 (String)
- '#': Custom Tag (String)
The decision was made by making a survey of the most common serialization formats. We found that a limited amount of scalar types need to be supported:
| Surveyed | Supported as |
|---|---|
| Null/Void/Unit | Kind |
| Bool | Kind |
| String | String |
| Bytes | Bytes |
| Int64 | Int64 |
| Float64 | Float64 |
| Decimal | String (TODO: What is that exact string format) |
| Uint64 | Int64 (if in range) or fallback to String (if out of int64 range, same as decimal) |
| Date | String: yyyy-mm-dd (ISO 8601) |
| Time | Int64 (nanoseconds since January 1, 1970 UTC) or fallback to String (RFC 3339) |
| Duration | Int64 (nanoseconds) |
| UUID | Bytes (16 bytes) |
| Enum | String (the string representation of the Enum) or fallback to Int64 |
Types can be mapped from rarer types to these supported types.
For example, UUID is mapped to Bytes and Dates to String via RFC 3339.