schema-format-unknown

schema-format-unknown

This rule reports a format which is neither in the OpenAPI format registry nor declared in openapi.custom_formats of the configuration file.

Rule Details

Validators, mock servers and code generators ignore formats they don’t know, so a misspelled format (date_time, uuid4) silently stops being checked. The schema-format-unknown rule finds them. Formats your API defines on purpose are declared in the configuration file:

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

The rule is off in the recommended ruleset, since OpenAPI allows any format, and a warning in strict and all. See Formats for the registry’s formats.

Configuration

None.

Examples

Good.

components:
  schemas:
    Id:
      type: string
      format: uuid

Bad.

components:
  schemas:
    Id:
      type: string
      format: uuid4

When Not to Use It

When the document uses many formats of its own and listing them in the configuration file isn’t worth it.

Compatibility

This rule is compatible with all OpenAPI 3.x versions.