-
Notifications
You must be signed in to change notification settings - Fork 77
Serialize and Deserialize data from/to server #59
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
Comments
The serialize: function (data) {
return data;
},
deserialize: function (data) {
return data;
}, |
Oh, duh! Ok, is there any way that I can tell what resource it is? Let's say I had custom de/serialization rules for my User object... |
Oh, and which is it. Is it |
I didn't think of that when I wrote it. I did that for the lifecycle methods, but not these. It looks like you were expecting them to be like the lifecycle methods. And I think it's I will document this better. EDIT: |
Actually, it works like |
Hmmm... Well, like I said, I'm getting that |
It looks like 0: "$http" |
Oops, an entire block of code was nested one level too deep... That's what I get for not having tests for the adapter yet. Better get those before 0.9.0. |
Until 0.9.0, you'll just have to set the default in the run block |
Awesome. Glad we found that 👍 Thanks! |
While you're at it, it would be sweet to have a |
It would be useful to know the resource type in the serialize/deserialize methods, but the DSHttpAdapter API exposes its GET/PUT/POST/DEL/HTTP methods, which when called, are only passed http-related configuration. If you call Perhaps I put the serialization/deserialization in the wrong place. Perhaps this should happen on the DS side of the DS <-> Adapter interface. This would unify how serialization/deserialization happens across adapters. EDIT: and then it would be simple to define serialization/deserialization on a per-resource basis. |
That makes sense to me. Plus, if I understand it correctly, if I really want to, I can put this on $http myself can't I? So this actually doesn't provide a ton of value as it is, correct? |
Correct. If serialization/deserialization is moved to the DS side of the interface, then they'll start to provide more value because they'll work for all adapters, be configurable on a pre-resource basis, and tell you which resource type is being acted upon. |
💰 cha-ching! |
Luckily, because of the way I wrote the resource definition system, simply by moving this over to the DS, (de)serialization will automagically be configurable globally and per-resource. |
My server gives me properties with names like
first_name
and I don't like dealing with that in my code (I'd rather camel case it). So this is what I have:But I'm getting undefined errors on
DSHttpAdapterProvider.defaults
, so I've tried it without thedefaults
and I tried putting it onDSProvider.defaults
just for fun, but it's never called in those cases. What am I doing wrong?The text was updated successfully, but these errors were encountered: