Naming convention: snake_case vs. camelCase
See original GitHub issueThis is a bit of a pedantic (breaking) issue that I found while writing up the OpenAPI spec: due to the naming convention of Postgres (snake_case), most of the fields in the API are also snake_case. It’d be more idiomatic to use camelCase.
There are also other minor issues that I found (mostly to do with types, e.g. string
should be number
), so we can do all that plus the OpenAPI stuff in one go. Probably not gonna eliminate all of such issues, but we can at least kaizen our way there.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Camel case vs. snake case: What's the difference?
Camel case and snake case stand at opposite ends of the variable naming convention spectrum. When multiple words are used to form a...
Read more >Camel Case vs. Snake Case vs. Pascal Case - Khalil Stemmler
While a team can decide upon naming conventions for any project, each programming language has standard naming conventions for different tokens.
Read more >Snake Case VS Camel Case VS Pascal Case VS Kebab Case
Specifically, there are certain naming conventions available across all programming languages, also known as: snake case; kebab case; camel case ...
Read more >Naming Variables: When to use camelCase vs snake_case vs ...
Camel Case. camelCase is for variables, function names, arguments and other generic uses. ; Snake Case. snake_case is similar to camelCase ...
Read more >Snake Case or Camel Case? a Guide to Programming ...
In general, snake case is considered easier to read because the underscores make it clear where one word ends and the next begins....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
yeah it’s already used in prod so it will definitely break. The camel -> snake conversions will be safer because we aren’t using query params, but we are using response keys/objects.
Probably not with the changes to production but regardless, we should prioritize the effort going forward over the effort now. Writing less code is always my number 1 concern, more than blindly following a convention.
My gut is snake_case is going to save us a mountain of effort going forward, but I’ll leave the final decision to you
Side note, I used to always write snake-camel converters between my PG database and my API. When I started using postgREST I stopped doing that and it actually made things conceptually simpler - camel = code, snake = database. Also reduced my LOC. This convention isn’t unheard of either, but not really necessary here.
@wiesson I think this issue https://github.com/supabase/postgrest-js/issues/204 is more relevant.