Closed marialenak closed 1 year ago
Value is used to map between Java and JSON.
Why do you want to remove it? If value has been removed, how do you imagining mapping between Java and JSON?
@marialenak In this case, I assume you would prefer this:
public enum ExampleStatus {
AStatus, BStatus, CStatus;
}
Is that right?
This is possible, but it doesn't follow the long-standing conventions for Java enum naming. With jsonschema2pojo, we cannot attempt to support every possible preferred way of writing Java source code. Our intention is to create a correct approach that maps between JSON and Java and follows Java conventions. It is not the intention of this library to allow endless configurability to get the exact Java source code that you prefer, as that is too big a task and would create a system that is far harder to extend and maintain. See JAXB for a similar approach - the goal is to provide a correct implementation, not to allow generation of whatever source code style you prefer.
So I'm going to close this one, but thanks for the suggestion and feel free to raise another.
@joelittlejohn thank you for your work I have the same problem and you say
This is possible
I don't find where I can do it. Can you explain which part of the code needs to be changed (e.g. create a custom EnumRule and override some method, etc ...)
@adrien1212 you could create a custom EnumRule
and override methods that generate code you don't need, eg:
addConstructorAndFields
addFactoryMethod
addFieldAccessors
addToString
addEnumConstants
When generating an enum through jsonschema2pojo sometimes it's more useful (for serialization and deserialization purposes) to NOT have values. Now the enums are generated like that:
Ideally, there should be a field to indicate whether we need values to be generated or not. Generated example following: