-
Notifications
You must be signed in to change notification settings - Fork 1.5k
JAVA-5736: Add bsonNamingStrategy option to support snake_case naming strategy #1589
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @leesungbin
Thank you for the PR! We really appreciate your contribution.
However, the current Regexp-based approach doesn’t fully account for all use cases. According to the Kotlin language specification, variable names can include Unicode characters, such as Cyrillic characters. For example, a variable name like имяПеременной would not be handled correctly.
Additionally, backtick names (e.g., `my Class`
) won’t be transformed as expected.
A possible refactor could leverage the existing implementation of SnakeCase in kotlinx.serialization. You can refer to this implementation:
SnakeCase in kotlinx.serialization.
Also, please ensure the tests align with the transformation rules and acronyms defined in:
JsonNamingStrategy Transformation Rules.
Looking forward to your updates! Let me know if you need any clarification.
Hello @nhachicha, thanks for providing such detailed comments. I have copied the Additionally, I introduced an error condition for scenarios where decoding snake_case to camelCase is ambiguous (for instance, Please give it a look. Thanks! |
Thanks for iterating on this @leesungbin can you please rebase against |
Sure, I've rebased on to |
Ticket
JAVA-5736
Description
This PR adds bsonNamingStrategy property to BsonConfiguration to support snake_case naming strategy.
Testing
ran ./gradlew check