Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Enum properties are always created in lowercase regardless of values in swagger #743

Open
AlexeyKatsuro opened this issue Mar 27, 2024 · 0 comments
Assignees
Labels
bug Something isn't working Triage needed

Comments

@AlexeyKatsuro
Copy link

I have similar issue with enum like #602

But I'm not able to change enum value to snake_case.

Is here a way to generate in the same case?

Library version used:
swagger_dart_code_generator: 2.15.0

Swagger specification link

      "AccessGroup": {
        "enum": [
          "NoOne",
          "ChannelAccess",
          "AreaAccess",
          "GroupAccess"
        ],
        "type": "string"
      },

It was generated as

enum AccessGroup {
  @JsonValue(null)
  swaggerGeneratedUnknown(null),

  @JsonValue('NoOne')
  noone('NoOne'),
  @JsonValue('ChannelAccess')
  channelaccess('ChannelAccess'),
  @JsonValue('AreaAccess')
  areaaccess('AreaAccess'),
  @JsonValue('GroupAccess')
  groupaccess('GroupAccess');

  final String? value;

  const AccessGroup(this.value);
}

Expected behavior

enum AccessGroup {
  @JsonValue(null)
  swaggerGeneratedUnknown(null),

  @JsonValue('NoOne')
  noOne('NoOne'),
  @JsonValue('ChannelAccess')
  channelAccess('ChannelAccess'),
  @JsonValue('AreaAccess')
  areaAccess('AreaAccess'),
  @JsonValue('GroupAccess')
  groupAccess('GroupAccess');

  final String? value;

  const AccessGroup(this.value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Triage needed
Projects
None yet
Development

No branches or pull requests

3 participants