Skip to main content

valid-schema-enum-element-name

Overview

This rule belongs to the openapi-v3-codegen-syntax-linting ruleset and states that:

For successful Code Generation, the enum item name must only use letters, numbers, underscores and dashes. It must not contain any leading/trailing white-space characters.

PropertyValue
EnabledYes
Maximum SeverityError
MessageName of enumeration item defined in x-enum-elements extention contains special characters which are not allowed.
CodeOPENAPI3CODEGENSYNTAX_L612
TypeLinting
Rule SystemSyntax
Broad CategoryOpenAPI Schemas
Products ImpactedCode Generation, Developer Experience Portal
Tagscode generation sdks openapi3 openapi syntax linting apimatic schema enum name x-enum-element

Suggested Fixes

  • Schema enum element names are used in creating language specific models in the CodeGen engine and usage of special characters can cause issues in this code generation process.
  • Treat enum element names different from the default values. Use only default values for placing the actual enumeration value and use the name property to provide a user-friendly and code-friendly name for the enumeration field.
  • Remove all special characters from the enum element name to avoid this issue.

For More Information