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 allow_snake_case filter and legacy override to serialize with snake_case #1031

Merged
merged 7 commits into from
Mar 17, 2023

Conversation

jasmith-hs
Copy link
Contributor

Adds a filter that allows a map using camelCase attributes to be accessible using snake_case. In jinjava, we allow bean properties to be accessed using snake_case, despite the java methods using camelCase to define them. If we serialize using a default BeanSerializer, then the keys will be in camelCase and running a second pass due to using eager execution will not work as we'd be trying to access a map with camelCase keys using snake_case properties.

I also added a simple legacy override useSnakeCasePropertyNaming which makes jackson serialize with snake_case properties by default. But we can't use that at HubSpot as we need to support legacy behaviour.

@jasmith-hs jasmith-hs merged commit 5124456 into master Mar 17, 2023
@jasmith-hs jasmith-hs deleted the allow-snake-case branch March 17, 2023 23:43
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