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

Detect when camel case properties are used for a class that's configured to use snake case #1

Merged

Conversation

gary-nosto
Copy link
Contributor

Description

If a class is configured with @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) but one of its @JsonProperty annotations uses camel case, the property is serialized using the camel case strategy i.e. the @JsonProperty annotation overrides the configured naming strategy. This behaviour leads to unexpected results because you would assume that Jackson would always use the configured naming strategy.

This PR updates com.nosto.beanie.AbstractJacksonBeanTest#namingStrategy to detect when a @JsonProperty does not use the class's configured naming strategy.

Related Issue

Motivation and Context

How Has This Been Tested?

Documentation:

Checklist:

  • I have updated the documentation accordingly.
  • I have assigned the correct milestone or created one if non-existent.
  • I have correctly labeled this pull request.
  • I have linked the corresponding issue in this description.
  • I have requested a review from at least 2 reviewers
  • I have checked the base branch of this pull request
  • I have checked my code for any possible security vulnerabilities

@gary-nosto gary-nosto merged commit 80bb7d3 into master Oct 28, 2021
@gary-nosto gary-nosto deleted the improvement/detectCamelCasePropertiesWhenSnakeCaseConfigured branch October 28, 2021 15:22
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