Enum descriptions, names, casing, and availability
OpenAPI doesn’t natively support adding descriptions to enum values. To do this in Fern you can use the x-fern-enum
extension.
Descriptions and availability
Use description to add documentation to individual enum values and deprecated to mark values as deprecated without deprecating the entire enum. These propagate into the generated SDKs and docs website.
Custom names
Use the name field to customize the name of an enum value in generated code.
This is particularly useful when enum values rely on symbolic characters that would otherwise cause generated code not to compile.
For example, the following OpenAPI:
would generate:
Custom casing
Use the casing field to specify exact casing for each target language’s naming convention. This gives more granular control than name alone, which sets a single default name for generated code.
The casing field supports four optional sub-fields:
snake— override for snake_case (used in languages like Python)camel— override for camelCase (used in languages like TypeScript/Java)screamingSnake— override for SCREAMING_SNAKE_CASE (used in languages like Go)pascal— override for PascalCase (used in languages like C#)
You can use casing alongside name. The name field sets the default generated name, while casing provides per-language overrides. If both are specified, the casing values take precedence for their respective language targets.