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

Preserve path when string is camelized #1987

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@sineed

sineed commented Nov 22, 2016

Purpose

In my project I have some cases when I need to make a POST request with nested data. The following data may be provided:

{
  "data": {
    "type": "offers",
    "attributes": {
      "bid": { "amount": 1.12, "currency": "USD" }
    }
  }
}

Bid attribute may have validation errors so the response should provide this information:

{
  "errors": [
    { "source": { "pointer": "/data/attributes/bid/amount" }, "detail": "too_low" }
  ]
}

But when I use camel key transformation I receive /data/attributes/bid::Amount instead of /data/attributes/bid/amount

This PR fixes this behavior for camel and camel_lower key transformations

Changes

In camel and camel_lower key transformations

Caveats

I saw work at #1928 and introduction of case_transform. I can make PR to this gem also.

Related GitHub issues

#1928

Additional helpful information

@mention-bot

This comment has been minimized.

Show comment
Hide comment
@mention-bot

mention-bot Nov 22, 2016

@sineed, thanks for your PR! By analyzing the history of the files in this pull request, we identified @remear, @dubadub and @iancanderson to be potential reviewers.

mention-bot commented Nov 22, 2016

@sineed, thanks for your PR! By analyzing the history of the files in this pull request, we identified @remear, @dubadub and @iancanderson to be potential reviewers.

@bf4

This comment has been minimized.

Show comment
Hide comment
@bf4

bf4 May 1, 2017

Member

So the value is being transformed? that doesn't seem right

Member

bf4 commented May 1, 2017

So the value is being transformed? that doesn't seem right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment