I've seen multiple posts about this (#139, #413, #585, #1254, #1381), but none of those provide a concrete solution. I think it really stems from the fact that some ReST API's just don't abide by the same rules throughout the path hierarchy. id fields are different, responses/post body may be wildly different.
Let's take for instance an example resource:
/api/cars/{modelId}/wheels/{wheelId}
So far we have two different ID fields. From the documentation, it seems like this is should be the approach:
But this does not work. Per the FAQ documentation, we need to set the getIdFromElem method.
If the ReST API also expects different information for the post body and returns different things for get/getList, the implementation starts to get unwieldy as shove everything under the top parent resource, like so:
The addElementTransformer for adding a wheel service to car, seems like it should work, but invoking Restangular.service(parent)removes all the prior configuration of wheelConfig.
Is there anyway to create a nested configuration/service that does not directly inherit (in this broken use case override) any configuration from the parent resource, except maybe the path building aspect?
I've seen multiple posts about this (#139, #413, #585, #1254, #1381), but none of those provide a concrete solution. I think it really stems from the fact that some ReST API's just don't abide by the same rules throughout the path hierarchy.
id
fields are different, responses/post body may be wildly different.Let's take for instance an example resource:
/api/cars/{modelId}/wheels/{wheelId}
So far we have two different ID fields. From the documentation, it seems like this is should be the approach:
But this does not work. Per the FAQ documentation, we need to set the getIdFromElem method.
If the ReST API also expects different information for the
post
body and returns different things forget
/getList
, the implementation starts to get unwieldy as shove everything under the top parent resource, like so:Realistically, it would make the most sense if you could create a Restangular configuration and use that to create a service under a parent.
The
addElementTransformer
for adding awheel
service tocar
, seems like it should work, but invokingRestangular.service(parent)
removes all the prior configuration ofwheelConfig
.Is there anyway to create a nested configuration/service that does not directly inherit (in this broken use case override) any configuration from the parent resource, except maybe the path building aspect?