Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,21 @@ protected String formatIdentifier(String name, boolean capitalized) {

return escapeReservedWord(identifier);
}
protected String formatEnumIdentifier(String name) {
if (specialCharReplacements.containsKey(name)) {
name = specialCharReplacements.get(name);
}

String sanitized = sanitizeName(name);

// Preserve SCREAMING_SNAKE_CASE enum values
if (sanitized.matches("^[A-Z][A-Z0-9_]*$")
&& !isReservedWord(sanitized)) {
return sanitized;
}

return formatIdentifier(sanitized, true);
}

protected String stripPackageName(String input) {
if (!stripPackageName || StringUtils.isEmpty(input) || input.lastIndexOf(".") < 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ public String toDefaultValue(Schema p) {
private class EnumEntryLambda extends CustomLambda {
@Override
public String formatFragment(String fragment) {
return formatIdentifier(fragment, true);
return formatEnumIdentifier(fragment);
}
}

Expand Down