Update not working in 1.0.14
Closed this issue · 4 comments
I think this is caused because _kebabCase is not the same as camelCase. Still investigating.
Hey Alex,
Your pull request would undo the work that specifically went into this commit:
8819013
The reason for this change to camelCase was this issue ticket:
#7
The problem @rjoxford was facing was that multiple word model names were not being properly interpreted by the DS.RESTSerializer.
Since this repository is designed for the DS.RESTAdapter, my team and I decided it would be best moving forward if the repository also used the DS.RESTSerializer as its preferred client serializer.
If you would like to keep using sails-ember-rest with your Ember Data projects, I would recommend setting your default application serializer to be of type DS.RESTSerializer.
The reason you are likely experiencing issues is that unless you override the application serializer Ember.js will use the JSONApiSerializer by default. The JSONApiSerializer looks for kebab-case keys whereas the RESTSerializer is looking for camelCase keys.
As a side note, my team has recently begun work on forking this project to create a true JSON API controller / action set for Sails.js.
@fenichelar - Does swapping the Ember default serializer solve the problem you may be experiencing with your Ember clients?
I will test. Pleaser reconsider this pull request. Maybe release v1.0.15 with this pull request, and then revert the pull request and release v2.0.0. I think this change warrants a major version increment, it broke everything I have....
Haven't ignored your request, but this week is pretty busy on my end.
Have you gotten a chance to activate the REST Serializer in your front end projects? Should be as simple as exporting a new application serializer.
This issue actually has interesting roots based on my research in the issue log of the original sails ember blueprint generator.
The original repo looks like it started to shift towards JSON API when Ember switched the default adapter to JSON API, but the only thing that got changed in the long run was the kebab-casing of payload keys. If anything, this seems like a bug to me because it means you would need to setup the Ember REST Adapter in conjunction with the Ember JSON API serializer if you were to explicitly declare things in your project.
Not sure if rolling out a 1.0.15 with intentionally buggy behavior is worth it when none of the actual internal sails API interfaces have changed, and therefore this patch would not necessitate a version 2.0 in the first place. I think that scoping the major version of this project should generally be focused on major internal API overhauls that would impact Sails programmers, not Ember programmers.
FYSA, there will be a major version bump in the medium term because we are planning on dropping lowercase class constructors in favor of uppercase constructors. ( new Controller() instead of new controller() ) Right now the code supports both, but the lowercase name will probably be patched to throw deprecation warnings in 1.0.15.
I have not had a chance to activate the REST serializer.
The reason I suggested a major version bump is that this is a breaking change on the API design. An application that used to work no longer works if designed with the original behavior in mind.
I understand your description of this as a bug. I pinned the specific version of the package to prevent issues.