schema-datetime-suffix

schema-datetime-suffix

This rule ensures that names of schema properties that represent date-times end with specified suffix.

Rule Details

This naming convention enhances the readability and understanding of the API’s structure.

The schema-datetime-suffix rule ensures that names of properties representing date-times end with specified suffix. The default suffix is _at, but you can change it in the configuration.

Configuration

The configuration value is a single string representing the expected suffix. It cannot be empty.

Configuration Example

lint:
  rules:
    schema-datetime-suffix:
      - warning
      - _tm

Examples

Good.

components:
  schemas:
    User:
      type: object
      properties:
        createdAt:
          type: string
          format: date-time

Bad.

components:
  schemas:
    User:
      type: object
      properties:
        creationDate:
          type: string
          format: date-time

When Not to Use It

If your API does not follow a specific naming convention for date-time properties in its schema objects, you may not need to use this rule.

Compatibility

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

← Back to Index