-
Notifications
You must be signed in to change notification settings - Fork 78
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
Apply optional dash-to-underscore to include keys #102
Conversation
lib/jsonapi/utils/dash.ex
Outdated
@@ -0,0 +1,29 @@ | |||
defmodule JSONAPI.Utils.Dash do |
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.
Does this do more than the existing https://github.com/jeregrine/jsonapi/blob/d4371362ecaadaece27f4d640722f0beae90e6ad/lib/jsonapi/utils/underscore.ex#L1 ?
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.
It just converts from dash to underscore, where Underscore
coverts from underscore to dash. Wasn't sure if I should just add a dash
function to the Underscore
module or create a separate module. Let me know which approach you prefer and I'll update the PR if needed. :)
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.
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.
Lets merge this into one module, if you feel better renaming it thats fine just make sure the tests pass. But since they both use the same configuration and both have functionally the same responsibility I think having one will be better.
@jeregrine updated, thanks! |
@jeregrine Anything else needed for this one? |
Thank you for the work on this! Sorry for the delay ❤️ |
When specifying an include string in request which contains dashed entries (e.g.
article.guest-authors
) and library is configured to convert dashes to underscoreguest-authors
should be transformed toguest_authors
.Currently, without this an error is thrown caused by converting string to an unknown atom.