Hello
This was motivated by a desire to simplify my CLJS workflow. I'm hoping
there's enough overlap in this group that posting about providing a Python
server based Pull API is not just noise.
Essentially, I've done a little python work to try and produce a Pull API
for my existing Django (python) backend which uses the Django REST
framework.
This approach builds on the existing query features provided by ViewSets
allowing for things like search, filter, limit, offset. It also benefits
from the ViewSet/Serializers features which allows a layer of security and
massaging on top of the underlying models.
A request looks like this:
GET /api/person/2147/?pull=["*",{"friends":["name","location"]}]
Here's the code so far.
https://gist.github.com/olivergeorge/ee837b44613ce93064aa
The current solution does pruning at the point get_serializer is called.
There's some limitations to this. The approach needs to know the models it
might recurse into but for fields declared manually there are no queryset
resolve a model. (Thus the PullSerializerMixin work around).
I'd like advice on a more suitable approach (the DRF group is quiet so I
thought this email might be worth a try). I'm hoping that with some
guidance I can reengineer to better embrace the architecture and make this
something suitable for general use.
cheers, Oliver
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.