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.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Name of enumeration item defined in x-enum-elements extention contains special characters which are not allowed. |
Code | OPENAPI3CODEGENSYNTAX_L612 |
Type | Linting |
Rule System | Syntax |
Broad Category | OpenAPI Schemas |
Products Impacted | Code Generation, Developer Experience Portal |
Tags | code 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
- https://docs.apimatic.io/specification-extensions/swagger-codegen-extensions/#enumeration-extensions
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md
- https://docs.apimatic.io/rulesets/overview/