Phone
A phone number.
Property | Type | Required | Description |
---|---|---|---|
countryCode | string | Yes | The international country code (e.g., “+1” for US/Canada). |
number | string | Yes | The local phone number without the country code. |
extension | string | No | Optional extension number for the phone line. |
isMobile | boolean | No | Indicates whether this is a mobile/cell phone number. |
Formats
Section titled “Formats”A JSON example of this model is:
{ "countryCode": "+1", "number": "555-123-4567", "extension": "123", "isMobile": true}
The JSON Schema for this model is:
$id: Phone.jsontype: objectproperties: countryCode: type: string pattern: "^\\+[1-9][0-9]{1,3}$" description: The international country code (e.g., "+1" for US/Canada). number: type: string description: The local phone number without the country code. extension: type: string description: Optional extension number for the phone line. isMobile: type: boolean default: false description: Indicates whether this is a mobile/cell phone number.required: - countryCode - numberdescription: A phone number.
The TypeSpec code for this model is:
model Phone { /** The international country code (e.g., "+1" for US/Canada). */ @pattern("^\\+[1-9][0-9]{1,3}$") countryCode: string;
/** The local phone number without the country code. */ number: string;
/** Optional extension number for the phone line. */ extension?: string;
/** Indicates whether this is a mobile/cell phone number. */ isMobile?: boolean = false;}
PhoneCollection
Section titled “PhoneCollection”A collection of phone numbers for a person or organization.
Property | Type | Required | Description |
---|---|---|---|
primary | Phone | Yes | The primary phone number for a person or organization |
fax | Phone | No | The fax number, if applicable |
otherPhones | Record<Phone> | No | Additional phone numbers keyed by a descriptive label |
Formats
Section titled “Formats”A JSON example of this model is:
{ "primary": { "countryCode": "+1", "number": "444-456-1230", "isMobile": true }, "fax": { "countryCode": "+1", "number": "555-123-4567", "extension": "123", "isMobile": false }, "otherPhones": { "support": { "countryCode": "+1", "number": "333-456-1230", "isMobile": false }, "marketing": { "countryCode": "+1", "number": "444-456-1230", "isMobile": true } }}
The JSON Schema for this model is:
$id: PhoneCollection.yamltype: objectproperties: primary: $ref: Phone.yaml description: The primary phone number for a person or organization. fax: $ref: Phone.yaml description: The fax number, if applicable. otherPhones: type: object properties: {} unevaluatedProperties: $ref: Phone.yaml description: Additional phone numbers keyed by a descriptive label.required: - primarydescription: A collection of phone numbers for a person or organization.
The TypeSpec code for this model is:
/** A collection of phone numbers for a person. */model PhoneCollection { /** The person's primary phone number. */ primary: Fields.Phone;
/** The person's fax number, if applicable. */ fax?: Fields.Phone;
/** Additional phone numbers not covered by the standard fields. */ otherPhones?: Record<Fields.Phone>;}