We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have given the following enum mapping in json schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "additionalProperties": false, "properties": { "Person": { "$ref": "#/definitions/Person" } }, "type": "object", "definitions": { "Person": { "properties": { "name": {"type": "string"}, "age": {"type": "number", "minimum": 18, "maximum": 64}, "gender": {"$ref": "#/definitions/GenderType"} }, "required": ["name", "age", "gender"], "type": "object" }, "GenderType": { "enum": [ "Male", "Female", "FeMale", "She_Male", "HE_MALE", "HUMAN" ], "javaEnums": [ {"name": "Male"}, {"name": "Female"}, {"name": "FeMale"}, {"name": "She_Male"}, {"name": "HE_MALE"}, {"name": "HUMAN"} ], "javaType": "com.example.GenderType" } } }
and the produced class has the enum structure as the following:
@Generated("jsonschema2pojo") public enum GenderType { Male("Male"), Female("Female"), FeMale_("FeMale"), She_Male("She_Male"), HE_MALE("HE_MALE"), HUMAN("HUMAN");
I expected the FeMale to match exactly but it got generated as FeMale_
Kindly request you to fix this to obey the name given in the javaEnums for the generated classes.
The text was updated successfully, but these errors were encountered:
Yes, I don't know why this is using .equalsIgnoreCase instead of equals:
.equalsIgnoreCase
jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/EnumRule.java
Line 473 in 8888844
since Java enums do allow constants to use the same name as long as the case is different. I suspect this was simply not understood at the time.
Sorry, something went wrong.
Fixed by #1329
No branches or pull requests
I have given the following enum mapping in json schema
and the produced class has the enum structure as the following:
I expected the FeMale to match exactly but it got generated as FeMale_
Kindly request you to fix this to obey the name given in the javaEnums for the generated classes.
The text was updated successfully, but these errors were encountered: