avro icon indicating copy to clipboard operation
avro copied to clipboard

AVRO-2385: generate camelCase method names for UPPER_SNAKE fields

Open ecopoesis opened this issue 5 years ago • 6 comments

Changes the implementation of Avro record name to Java method name converter. Though this breaks no existing tests, it is a breaking change for records named in UPPER_SNAKE style.

Make sure you have checked all steps below.

Jira

  • [x] My PR addresses the following Avro Jira issues and references them in the PR title. For example, "AVRO-1234: My Avro PR"
    • https://issues.apache.org/jira/browse/AVRO-2385
    • In case you are adding a dependency, check if the license complies with the ASF 3rd Party License Policy.

Tests

  • [x] My PR adds the following unit tests OR does not need testing for this extremely good reason:

Adds:

  • org.apache.avro.compiler.specific.TestSpecificCompiler#testCamelize

Modifies:

  • org.apache.avro.compiler.specific.TestSpecificCompiler#generateGetMethod
  • org.apache.avro.compiler.specific.TestSpecificCompiler#generateSetMethod

Commits

  • [x] My commits all reference Jira issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • [x] In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain Javadoc that explain what it does

ecopoesis avatar Dec 05 '19 15:12 ecopoesis

If you use mvn spotless: apply, it can solve the problem of the code format built by CI

zeshuai007 avatar Dec 06 '19 03:12 zeshuai007

Not all the branches of camelize use StringBuilders, so always returning a StringBuilder would sometimes require creating an additional object. Additionally we need to have a string at the end when we decide on the leading capital.

camelize could be embedded generateMethodName like before, but I think it's a useful utility to have. The same casing problems exist for generated field and class names so we may want to use it there too.

ecopoesis avatar Dec 06 '19 22:12 ecopoesis

Hi @ecopoesis - is there a reason this PR is still open? Would love to use this feature.

adelamodwala avatar Mar 29 '21 17:03 adelamodwala

Hi @ecopoesis - is there a reason this PR is still open? Would love to use this feature.

I am not a committer for Avro so I can’t merge this branch.

ecopoesis avatar Mar 29 '21 17:03 ecopoesis

@zeshuai007 Looks like you're one of the contributors. Would it be possible to have this PR merged?

adelamodwala avatar Mar 29 '21 17:03 adelamodwala

Trying to get the attention back for this to be merged if the contribution looks good.

adityagoel avatar Jun 27 '22 23:06 adityagoel