Implements formats described in https://spec.openapis.org/api/format.json for
JSV's format validation. Some of the described formats are already
implemented in JSV directly.
All schemas used by this library can use those formats in any schema, on top
of all formats already supported by JSV.
Use the Oaskit.jsv_opts/0 callback to add your own formats.
The html and commonmark formats are not validating anything and will
accept any string.
Number formats
Number formats apply to the number JSON type. So an int16 format will be
used on floats and reject them.
Decimal values are supported.
doubledouble-intfloatint16int32int8uint16uint32uint8
Numeric formats
Those apply to numbers and strings, as their value is not representable in every programming language.
Decimal values are supported.
decimaldecimal128int64uint64
String formats
String formats only apply when the value is a string, much like the default JSON schema formats like "date", "uri", etc..
base64urlbinarybytecharcommonmarkhtmlmedia-rangepassword
HTTP Structured fields formats
HTTP structured fields are generally used for headers. These formats validate
and cast a string into the corresponding structured field value, so they can
be used on header parameter schemas (in: :header).
These are the structured field bare items defined by the OpenAPI Format Registry. RFC 8941 lists and dictionaries are not part of the registry and are not supported, see the comment on the format definitions in this module.
sf-binarysf-booleansf-decimalsf-integersf-stringsf-token
Summary
Functions
Callback implementation for JSV.FormatValidator.applies_to_type?/2.
Callback implementation for JSV.FormatValidator.supported_formats/0.
Callback implementation for JSV.FormatValidator.validate_cast/2.
Functions
Callback implementation for JSV.FormatValidator.applies_to_type?/2.
Callback implementation for JSV.FormatValidator.supported_formats/0.
Callback implementation for JSV.FormatValidator.validate_cast/2.