OpenAPITools / OpenAPITools/openapi-generator
[BUG] [Dart-dio] Enums with numbers get parsed incorrectly
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
When I declare enums with underscore and number their name comes out incorrectly.
ExampleEnum:
title: "exampleEnum"
description: "Example enum"
type: "string"
enum:
- "EXAMPLE_ENUM_1"
- "EXAMPLE_ENUM_2"
- "EXAMPLE_ENUM_NO_NUMBER"
Output:
/// Example enum
@BuiltValueEnumConst(wireName: EXAMPLE_ENUM_1')
static const ExampleEnum eXAMPLEENUM1 = _$eXAMPLEENUM1;
/// Example enum
@BuiltValueEnumConst(wireName: EXAMPLE_ENUM_2')
static const ExampleEnum eXAMPLEENUM1 = _$eXAMPLEENUM2;
/// Example enum
@BuiltValueEnumConst(wireName: EXAMPLE_ENUM_NO_NUMBER')
static const ExampleEnum EXAMPLE_ENUM_NO_NUMBER = _$EXAMPLE_ENUM_NO_NUMBER;
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided enum schema through the Dart-dio generator and inspect the generated enum declarations. Compare the identifiers and BuiltValue wire names for values containing underscores and numbers; done means each enum constant has a valid, distinct Dart identifier while preserving its original wire name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100