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

Add PropertyNamingStrategy.LOWER_DOT_CASE for dot-delimited names #2241

Closed
wants to merge 1 commit into from
Closed

Conversation

zenglian
Copy link

@zenglian zenglian commented Feb 1, 2019

Add JsonPropertyNamingStrategy.LOWER_CASE_WITH_DOTS for dot-delimited names, which is widely used as configuration properties name, by many applications/products like hadoop, spark, etc.

@zenglian
Copy link
Author

zenglian commented Feb 1, 2019

An example:

{
  "monitor.interval": 120,
  "monitor.max.retries": 100,
  "monitor.emails": "",
  "server.address": "0.0.0.0",
  "server.port": 8091,
  "server.max.connections": 10,
  "jdbc.driver": "org.h2.Driver",
  "jdbc.url": "jdbc:h2:tcp://slc09woc:19092/h2-db",
  "jdbc.auth": {
    "user": "user",
    "password": "password"
  }
}

See Add FieldNamingPolicy.LOWER_CASE_WITH_DOTS in gson

@cowtowncoder
Copy link
Member

Sounds reasonable. This should probably go in 2.10: would it be possible to make PR against that branch?

Other than that, one thing we need (unless done already), is CLA for the first contribution.
Document can be found here:

https://github.com/FasterXML/jackson/blob/master/contributor-agreement.pdf

and usually you can print it, fill & sign, scan, email to info at fasterxml dot com.
When we have that, I can merge this against 2.10 (and I can do any minor cleanup), and it'll be added.

Thank you for contribution!

@zenglian
Copy link
Author

zenglian commented Feb 2, 2019

I signed it with touch-screen and mailed it.

Some other issues:

  • The source code does not have a consistent formatting style. The most significant is that the { is on or not on the new line.
  • SnakeCaseStrategy can reuse the same translate function of KebabCaseStrategy.

@cowtowncoder
Copy link
Member

I'll manually merge this; will change name (initially to LOWER_DOT_CASE -- unless I can find something widely used similar to "kebab case" and "camel case" :) ).

Thank you for providing this, esp. tests! I hope to get merge completed today.

@cowtowncoder cowtowncoder changed the title Add JsonPropertyNamingStrategy.LOWER_CASE_WITH_DOTS for dot-delimited names Add JsonPropertyNamingStrategy.LOWER_DOT_CASE for dot-delimited names Feb 4, 2019
@cowtowncoder cowtowncoder added this to the 2.10.0 milestone Feb 4, 2019
cowtowncoder added a commit that referenced this pull request Feb 4, 2019
@cowtowncoder
Copy link
Member

Merged manually: will be in 2.10.0.

Thank you @zenglian for contributing this!

@zenglian
Copy link
Author

zenglian commented Feb 8, 2019

Thanks.
I think the name is good as it's straight forward, e.g., I did not know what is "kebab case" but I did know what is "hyphen".

@cowtowncoder
Copy link
Member

Matter of taste, I suppose, but I do like bit more lively names like "snake case", "camel case" and, at that point, "kebab case". There are obviously many other alternatives wrt hyphenated etc.
But since no one proposed any witty alternative, "(lower) dot case" it is!

@cowtowncoder cowtowncoder changed the title Add JsonPropertyNamingStrategy.LOWER_DOT_CASE for dot-delimited names Add PropertyNamingStrategy.LOWER_DOT_CASE for dot-delimited names Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants