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

GRAL-2093: make sure all response properties are camelCased #45

Merged
merged 6 commits into from
Aug 2, 2021

Conversation

ziimk
Copy link
Contributor

@ziimk ziimk commented Jul 1, 2021

Fixes #42

Every response now goes through CamelCaseHelper::keysToCamelCase() function because relying on only the model mapper caused inconsistencies (if the model contained a property that is defined just as an object, not a specific model - like this one - then the keys of this object were not camel-cased).

Also, if json_encode() is run over the response then everything is now consistently snake_cased (as in the raw response)

Testing:

  • install this branch: composer require pipedrive/pipedrive:dev-GRAL-2093-camel-case
  • check the README how to set up a simple sample script and try it out on controllers which use models which have plain objects defined as properties.

For example, $client->getDeals()->getDetailsOfADeal(123); now (left) vs before (right):
Markup 2021-07-01 at 12 20 26

@ziimk ziimk requested a review from a team as a code owner July 1, 2021 16:11
@ziimk ziimk force-pushed the GRAL-2093-camel-case branch 2 times, most recently from 0e988b3 to a0d98a6 Compare July 1, 2021 16:21
Comment on lines +9 to +11
if ($input instanceof \DateTime) {
return $input;
}
Copy link
Contributor Author

@ziimk ziimk Jul 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to remap DateTime objects - it caused the actual values to change as well

@SiimKirjanen SiimKirjanen self-assigned this Jul 2, 2021
Copy link
Contributor

@SiimKirjanen SiimKirjanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ziimk ziimk merged commit b5fe565 into master Aug 2, 2021
@ziimk ziimk deleted the GRAL-2093-camel-case branch September 27, 2021 08:13
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.

Inconsistent use of camelCase breaks things
2 participants