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
fix(Transfomers): call .toJSON
in toSnakeCase
#8790
Conversation
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
Codecov Report
@@ Coverage Diff @@
## main #8790 +/- ##
==========================================
+ Coverage 85.22% 85.61% +0.38%
==========================================
Files 77 96 +19
Lines 6715 9459 +2744
Branches 877 1134 +257
==========================================
+ Hits 5723 8098 +2375
- Misses 953 1319 +366
- Partials 39 42 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
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.
This makes the bold assumption that any JSON encodable will always yield snake_case properties, but that's (hopefully) almost always the case here, and for the places we use toSnakeCase
for, it would be wrong to use JSON encodable classes that don't yield snake_case properties.
Either way, this seems to be triggered when using builders inside plain objects, which makes sense.
Would it be better if I called |
I would personally prefer this. Splitting functions by specific behaviors yields more flexible predictable code. |
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Please describe the changes this PR makes and why it should be merged:
Makes
toSnakeCase
call.toJSON
functions if they exist.Fixes #8742
Status and versioning classification:
I could make calling
.toJSON
togglable via a boolean parameter if that is preferred to avoid breaking changes.