Giter Site home page Giter Site logo

Comments (4)

kud avatar kud commented on May 18, 2024 1

Hello!

I understand now why you used snake_case, as the API is written like this. However, a js client should be an abstraction and also respects the consistency / convention of a language.

I already did a js client for a json:api api which were in snake_case. I did an helper for that wwith https://github.com/blakeembrey/change-case where it transforms any params for the post request or even for the result of the query. Like that, the dev hasn't any issue to understand how to use/write their code.

So yeah, everything should be in lowerCamelCase for the JS Client and you add a little helper to convert everything.

from notion-sdk-js.

aoberoi avatar aoberoi commented on May 18, 2024

Thanks for the feedback! I know its a little odd, but we intentionally chose snake_case for all API parameters, and chose lowerCamelCase for client-specific API.

The reason is that the JSON-formatted body parameters already have snake_case property names, so in a method call that makes an API request a single object with mixed casing would look really odd. We could have made the whole package only use snake_cased symbol names for consistency, but that also felt like it would conflict most of the JS ecosystem (for example, built-ins like Array.prototype.forEach()). So this compromise is where we ended up.

Would you rather see databaseId next to something like start_cursor in an object? Do you have a different proposal?

from notion-sdk-js.

cwang314 avatar cwang314 commented on May 18, 2024

Hi @kud , thanks for the SDK feedback; I've gone ahead and added this to our internal tracker. Truthfully, we probably won't get to this for a while - we're working on improving/enhancing the existing API and there's a decent amount of work to improve types and usability before addressing snake_case vs. camelCase.

We don’t actively monitor the issues in this repo, but in the future you can submit feedback by emailing us at [email protected].

from notion-sdk-js.

kud avatar kud commented on May 18, 2024

seems legit, thank you @cwang314 !

from notion-sdk-js.

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.