Comments (4)
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.
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.
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.
seems legit, thank you @cwang314 !
from notion-sdk-js.
Related Issues (20)
- In version 2.2.13: QueryDatabaseResponse response types include PartialDatabaseObjectResponse | DatabaseObjectResponse HOT 1
- Map over database results union type HOT 3
- `users.me` types refuse `auth` parameter
- DatabaseObjectResponse ts missing title
- Replace node-fetch with isomorphic-fetch HOT 3
- The attribute `name` in database properties is not respected
- I am experiencing difficulties logging into Notion on the Windows platform. This issue seems to be affecting the login process, preventing me from accessing my Notion workspace HOT 1
- DatabasePropertyConfigResponse is a local type HOT 2
- Reading a "Person" property from a database entry returns only the first result
- Notion Formula Has a Bug Regarding Time Formatting HOT 3
- npm install ERR! for 'parse-text-from-any-block-type' examples
- How do I get value from blocks.retrieve
- The `punycode` module is deprecated HOT 3
- Missing `request_id` type in `OauthTokenResponse`
- unable to add external to files HOT 1
- multi_select type bug HOT 1
- Error: Insufficient permissions for this endpoint.
- I found the Mar 22, 2024 bug. I caused the problem HOT 5
- NotionS
- Inconsistent type: Cursor for parameters is string|undefined but for responses is string|null HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from notion-sdk-js.