I recently built a Django REST Framework extension library, which, by adding only two of lines of code to your django project, can extend an existing Django REST Framework API with a GraphQL interface.
Pypi : graph-wrap · PyPI
- The dynamic nature of the build of the GraphQL layer means that you can continue to develop your existing REST based API and know that the GraphQL schema will be kept up-to-date automatically.
- Since the GraphQL layer is using the REST API under-the-hood, you can be sure that important things like serialization , authentication , authorization and filtering will be consistent between your REST view and the corresponding GraphQL type.
- You no longer need to “over expose” fields from nested apis - the client can make use of the GraphQL layer to fetch data they need. This can lead to significant performance boosts in certain circumstances (One of the advantages of GraphQL queries is that they solve the n+1 problem which occurs with traditional REST-based APIs).
See Which problems does GraphWrap address for more.
GraphWrap was originally designed for (and still supports) django-tastypie, where it was tested on a production-scale API. The latest release (0.1.0) adds Django REST Framework support. I’ve done fairly extensive testing locally, but haven’t had the opportunity to really test how GraphWrap fairs with a production-scale Django REST Framework API. Any feedback on how well it is/is not working would be greatly appreciated!