I'm looking into this library, and have had pretty good luck with it off the bat. I'm wondering what you'd recommend for data that returns a resource URI rather than including the data in the parent resource. For example, say I have a Basket:
{
"id": "9",
"eggs": [
"http://myapi/v1/eggs/14/",
"http://myapi/v1/eggs/19/"
]
}
I could then have two models like
class Egg(Model):
id = IntField(xpath='/root/id')
color = CharField(xpath='/root/color')
finders = {
(id,): 'http://myapi/v1/eggs/%s/',
}
class Baskets(Model):
id = IntField(xpath='/root/id')
eggs = Collection(Egg, xpath='/root/eggs')
finders = {
(id,): 'http://myapi/v1/baskets/%s/',
}
Is there a way to automatically retrieve the eggs from the URL provided, rather than expecting the Egg data to be in the view I'm retrieving?
The way I'm understanding it, if I made the eggs collection use CharField instead of Egg as the type, then append /list-item to the xpath, I can access the URLs, but I still wouldn't be able to get the item data using Baskets.objects.get(id=9).eggs[0].color.
I'm open to making a PR if you can point me in the right direction of what kind of solution would fit this model.
I'm looking into this library, and have had pretty good luck with it off the bat. I'm wondering what you'd recommend for data that returns a resource URI rather than including the data in the parent resource. For example, say I have a Basket:
I could then have two models like
Is there a way to automatically retrieve the eggs from the URL provided, rather than expecting the Egg data to be in the view I'm retrieving?
The way I'm understanding it, if I made the
eggscollection useCharFieldinstead ofEggas the type, then append/list-itemto the xpath, I can access the URLs, but I still wouldn't be able to get the item data usingBaskets.objects.get(id=9).eggs[0].color.I'm open to making a PR if you can point me in the right direction of what kind of solution would fit this model.