"format" suggestions - sgpinkus/json-schema GitHub Wiki

THIS WIKI IS OBSOLETE. PLEASE SEE THE NEW JSON-SCHEMA-ORG/JSON-SCHEMA-SPEC REPOSITORY.



This is a list of suggested values for "format", what they would roughly do, and any standards that would be appropriate to reference.

These values may or may not make it into the specification - in fact, they may end up forming an out-of-spec registry of values.

uuid - universally unique identifier

Suggested here.

Referenced spec: RFC 4122, section 3, ABNF rule UUID

date

It was in draft v3, and it's useful.

See http://tools.ietf.org/html/rfc3339#section-5.6, ABNF rule full-date

time

It was in draft v3, and it's useful.

Extend it to allow fractional seconds, see http://tools.ietf.org/html/rfc3339#section-5.6, ABNF rule partial-time

utc-millisec

It was in draft v3, and it's useful.

regex

It was in draft v3, and it's useful.

csv

It is very commonly used and is well known

It was in draft v3, and it's useful.

int64, int32, int16, int8

The first three are defined by Swagger, more readable than specifying e.g. "minimum":-9223372036854775808, "maximum":9223372036854775807.

byte

Defined by Swagger, string with base64-encoded content.

double

Defined by Swagger: IEEE 754 binary64 floating-point number

single

IEEE 754 binary32 floating-point number

Swagger uses float

base64url

Base64url-endoced value, see http://tools.ietf.org/html/rfc4648#section-5

-> Whoever wrote this – note: Does this makes sense? Isn't base64url doing what media is defined for ?

duration

Same format as XML Schema's dayTimeDuration