Giter Club home page Giter Club logo

Comments (5)

ziimk avatar ziimk commented on August 26, 2024

Hey @dynamodan ! Do you have some concrete examples where this is causing problems?

As mentioned in the README, the SDK is auto-generated and some of the controller functions did not have automatic model mapping - just return $response->body;

To work around this, CamelCaseHelper::keysToCamelCase($response->body) was added to transform the response to at least identical format (keys in camelCase instead of snake_case as they appear in the raw response).

Indeed there is a difference in typing: model-specific objects (a la Pipedrive\Models\CreatorUserId Object) vs stdClass Object after CamelCaseHelper. Is this the blocker for you?

from client-php.

dynamodan avatar dynamodan commented on August 26, 2024

It's for a client so I can't be very specific. Is it concrete enough to say it made my javascript throw a "can't do this because object is null" when I tried to access something in the pipedrive response by its snake_case key?

I had been loading deal IDs by using an itemSearch, then loading the deals one-by-one from the deal id using getDetailsOfADeal. Not efficient, I admit. THEN I discovered I can get the same amount of detail by doing listDealsAssociatedWithAnOrganization and that's when I got camelCased keys. The browser side javascripts were expecting the snake_cased keys as getDetailsOfADeal provides, but got camelCased keys instead.

I really don't have a preference of snake_keys over camelCased. But it would be conventional, consistent, and follow the principles of least astonishment, etc for it to be all one or the other not a mixture.

from client-php.

dynamodan avatar dynamodan commented on August 26, 2024

For now, I've worked around it by implementing an unCamelCase function in my own code.

from client-php.

ziimk avatar ziimk commented on August 26, 2024

Thank you for the additional details! I see now - the keys at the root level of the getDetailsOfADeal() response are mapped to camelCase as expected but some of the sub-properties (like the nextActivity object) contain snake cased keys. This definitely should not happen and we'll implement a fix to unify everything (to camel case)

from client-php.

ziimk avatar ziimk commented on August 26, 2024

@dynamodan would you be able to verify that #45 fixes the issue on your side?

from client-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.