Numeric types
numeric
Section titled “numeric”Any numeric value, equivalent to number in JSON Schema. The base type for all numeric types.
A JSON example of this model.
// Scale 0100
// Scale 1100.5
// Negative, scale 2-100.5The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: numeric.yamltype: numberdescription: Any numeric valueinteger
Section titled “integer”A whole number without decimals, equivalent to integer in JSON Schema.
A JSON example of this model.
// Positive42
// Negative-42The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: integer.yamltype: integerdescription: A whole number without decimalsdecimalString
Section titled “decimalString”A decimal number (with variable scale) encoded as a string, to avoid floating point issues.
A JSON example of this model.
// Scale 0"100"
// Scale 1"100.5"
// Negative, scale 2"-100.50"The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: decimalString.yamltype: stringexamples: - "-100.5" - "100.5" - "100"pattern: ^-?[0-9]+\.?[0-9]*$description: A decimal number (with variable scale) encoded as a string, to avoid floating point issuesThe TypeSpec code for this model.
@example("0.6.0")@pattern("^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$")@Versioning.added(CommonGrants.Versions.v0_6)scalar protocolVersion extends string;
// ########################################// Numeric types// ########################################
/** A decimal number (with variable scale) encoded as a string, to avoid floating point issues */The TypeScript code for this model.
/** Unique Entity Identifier (UEI) issued by SAM.gov. */export const SamUeiSchema = z.string().regex(/^[A-HJ-NP-Z0-9]{12}$/);Other numeric types
Section titled “Other numeric types”TypeSpec supports several other numeric types, including float and decimal. A full list of these types can be found in the TypeSpec documentation.