-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible incorrect format being sent on save #31
Comments
You're right, this addon isn't overwriting the Also https://github.com/201-created/ember-data-hal-9000/blob/master/tests/unit/models/transformers-test.js#L28 should fail because it's checking the |
@scolyer Any chance you can try using the serializer from #33, as @makepanic suggested? I'm curious if that covers your use case, as well. |
Hi @makepanic and @bantic ,
Which I am not happy with as it feels like a giant hack, but it does work for my limited use case :-| |
@scolyer Are you sure you used the I added a test case for your initial payload and it worked: |
I may have done it incorrectly - how do I install an addon directly from a repo instead of from ember-cli? On Mon, Sep 7, 2015 at 10:34 PM, Christian notifications@github.com
|
@scolyer If you:
That should do it. You can check by looking in your node_modules/ember-data-hal-9000 directory and checking that |
to be clear, that's change the version field for the |
Ah, cool thanks @bantic .
|
Is there a way as of Nov 2016 to |
I wrote my custom updateRecord method in HalAdapter to make it working: `
generally I'm sending model only which is in data.data.attributes. |
I know this issue has been stale for a long time, but FWIW here's my view: HAL is meant as a read format and does not specify anything about how to write data. But for a single resource, it also only adds a few special properties to a "natural" JSON representation of an object. What I would expect as the write format for a HAL API (and what we actually use at my company) is that natural JSON serialization of the object properties. Nowadays this (or something very close to this) seems to be implemented by ember-data's JSONSerializer. IMO if serialization could be delegated to this JSONSerializer it would be much less surprising than the serialization that is currently done by the JSONAPISerializer, and it could be a way to achieve a useful serialization behavior without burdening this add-on with a lot of code to maintain. I am not familiar enough with ember-data internals as to how to implement that delegation to submit a PR for this right now though. |
I've been tinkering around with the ember data 1.13.8, the ember-data-hal-9000 and ember-data.model-fragments plugins, and I was a bit surprised to see the following data in a PATCH when I saved my model:
I didn't expect the addition of the attributes, data, and type keys... Is there a way to turn these off and send the data back in the same format it was received? e.g:
The text was updated successfully, but these errors were encountered: