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

[Java] better enum naming for symbol #3519

Merged
merged 1 commit into from
Aug 4, 2016

Conversation

wing328
Copy link
Contributor

@wing328 wing328 commented Aug 4, 2016

For #2487

@sebciok
Copy link

sebciok commented Aug 5, 2016

Looking at the changelist there may be a copy/paste error:

   specialCharReplacements.put(">=", "Greater_Than_Or_Equal_To");
   specialCharReplacements.put("!=", "Greater_Than_Or_Equal_To");

Also, would it be possible to do it for . (dot/period) as well?

That's the case I ran into (we have an enumeration with both . (dot) and _ (underscore) and they are both being translated to _ (Java codegen). It would be really nice if underscore on its own would be translated to UNDERSCORE.

Is there any guess when the new version with this fix would come out?

@wing328
Copy link
Contributor Author

wing328 commented Aug 5, 2016

@sebciok fixed via #3531

@wing328 wing328 deleted the enum_name_mapping branch August 5, 2016 04:03
@sebciok
Copy link

sebciok commented Aug 5, 2016

@wing328 Fantastic, Thank you.

@wing328
Copy link
Contributor Author

wing328 commented Aug 5, 2016

@sebciok thanks again for reporting the issue. Please pull the latest to help confirm it addresses the issue for you as there're quite a few enum-related enhancements and bug fixes. Although we've test cases but still we our users to do a test if possible.

@sebciok
Copy link

sebciok commented Aug 6, 2016

I got latest, built codegen and was able to successfully generate my enumeration. Thank you, works great.

I ran into an unrelated issue where generated code could not resolve JsonCreator annotation, but it could be something on my side.

If we want to handle more special characters (I do not need them, but just for completeness), I found that those ones are still missing:

QUESTION_MARK ?
COMMA ,
QUOTE '
DOUBLE_QUOTE "
SLASH /
BACKSLASH
LEFT_PAREN (
RIGHT_PAREN )
LEFT_BRACE {
RIGHT_BRACE }
LEFT_BRACKET [
RIGHT_BRACKET ]
TILDE ~
BACKTICK `

@wing328
Copy link
Contributor Author

wing328 commented Aug 6, 2016

I ran into an unrelated issue where generated code could not resolve JsonCreator annotation, but it could be something on my side.

Which HTTP library did you use? The default one is okhttp-gson, which does not use JsonCreator annotation.

For the remaining special characters, we'll add those later.

@sebciok
Copy link

sebciok commented Aug 7, 2016

I just used a default generated maven project without any changes, so it looks like I was using com.squareup.okhttp. I will try generation, on another, larger swagger definition.

@wing328
Copy link
Contributor Author

wing328 commented Aug 7, 2016

Thanks for the info.

FYI. Other symbols mapped via #3546

@wing328
Copy link
Contributor Author

wing328 commented Aug 7, 2016

@sebciok thanks for the info. I'm able to repeat the issue and filed a fix: #3551

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants