Using data type attributes
The following tables describe the attributes that can be defined for different data types.
General attributes
These attributes are available for all data types.
| Field | Description | Corresponding OAS/Swagger and RAML element |
|---|---|---|
|
Name |
Name of the data type or property. |
Root element for the data type or property definition. |
|
Description |
Description of the property. |
description |
|
Required |
Boolean, defines whether a property is required or optional. |
|
|
Restrictions |
Defines whether the property is available in the request, response or both. |
|
|
Examples |
Sample values for the property. They can be returned when using an API mock. |
|
Object attributes
| Field | Description | Corresponding OAS/Swagger and RAML element |
|---|---|---|
|
Additional properties |
Boolean, defines whether the object accepts properties not included in the data type definition. This is enabled by default. |
additionalProperties |
Array attributes
| Field | Description | Corresponding OAS/Swagger and RAML element |
|---|---|---|
|
Min items and Max items |
Minimum and maximum number of items in an array. |
minItems and maxItems |
|
Unique items |
Boolean, defines whether each item in an array must be unique. |
|
String attributes
| Field | Description | Corresponding OAS/Swagger and RAML element |
|---|---|---|
|
Enum |
Possible values for the property. |
enum |
|
Min length and Max length |
Minimum and maximum number of bytes in the value. |
minLength and maxLength |
|
Pattern |
Regular expression that the value should match. |
pattern |
|
Default |
Value to use if a value is not provided. |
default |
Number and integer attributes
| Field | Description | Corresponding OAS/Swagger and RAML element |
|---|---|---|
|
Enum |
Possible values for the property. |
enum |
|
Format |
Format to use for a number or integer. |
format |
|
Minimum and Maximum |
Minimum and maximum value of a number or integer. |
minimum and maximum |
|
Default |
Value to use if a value is not provided. |
default |
Date and time attributes
| Field | Description | Corresponding OAS/Swagger and RAML element |
|---|---|---|
|
Enum |
Possible values for the property. |
enum |
|
Default |
Value to use if a value is not provided. |
default |
Datetime attributes
| Field | Description | Corresponding OAS/Swagger and RAML element |
|---|---|---|
|
Enum |
Possible values for the property. |
enum |
|
Format |
Format to use for a datetime. |
|
File attributes
| Field | Description | Corresponding OAS/Swagger and RAML element |
|---|---|---|
|
Min length and Max length |
Minimum and maximum number of bytes in the value. |
minLength and maxLength |
|
File types |
Type of file to use, in the format */*. For example: image/png |
|