Skip to content

Resolves #383: Added a search in FieldResolverScanner for getters where the field name needs to be converted from snake to camel case. #464

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

Conversation

plaurina
Copy link
Contributor

Added a search in FieldResolverScanner for getters where the field name needs to be converted from snake to camel case.

Resolves #383

Checklist

  • Pull requests follows the contribution guide
  • New or modified functionality is covered by tests

Description

The findResolverMethod function has a cascading if/else check to try to find a matching method in a variety of formats. I added a 5th check (similar to the 3rd check) but instead of only capitalizing the fieldname I converted the fieldname from snake case to camelCase. The existing code uses Apache Commons-lang3 already, so I stayed with it to do the snake to camel case conversion. Ideally I would have preferred to use CaseFormat from Guava or CaseUtils from Apache Commons Text, but I did not want to introduce a new dependency.

plaurina and others added 2 commits December 20, 2020 14:37
… getters where the field name needs to be converted from snake to camel case.
@plaurina
Copy link
Contributor Author

plaurina commented Jan 8, 2021

@oliemansm Would love to get a review for this and have it in the next build if possible. Feedback is welcome of course.

Copy link
Collaborator

@oryan-block oryan-block left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍
I replaced the apache utils calls with standard kotlin string manipulation.

@vojtapol vojtapol merged commit ebebf2c into graphql-java-kickstart:master Jan 8, 2021
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.

How to map a field from a Java class to a type property with a different name?
3 participants