Appendix A - Data Types¶
The following table contains several data types that are compatible with OpenAPI specifications. It is recommended to use the "format" property in OpenAPI to enable validation and interoperability between client and server. Preference is given to "formats" defined in OpenAPI (or JsonSchema).
Rationale: Date and time formats are based on RFC3339 which is subset of all ISO8601. RFC3339 has been adopted by OpenAPI and JsonSchema. Using RFC339 simplifies validation, interoperability and documentation. Another benefit of RFC3339 is its formal syntax description based on the Augmented Backus–Naur form. This is an important basis for formal syntax consistency checking and other automated analysis tasks that can help to analyze and validate this specification.
Please propose additional format recommendations to the Xcelerator API working group.
Type | OpenAPI type | OpenAPI format | Description | Example |
---|---|---|---|---|
Boolean | boolean | One of the two Boolean values (true or false). | true | |
Object | object | A complex type consisting of zero or more fields. An object must be serialized according to the media type definition. | {"foo":"bar"} | |
Array | array | An array containing values of the same type. | ["factory","building","large drive"] | |
Integer | integer | int32 | Signed 32-bit integers (commonly used integer type). | 4528742457 |
Long integer | integer | int64 | Signed 64-bit integers (long type). | 452874245788765 |
Float | number | float | Floating-point numbers. | 3.1415927 |
Double | number | double | Floating-point numbers with double precision. | 3.141592653589793 |
String | string | An arbitrary string of characters. | "APIs rock!" | |
Date & time | string | date-time | A timestamp following RFC 3339. | "2023-04-03T16:45:30.789Z" |
Date | string | date | A date following RFC 3339. | "2023-04-03" |
Time | string | time | Time value following RFC 3339. | "16:45:30.789Z" |
string | email | An email address following RFC 5322. | johndoe@siemens.com | |
URI | string | uri | A web URI following RFC 3986. | https://www.siemens.com |
UUID | string | uuid | A Universally Unique Identifier following RFC 4122. | "06cd70a1-cd79-4d70-b2b4-fd9dca449848" |
Regular expression | string | regex | A regular expression following ECMA 262. | "^[a-z]+$" |
IPV4 | string | A string representing an IPV4 IP address following RFC 2673 | "104.75.173.179" | |
IPV6 | string | A string representing an IPV6 IP address following RFC 4291 | "2600:1401:2::8a" | |
MAC | string | A string representing a MAC address. | "00:80:41:11:fd:7e" |