This rule checks all schema objects and warns if any of them define properties whose names do not adhere to the specified naming convention.
Adhering to a consistent naming convention enhances the readability and maintainability of the API’s structure.
The schema-property-naming
rule is designed to ensure that all properties
defined in schema objects adhere to a specified naming convention. Currently
recognised naming conventions are const
, camel
, kebab
, pascal
,
header
, and snake
.
The configuration block is a naming conventing name. Its default value is
snake
.
lint:
rules:
paths-max-count:
- warning
- kebab
Good.
components:
schemas:
User:
type: object
properties:
firstName:
type: string
lastName:
type: string
Bad.
components:
schemas:
User:
type: object
properties:
first_name:
type: string
last_name:
type: string
If your API does not follow a specific naming convention for schema property names, you may not need to use this rule.
This rule is compatible with all OpenAPI 3.x versions.