This rule ensures that all string values defined in enum
or const
properties of schema objects adhere to a predefined naming convention.
Adhering to a consistent naming convention enhances the readability and maintainability of the API’s structure.
The schema-enum-naming
rule is designed to ensure that all string values
defined in enum
or const
properties of schema objects adhere to a
predefined naming convention. Currently supported naming conventions are
const
, camel
, kebab
, pascal
, header
, and snake
.
The configuration block is a naming conventing name. Its default value is
const
.
lint:
rules:
paths-max-count:
- warning
- kebab
Good.
components:
schemas:
UserStatus:
type: string
enum:
- ACTIVE
- INACTIVE
- BLOCKED
Bad. To use UsesStatus
properly, a user must always consult the
documentation.
components:
schemas:
UserStatus:
type: string
enum:
- activeStatus
- inactive_status
- BLOCKED_STATUS
- blocked_status
If your API does not follow a specific naming convention for enum
or const
values in its schema objects, you may not need to use this rule.
This rule is compatible with all OpenAPI 3.x versions.