abcxyz / readability

Readability requirements and source of truth.
1 stars 0 forks source link

JSON: camelCase or snake_case #28

Open pdewilde opened 5 months ago

pdewilde commented 5 months ago

Based on a brief conversation I had added https://github.com/abcxyz/readability/wiki/JSON-Best-Practices#camelcase-over-snake_case to the wiki, but after receiving feedback preferring snake_case in a PR it sounds like we need to ensure we agree on a pattern for abcxyz.

I'm leaving my code as camelCase for now, but part of closing this issue should ensure that abc-updater uses whatever we land on

sethvargo commented 5 months ago

I've found camel case to introduce weird edges, especially with proper nouns. httpRequest is fine, but myHttpRequest is weird. Or should it be myHTTPRequest, which is equally weird. apiVersion, APIVersion, or ApiVersion?

Snake case avoids all these pitfalls because it does not try to overload a casing change as a word boundary.

yolocs commented 1 month ago

I would prefer snake_case as well. Unfortunately many other projects use camelCase. Even proto default marshal produces camelCase.

pdewilde commented 1 month ago

I guess my main argument for camelCase is that js usually uses it, so I would assume json would have the same convention.