This rule ensures that every schema object that is a string or a number has its format defined.
Defining the format of a string or numeric schema objects enhances the readability and understanding of the API’s structure.
The schema-format-defined rule is designed to ensure that all schema objects
those type is string, number or integer have also format property
defined.
None.
Good. Now it is obvious that birthDate is a ISO8601 date string.
components:
schemas:
User:
type: object
properties:
birthDate:
type: string
format: date
Bad. It is not immediately obvious how birthDate is formated. Is it
YYYY-MM-DD or DD-MM-YY, or perhaps YY/MM/DD ?
components:
schemas:
User:
type: object
properties:
birthDate:
type: string
We recommend to always enable this rule.
This rule is compatible with all OpenAPI 3.x versions.