Types
Whether you are defining the type of request parameters for an endpoint, types of endpoint responses or type of fields of a complex type model you need to know about the available types. The type can be primitive or complex.
Native/Scalar Types
Type | Description | Example |
---|---|---|
String | String type e.g. string , NSString* | hello world |
Boolean | Boolean type e.g. bool , BOOL | true |
Number | Integer type e.g. int , Integer | 1 |
Precision | Numerical precision e.g. double | 1.5 |
DateTime | Date and Time type, e.g. Datetime | 2016-03-13T12:52:32.123Z |
Date | Date type, e.g. Datetime with time nullified | 2016-03-13 |
Additional Types
Type | Applicable To | Description |
---|---|---|
Void | Response Type | Response is empty and has no type |
Dynamic | All | If the type schema is not known or cannot be easily defined, you may use the Dynamic option |
Object | Endpoint Parameter Type, Model Field Type | Object data e.g. object |
Binary | Endpoint Response Type, Model Field Type | Binary data, e.g. stream , NSData* |
Long | Endpoint Parameter Type, Model Field Type | Long type e.g. long , Long |
File | Endpoint Parameter Type | A file to be uploaded |
UUID | Endpoint Parameter Type, Model Field Type | This type will store a Universally Unique Identifier (UUID) |
Complex Types
All custom types described in the Types
section of the API are considered complex types.
Attributes
In addition to specifying the type of a field, other type-specific attributes can also be added using the Attributes
option.
This option is available for only String
, Number
, Precision
, Long
, DateTime
and Object
types.
String Attributes
These attributes help define String
type fields in more detail.
Available attributes are:
Attribute Name | Description | Example |
---|---|---|
Minimum Length | Specify the minimum length of the string value. The string value must have a length that is greater or equal to the one specified here. | Valid strings for 3 can be abc , hello but not ab . |
Maximum Length | Specify the maximum length of the string value. The string value must have a length that is less or equal to the one specified here. | Valid strings for 5 can be ab , abc but not abcdef |
Pattern | Specify the regular expression using ECMAScript that the input string value must match. | Valid string values for [A-Z]+ will contain at least one alphabet in upper case e.g. Hello |
Number Attributes
These attributes help define Number
, Precision
and Long
type fields in more detail.
Available attributes are:
Attribute Name | Description | Example |
---|---|---|
Multiple of | A numeric instance is only valid if division by this attribute's value results in an integer. The value of this attribute MUST be a number, strictly greater than 0. | Valid numeric instances for 2 in this case are 4 , 6 , etc. |
Minimum | A numeric instance is only valid if the attribute Exclusive Minimum is true and instance is greater than the provided value, or else if the instance is greater than or exactly equal to the provided value. The value of this attribute MUST be a number, representing a lower limit for a numeric instance. | Valid numeric instances for 5 can be 7 , 10 but not 4 |
Maximum | A numeric instance is only valid if the attribute Exclusive Maximum is true and instance is less than the provided value, or else if the instance is less than or exactly equal to the provided value. The value of this attribute MUST be a number, representing an upper limit for a numeric instance. | Valid numeric instances for 10 can be 8 , 4 but not 12 |
Total Digits | The maximum number of digits allowed in a number including fractional digits that exist in the value (after ignoring the decimal point and negative sign if any). | Valid numeric instances for 4 can be 12.34 , 1234 but not 12345 |
Fraction Digits | The maximum number of digits allowed after the decimal point. | Valid numeric instances for 2 can be 12.34 , 2.45 but not 12.345 |
Pattern | Specify the regular expression using ECMAScript that the input numeric value must match | Valid numeric instances for \d{4} can be 1234 , 4567 but not 12345 |
Exclusive Minimum | This attribute is used along with Minimum . If set to true , the number value should not be equal to the minimum value set in Minimum . | If true and Minimum is set to 2 then valid numeric instances can be 3 , 4 but not 2 . |
Exclusive Maximum | This attribute is used along with Maximum . If set to true , the number value should not be equal to the maximum value set in Maximum . | If true and Maximum is set to 4 then valid numeric instances can be 1 , 2 but not 4 . |
DateTime Format
The attribute, DateTime Format
, can be specified with the DateTime
types. It is the format string for the particular parameter, response or property.
The supported formats are:
Format | Description | Example |
---|---|---|
Rfc3339 | ISO8601 full date time string | 2016-03-13T12:52:32.123Z |
Rfc1123 | HTTP formatted date string | Mon, 15 Jun 2009 20:45:30 GMT |
UnixTimestamp | Unix or Epoch time. Seconds since Jan 01 1970 UTC | 1480809600 |
The specified datetimes will be serialized and deserialized according to the date format chosen.
Object Attributes
These attributes help define Object
type fields in more detail.
Available attributes are:
Attribute Name | Description | Example |
---|---|---|
Minimum Properties | Specify the minimum number of properties that must be present in the object value instance. | 5 |
Maximum Properties | Specify the maximum number of properties that must be present in the object value instance. | 10 |