-
-
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
1.13 application serializer doesn't default to RESTSerializer #3404
Comments
The default serializer is |
Does opt-in mean that it is using the new API or not, I get a lot of errors which seem to come from models which don't have a serializer defined (so a default serializer will be created with opt-in for the new API), so I suspect that it tries to use the new API for a payload which is not structured the new API way. |
@jcbvm Opting into the new Serializer API basically means that the store calls The built-in serializers supports both the old and the new Serializer API out of the box and automatically returns a JSON-API Document if they are using the new Serializer API. If you haven't defined a serializer it will automatically opt into the new Serializer API since we know that you haven't done any customizations. It should just work. The format of your server response should not have to change when using If you don't have any serializers defined and still get errors, please open an issue as that is most likely a bug. |
Thanks for the clear response, I'll take a look in my issues to see what's really going wrong. |
@wecc opting into the new serializer API for the 1.x series sounds like a mistake. Why change the way the library has been working for everyone else for the past few months and not hold this decision off until 2.x? |
@bcardarella The If you do have custom serializers we cannot automatically opt in as that might break (not necessarily, but probably), that's why custom serializers stay on the old Serializer API until you manually opt in using the The old Serializer API will be gone in 2.0, so we have to deprecate it now. We don't want to deprecate anything without having an alternative route, that's why we support both the old and the new Serializer API in 1.13. Are you experiencing issues without custom serializers? If so, it should be considered a bug and it would be great if you can report it so it can be fixed. I'm also available on Slack and I'd be happy to help. |
I'm afraid this is the point, the expected behavior up until this release was not the new serializer. Opting into the "new way" automatically for everyone in the 1.x series breaks everyone's apps. Not knowing about the flag to set can mean a lot of people are going to spend a lot of time head desking trying to figure out what is going on. It would have been best to have at least one single stable release that was consistent with the beta series then move over to this flag. It's too far gone at this point but it feels like the trigger on this was pulled way too soon. |
This is not what we're doing. We're not opting into the new Serializer API automatically for everyone. We only do it when you're using default, built-in, standard, non-customized serializers. We have been working hard to maintain backwards compatibility and regardless if opting in or not your app shouldn't break. In what way does your app break? |
this is the problem, there are cases where the backend APIs have been customized to fit Ember's default serializer's needs rather than the other way around. |
The new Serializer API has nothing to do with your backend API or what your server payloads looks like. It's only about the communication between the store and the serializer. Take the Using the old Serializer API
Using the new Serializer API
|
Refering to point 3 of the first list, does this mean the store looks at the retrieved data? Or does it look if a custom serializer is used? It the latter is the case, it might break existing apps. |
@jcbvm the store looks at the So, the store knows how to convert the old internal format to JSON-API and the built-in serializers are able to return either the old format or JSON-API. |
Ok so if I understand correctly, if I do not define a custom serializer, the flag |
@jcbvm if you do not define a custom serializer, the flag |
I don't think there are any specific issues related to the new Serializer API that are breaking apps so I'm closing this. Please feel free to reopen if I'm mistaken. |
I know this is ancient and there probably not a lot of people still upgrading to 1.13, but here's what I discovered: So you then need to create an empty serializer for comment and author without overriding isNewSerializerAPI Then if you sideload other objects with author and comment, you'll need to give those sideloaded objects empty rest serializers as well. |
it appears to be defaulting to JSONAPISerializer. This should probably default to RESTSerializer and throw a deprecation warning similar to defaultAdapter
The text was updated successfully, but these errors were encountered: