-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Unhelpful assert if serializer leaves 'id' field as an integer #7086
Comments
@Benjy1979 could you PR a test for this? |
erm....ok I will attempt my first ever test |
Are there any docs anywhere on how to "PR a test"? I'm not sure what a test is, is it a separate project with some test functions in it? Where do I put it when it's done? The unhelpful message is coming out from ember.data and into the console so I'm not sure how to go about testing something like that. |
@Benjy1979 the folders within |
Thank you for opening this issue!
Hopefully, this issue template will help you provide us with enough information to assist in resolving the issue.
Reproduction
Description
If your JSONAPI serializer in a createRecord normalizeResponse hook does not convert the ID field in the JSON from the server into a string instead of an integer, you get something like the following assert:
index.js:172 Uncaught Error: Assertion Failed: Cannot update the id for 'plan:c028ff07-57b3-4281-98b0-ef285c16d3c7' from '5' to '5'.
It doesn't make sense and is quite unhelpful because there is only one call to createRecord so it gives the impression that the adapter is trying to change it twice and ember data is coughing over it.
I would expect it to either auto-convert it or spit out something like:"ID is not of the expected type"
Versions
3.16 Ember data and EMber
Run the following command and paste the output below:
yarn list ember-source && yarn list ember-cli && yarn list --pattern ember-data
.The text was updated successfully, but these errors were encountered: