-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When generating Protobuf schemas for composed schemas that contain nested structures with enum references, the codegen incorrectly treats enums in maps and arrays as primitive string types, resulting in StringMap and StringArray wrappers instead of the correct enum-typed wrappers.
spec:
components:
schemas:
Fruit:
type: string
enum:
- APPLE
- BANANA
- ORANGE
FruitByColor:
type: object
additionalProperties:
$ref: '#/components/schemas/Fruit'
FruitList:
type: array
items:
$ref: '#/components/schemas/Fruit'
FruitInventory:
oneOf:
- title: fruitList
$ref: '#/components/schemas/FruitList'
- title: fruitColor
$ref: '#/components/schemas/FruitByColor'
protobuf:
enum Fruit {
FRUIT_APPLE = 0;
FRUIT_BANANA = 1;
FRUIT_ORANGE = 2;
}
message FruitInventory {
oneof fruit_inventory {
StringArray fruit_list = 1;
StringMap fruit_color = 2;
}
}
- A map containing enum values → should generate named enum map type (e.g.,
FruitMap) - An array containing enum items → should generate named enum array type (e.g.,
FruitArray)