Other core types
boolean
Section titled “boolean”A value that is either true or false, equivalent to boolean in JSON Schema.
A JSON example of this model.
trueThe JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: boolean.yamltype: booleandescription: A value that is either true or falseAn ordered list of values, equivalent to array in JSON Schema.
Formats
Section titled “Formats”A JSON example of this model.
[1, 2, 3]The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: array.yamltype: arraydescription: An ordered list of valuesIn TypeSpec, you can specify the type of the values in the array with templating:
/** An array of integers */alias IntegerArray = Array<integer>This is equivalent to the following JSON Schema:
$id: IntegerArray.yamltype: arrayitems: type: integerRecord
Section titled “Record”A collection of key-value pairs, equivalent to object in JSON Schema.
Formats
Section titled “Formats”A JSON example of this model.
{ "foo": 1, "bar": 2}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: record.yamltype: objectdescription: A collection of key-value pairsIn TypeSpec, you can specify the type of the values in the record with templating:
/** A record with a string key and an integer value */alias StringIntRecord = Record<integer>This is equivalent to the following JSON Schema:
$id: StringIntRecord.yamltype: objectadditionalProperties: type: integerIf you want to define specific keys in a record, you can do so with a model.
The null type, equivalent to null in JSON Schema.
A JSON example of this model.
nullThe JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: null.yamltype: nulldescription: A value that is nullunknown
Section titled “unknown”The unknown type accepts any value. It is equivalent to an empty JSON Schema.
A JSON example of this model.
// String"foo"
// Integer123
// BooleantrueThe JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: unknown.yamldescription: A value with any type