Route segments naming convention
Can anyone explain why snake_case is the recommended naming convention for route segments?
The route-segments-snake-case documentation mentions Ember doesn't have to do extra serialization in order to resolve promises but I'm not sure what that means exactly.
I would prefer to just use camelCase in our apps, but I first want to understand why snake_case was recommended in the first place 😄
@rwjblue do you happen to know the answer? I stumbled upon this question yesterday too and couldn't find an answer
Basically _id is treated specially in the default Route.prototype.model implementation:
https://github.com/emberjs/ember.js/blob/b815c77d62840c3c252b7177fa442a38e4584659/packages/@ember/-internals/routing/lib/system/route.ts#L1162-L1191
IMHO, this has aged pretty poorly and should be reconsidered, but given that this type of implicit behavior is actually kinda hard to migrate away from the exact transition path is tricky.
We could probably make that regexp match either post_id or postId, but it isn't immediately clear if that should be considered breaking in and of itself. 😩
FWIW, I think we could tweak the rule to make it clearer that _id is the only snake case thing suggested. Everything else could be camel. :thinking:
could we make it an optional feature to use postId instead of post_id, or something like that?
I would like to find a path towards dropping snake-casing conventions entirely.
EDIT: Looks like there's an RFC: https://github.com/emberjs/rfcs/issues/556.