avro
avro copied to clipboard
AVRO-2385: generate camelCase method names for UPPER_SNAKE fields
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":
- Subject is separated from body by a blank line
- Subject is limited to 50 characters (not including Jira issue reference)
- Subject does not end with a period
- Subject uses the imperative mood ("add", not "adding")
- Body wraps at 72 characters
- 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
If you use mvn spotless: apply, it can solve the problem of the code format built by CI
Not all the branches of camelize
use StringBuilder
s, 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.
Hi @ecopoesis - is there a reason this PR is still open? Would love to use this feature.
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.
@zeshuai007 Looks like you're one of the contributors. Would it be possible to have this PR merged?
Trying to get the attention back for this to be merged if the contribution looks good.