schema-format-type-mismatch

schema-format-type-mismatch

This rule checks all schema objects and warns if any of them have their type and format properties contradicting each other.

Rule Details

Contradicting type and format properties can lead to confusion and misinterpretation of the API’s structure.

The schema-format-type-mismatch rule is designed to ensure that all schema objects have their type and format properties in agreement. The rule issues a warning for the following combinations of format and type fields:

Configuration

None.

Examples

Good.

components:
  schemas:
    User:
      type: object
      properties:
        birthDate:
          type: string
          format: date

Bad.

components:
  schemas:
    User:
      type: object
      properties:
        birthDate:
          type: integer
          format: date

When Not to Use It

We recommend to always enable this rule.

Compatibility

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

← Back to Index