# `Oaskit.JsonSchema.Formats`
[🔗](https://github.com/lud/oaskit/blob/v0.12.0/lib/oaskit/json_schema/formats.ex#L1)

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 `c: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.

 - `double`
 - `double-int`
 - `float`
 - `int16`
 - `int32`
 - `int8`
 - `uint16`
 - `uint32`
 - `uint8`

### Numeric formats

Those apply to numbers and strings, as their value is not representable in
every programming language.

`Decimal` values are supported.

 - `decimal`
 - `decimal128`
 - `int64`
 - `uint64`

### String formats

String formats only apply when the value is a string, much like the default
JSON schema formats like "date", "uri", _etc._.

 - `base64url`
 - `binary`
 - `byte`
 - `char`
 - `commonmark`
 - `html`
 - `media-range`
 - `password`

### 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-binary`
 - `sf-boolean`
 - `sf-decimal`
 - `sf-integer`
 - `sf-string`
 - `sf-token`

# `applies_to_type?`

# `supported_formats`

# `validate_cast`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
