Skip to content

Additional formats as discussed in #607 #811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions versions/3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,33 @@ An additional primitive data type `"file"` is used by the [Parameter Object](#pa
<a name="dataTypeFormat"></a>Primitives have an optional modifier property `format`.
OAS uses several known formats to more finely define the data type being used.
However, the `format` property is an open `string`-valued property, and can have any value to support documentation needs.
Formats such as `"email"`, `"uuid"`, etc., can be used even though they are not defined by this specification.
Formats such as `"email"`, `"T-shirt size"`, etc., can be used even though they are not defined by this specification.
Types that are not accompanied by a `format` property follow their definition from the JSON Schema (except for `file` type which is defined above).
The formats defined by the OAS are:


Common Name | [`type`](#dataTypeType) | [`format`](#dataTypeFormat) | Comments
----------- | ------ | -------- | --------
octet | `integer` | `uint8` | unsigned 8 bits
signed byte| `integer` | `int8` | signed 8 bits
short| `integer` | `int16` | signed 16 bits
integer | `integer` | `int32` | signed 32 bits
long | `integer` | `int64` | signed 64 bits
big integer | `integer` | | |
float | `number` | `float` | |
double | `number` | `double` | |
decimal | `number` | `decimal` | decimal floating-point number, recipient-side internal representation as a binary floating-point number may lead to rounding errors
big decimal | `number` | | |
string | `string` | | |
byte | `string` | `byte` | base64 encoded characters
encoded binary | `string` | `byte` | base64 encoded characters - [RFC4648](https://tools.ietf.org/html/rfc4648#section-4)
url-safe encoded binary | `string` | `base64url` | base64url encoded characters - [RFC4648](https://tools.ietf.org/html/rfc4648#section-5)
binary | `string` | `binary` | any sequence of octets
boolean | `boolean` | | |
date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14)
dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14)
time (of day) | `string` | `time` | As defined by `partial-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14)
duration| `string` | `duration` | As defined by `xs:dayTimeDuration` - [XML Schema 1.1](http://www.w3.org/TR/xmlschema11-2/#dayTimeDuration)
uuid| `string` | `uuid` | Universally Unique Identifier (UUID) - [RFC4122](https://www.ietf.org/rfc/rfc4122.txt)
password | `string` | `password` | Used to hint UIs the input needs to be obscured.

### Schema
Expand Down