-
-
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
Make id datatype configurable #4477
Comments
Hi @hezus, The reason we don't make it configurable is that If your server only accepts a strict Number type, you could override serialize: export default DS.JSONAPISerialize.extend({
serialize: function(snapshot, options) {
var json = this._super(snapshot, options);
json.id = parseInt(json, 10);
return json
}
}); |
Actually for symmetry we should probably have a |
I am closing this issue since #4620 has been merged: having the |
RELATED: #4166
Assuming a ID is always a string feels very opinionated towards API's which use a UUID.
Wouldn't it be better to set a type for the id? I use ember for many project but most times you work against a REST API which expect the ID to be a integer corresponding to a certain database ID.
It would be nice if the ID datatype is configurable, so it is always a string or integer depending on the settings.
A dynamic typed language like Ruby or Javascript doesn't really care, but whenever I work with a strong typed API this is always a hassle, especially if you work with embedded objects.
The text was updated successfully, but these errors were encountered: