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
CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES doesn't work in special case #1026
Comments
To me this sounds like a bug, so a Pull Request for fix (and test that shows the initial problem) would be welcome. |
Unfortunately I can not reproduce this problem either with 2.6 branch (pre-2.6.4) or master (2.7.0-rc1), with property id of "uId" -- I get "u_id" as expected. So I think I would need a stand-alone unit test. One thing to note is that Dropwizard has its own "snake case" annotation, I think, which uses different naming strategy implementation. Perhaps that could be causing the problem? |
That is interesting! I'm not able to repro it in a standalone fashion. Looks like Dropwizard might be messing things up somewhere. I'll do some more investigation. Edit: see below |
Here's a gist repro of the problem. It doesn't have anything to do with Dropwizard. Looks like this doesn't have anything to do with Dropwizard. Actually, turns out it doesn't have to do with the variable name, but the getter function. In the gist, Is this expected behavior? What should I name the getter to get the |
If I name the getter:
Then I get |
So history is that I was using Project Lombok to generate my getters and setters and it looks like it uses a different naming convention for getters. See small print section in this doc. I've filed an issue with Lombok in case someone runs into this in the future. Looks like this isn't a Jackson bug after all :) Sorry for the trouble - please feel free to close the issue. |
@snarayanank2 No problem. One related thing, for future reference, is that Jackson also has a minor deviation from standard Bean naming (it is lower-casing multiple leading upper-case letters, instead of leaving them as-is -- affects things like "getURL"). |
I have a class with a property that looks like this:
When I use the
CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES
naming strategy, this results in JSON withuid
. However, if I change the variable name tousId
, it results inus_id
.In general, it appears that if the first character is lower case and second is upper case, the naming strategy appears to not work as I'd expect. Any way around this?
I'm using
jackson-databind-2.6.1
with DropWizard.The text was updated successfully, but these errors were encountered: