jsonschema.formats

Implementations of the JSON Schema 2020-12 defined formats, used when format assertion is enabled (FormatMode.assertion or a dialect declaring the format-assertion vocabulary). Formats apply only to strings; unknown format names always pass (they are annotations for some other consumer).

Not implemented (always pass, documented in the README): idn-email, idn-hostname, iri, iri-reference.

Members

Functions

checkFormat
bool checkFormat(string format, string value)

Check value against the named format. Returns true for unknown formats.

isDate
bool isDate(string s)

RFC 3339 full-date with real calendar checking.

isDateTime
bool isDateTime(string s)

RFC 3339 date-time ("date" "T" "time").

isDuration
bool isDuration(string s)

ISO 8601 duration as defined by RFC 3339 appendix A.

isEmail
bool isEmail(string s)

RFC 5321 mailbox, without the obsolete forms: dot-string or quoted-string local part, hostname or address-literal domain.

isHostname
bool isHostname(string s)

RFC 1123 hostname (255 octets total, labels of 1-63 alnum/hyphen).

isIpv4
bool isIpv4(string s)

Dotted-quad IPv4 (no leading zeros, each octet 0-255).

isIpv6
bool isIpv6(string s)

RFC 4291 IPv6 text form, including :: compression and an embedded IPv4 tail.

isJsonPointer
bool isJsonPointer(string s)

RFC 6901 JSON Pointer.

isRegex
bool isRegex(string s)

A string that is a valid ECMA-262 regular expression: it must compile, and every backslash escape of an ASCII letter must be one ECMA defines (\a, for example, is not a control escape and not a permitted identity escape).

isRelativeJsonPointer
bool isRelativeJsonPointer(string s)

Relative JSON Pointer (draft-handrews-relative-json-pointer).

isTime
bool isTime(string s)

RFC 3339 full-time. A leap second (ss == 60) is accepted only when the time corresponds to 23:59:60 UTC after offset adjustment.

isUri
bool isUri(string s, bool allowRelative)

RFC 3986 URI (absolute, scheme required) or URI reference.

isUriTemplate
bool isUriTemplate(string s)

RFC 6570 URI Template (syntax check of literals and expressions).

isUuid
bool isUuid(string s)

RFC 4122 UUID (8-4-4-4-12 hex digits).