Oaskit.JsonSchema.Formats (oaskit v0.9.0)
View SourceImplements 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. While this library does not provide header validation yet, they are supported for OpenAPI specification compliance.
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.