Closed thetutlage closed 10 months ago
I believe Romain might have received this feedback from various channels and therefore he might be able to share more insights.
Correct. It also creates some confusion with the validation system because your frontend receives snake_case
and sends back snack_case
, so validation must be snake_cased
too.
Also, some API guidelines recommend using camelCase
too, so there are no real conventions over what kind of casing you must use when creating an API.
In the end, it complicates everything mentally. I believe it is way better to stay in camelCase
when we are outside of the database. Too much conversion creates confusion.
This PR introduces a breaking change as it switches the naming strategy of ORM to camelcase. If this PR gets merged, this is how everything will be named.
camelCase
. Because, that is how we name properties and variables in JS.snake_case
(no change here).snake_case
(no change here).model.toJSON()
will becamelCase
. This is the breaking changeWhy the change
The internal discussion was initiated by @RomainLanz to use camelCase for the serialized output as well. Models are usually (but not limited to) serialized when sending a JSON response for an HTTP API and a lot of the HTTP API consumers are frontend JavaScript clients which prefer
camelCase
oversnake_case
and hence they have to rename all these properties.I believe Romain might have received this feedback from various channels and therefore he might be able to share more insights.