First of all, I know this is unnecessary and possibly even wrong, so please refrain from giving that answer. I am interested on knowing if it's possible, which I suspect it is not, but I would like to confirm it and maybe learn something in the process.
I want to define string enums in a swagger client that's autogenerated from an API with swagger anotations on Java.
I see that enums in the -yaml are defined in this fashion:
components:
schemas:
Color:
type: string
enum:
- black
- white
- red
- green
- blue
But I would need something like:
components:
schemas:
Color:
type: string
enum:
- Name: color_black Value: black
- Name: color_white Value: white
- Name: color_red Value: red
In short, a way so that the String enums generated in the clients code, have a different name than their string value. If it is possible, any help on how to set it up with Java anotations will also be welcome.
Unnecessary context for whoever is curious: We have some very ugly codes to define operations we need to be sent to the server. The client is generated with those ugly codes in the enums. I've been ordered to change those names. There might be very valid criticism to this, and I've been the first one to point those out, but still this is what I've been told to do. That's why I wouldn't like for this to become a discussion about why I should or shouldn't do this.
There also might be some other way to solve this problem I am not aware of.