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] int values for enums #268

Closed
MichielDroid opened this issue Oct 21, 2021 · 3 comments · Fixed by #304
Closed

[BUG] int values for enums #268

MichielDroid opened this issue Oct 21, 2021 · 3 comments · Fixed by #304
Assignees
Labels
bug Something isn't working

Comments

@MichielDroid
Copy link

I'm working with an API that returns integer values for enums instead of their String names. So instead of:

enum UserRole {
  @JsonValue('swaggerGeneratedUnknown')
  swaggerGeneratedUnknown,
  @JsonValue('Guest')
  guest,
  @JsonValue('User')
  user,
  @JsonValue('Admin')
  admin
}

I would need this to be generated:

enum UserRole {
  @JsonValue(-1)
  swaggerGeneratedUnknown,
  @JsonValue(0)
  guest,
  @JsonValue(1)
  user,
  @JsonValue(2)
  admin
}

Is this possible with this package?

@MichielDroid MichielDroid added the question Further information is requested label Oct 21, 2021
@fryette
Copy link
Contributor

fryette commented Oct 21, 2021

Could you please share the swagger file as an example?

@Vovanella95
Copy link
Collaborator

Hi @MiieL

I will check if it's possible to generate it like this. Actually it's good idea to generate int enums

@Vovanella95
Copy link
Collaborator

Hi @MiieL

Please check latest version. Let us know in case of any issues

@fryette fryette changed the title [QUESTION] int values for enums [BUG] int values for enums Jan 12, 2022
@fryette fryette added bug Something isn't working and removed question Further information is requested labels Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants