# schema-format-unknown

Source: https://apigenie.pl/docs/linter/swagger/rules/schema-format-unknown

A rule of the Swagger 2.0 linter, which reads Swagger 2.0 documents; OpenAPI 3 documents go to the OpenAPI linter. Since 0.10.0. In the rulesets: Strict at warning, All at warning.

This rule reports a `format` of a Swagger 2.0 document which is neither in the
[OpenAPI format registry](https://spec.openapis.org/registry/format/) nor
declared in `openapi.custom_formats` of the
[configuration file](/docs/reference/cli/configuration#openapicustom_formats).

## Rule details

Tools ignore formats they do not know, so a misspelled format (`date_time`,
`uuid4`) stops being checked without a word. Formats defined on purpose are declared
in the configuration file:

```yaml
openapi:
  custom_formats:
    - {name: currency-code, type: string}
```

The rule is off in the `recommended` ruleset and a warning in `strict` and
`all`. See [Formats](/docs/reference/cli/formats) for the registry's
formats.

Turn the rule off when the documents use many formats of their own and listing them in the
configuration file is not worth it.

## Examples

**Good**. `uuid` is in the registry.

```yaml
swagger: '2.0'
info:
  title: Pets
  version: 1.0.0
paths: {}
definitions:
  PetId:
    type: string
    format: uuid
```

**Bad**. `uuid4` is not, so nothing checks the value.

```yaml
swagger: '2.0'
info:
  title: Pets
  version: 1.0.0
paths: {}
definitions:
  PetId:
    type: string
    format: uuid4
```
