Motivation
When translating from OpenAPI to Smithy, schemas that define enums with an integer type (e.g. type: integer + enum: [...]) are currently mapped to plain enum in Smithy which is incorrect.
Expected behavior
Given an OpenAPI schema like:
Status:
type: integer
enum: [0, 1, 2]
x-enum-varnames:
- PENDING
- ACTIVE
- ARCHIVED
The generated Smithy model should be:
intEnum Status {
PENDING = 0
ACTIVE = 1
ARCHIVED = 2
}
Current behavior
The same schema is currently translated into:
enum Status {
PENDING
ACTIVE
ARCHIVED
}
Why x-enum-varnames?
OpenAPI itself does not support named integer enums directly.
The common convention (used by OpenAPI Generator, Swagger Codegen, etc.) is to combine:
type: integer
enum: [...]
x-enum-varnames: [...] (vendor extension to preserve symbolic names)
This provides both wire values (integers) and stable names for code generation.
Motivation
When translating from OpenAPI to Smithy, schemas that define enums with an integer type (e.g. type: integer + enum: [...]) are currently mapped to plain enum in Smithy which is incorrect.
Expected behavior
Given an OpenAPI schema like:
The generated Smithy model should be:
Current behavior
The same schema is currently translated into:
Why
x-enum-varnames?OpenAPI itself does not support named integer enums directly.
The common convention (used by OpenAPI Generator, Swagger Codegen, etc.) is to combine:
This provides both wire values (integers) and stable names for code generation.