Skip to main content

valid-enum-field-name-conventions

Overview

This rule belongs to the apimatic-post-processing-codegen-validation ruleset and states that:

Names assigned to fields of an enumeration model must not contain special characters. In case they do, the special characters will be removed to prevent issues.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageEnumeration field contains special characters and has been renamed.
CodeAPIMATICPOSTPROCESSCODEGEN_V101
TypeValidation
Rule SystemSemantic
Broad CategoryGlobal Types/Models
Products ImpactedCode Generation, Developer Experience Portal
Tagsapimatic postprocessing code generation validation name enumeration type model custom type complex model

Suggested Fixes

  • Enumeration field 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 enumeration field 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 enumeration field name to avoid this issue.

For More Information