This rule ensures that names of schema properties that represent date-times end with specified suffix.
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.
The configuration value is a single string representing the expected suffix. It cannot be empty.
Configuration Example
lint:
rules:
schema-datetime-suffix:
- warning
- _tm
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
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.
This rule is compatible with all OpenAPI 3.x versions.