-
-
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
Don't serialize new has many relationships #5324
Conversation
a2841d6
to
111c0d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Looks good if we don't want to automatically save the new record. |
@sly7-7 Yup! I think you're describing a common use case for most applications would want. I'm expecting JSONAPI operations to be the answer to that problem: json-api/json-api#1254 |
@ryanto not super sure why this failed CI. Could you rebase and let it kick off again? |
111c0d6
to
484e3a6
Compare
All set, I'll keep an eye on CI. FYI when I pulled the latest and ran |
victim of a timeout, restarted tests again |
Thanks @ryanto ! |
There is problem with this bug fix. An empty relationship is not serialized anymore, which is a different behavior than before. @runspired @ryanto If you have a relation and remove it and save the record, to inform the backend of that relation change, you need to send that empty array back. |
@juggy Yikes! Sorry about that. Could you give me a failing test case, or even some example HTTP request/responses with what you expect vs what Ember Data is doing? |
Well the format should be the one of 3.1...
|
PR is here: #5466 |
@juggy A fix has been merged, let me know if you run into any other issues. |
Similar to #5317 but for hasMany.
Currently when saving a model with an unsaved
hasMany
a null id is used in the JSON:API document.For example
Generates this post payload (note that we're using serializer option
attrs.users.serialize = true
)This is an invalid payload. To fix this, we'll filter out new records from using in the serialized belongsTo.